Dec 27, 2015 #1 8 8051HELP Member level 1 Joined Nov 27, 2015 Messages 32 Helped 0 Reputation 0 Reaction score 0 Trophy points 6 Activity points 251 I need to put on display NUMBER of elements in string which are less than 5. SO i dont know how to put that result on display HELP Code: byte string[16]={1,22,31,4,5,6,7,8,23,17,10,30,73,40,55,93}; byte i=0; byte counter; byte a; byte xdata display _at_ 0x8002; void Inic(void) { EA=1; ET0=1; TMOD=0x01; TH0=0x3C; TL0=0xAF; counter=20; i=0; TR0=1; } void timer0 (void) interrupt 1 using 2 { TH0=0x3C; TL0=0xAF; if(counter==0) { counter=20; a= string[i]; if(a<5) display = a; number++; if(i==16) {i=0; } i++; } counter--; TR0=0; } void main(void) { Inic(); while(1){TR0=1;} }
I need to put on display NUMBER of elements in string which are less than 5. SO i dont know how to put that result on display HELP Code: byte string[16]={1,22,31,4,5,6,7,8,23,17,10,30,73,40,55,93}; byte i=0; byte counter; byte a; byte xdata display _at_ 0x8002; void Inic(void) { EA=1; ET0=1; TMOD=0x01; TH0=0x3C; TL0=0xAF; counter=20; i=0; TR0=1; } void timer0 (void) interrupt 1 using 2 { TH0=0x3C; TL0=0xAF; if(counter==0) { counter=20; a= string[i]; if(a<5) display = a; number++; if(i==16) {i=0; } i++; } counter--; TR0=0; } void main(void) { Inic(); while(1){TR0=1;} }