??? 08/08/06 18:43 Read: times |
#121874 - char VS int Responding to: ???'s previous message |
#include <reg51.h> void delay(void) { unsigned int i; for(i=0;i<32767;i++) i=i; } void main(void) { unsigned int j; while(1) { for(j=0x01;j<=0x80;j<<=1) { P0=j; delay(); } } } well, this code works as intended, an LED chase from P0.0 to P0.7 in an infinite loop. But replacing 'unsigned int' with 'unsigned char' limits the chase sequence to only once. i.e after one complete chase sequence, all pins of P0 are grounded. This question might sound quite silly for most people out there, but please bear. Thank you Ashwin V |