8051HELP
Member level 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
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;}
}