blacksnow
Junior Member level 2
I developed a pulse counter using external interrupt (using software counter) which is working fine and showing the desired result on LCD in proteus. Now i want to send each incremented count to serial port but this is not working. My code is the following, (please give me some suggestion to rectify the problem).
void serial_ISR () interrupt 4 {
if(TI){
TI = 0;
for (p=0; p<=s; p++){
SBUF = digit[p];
}
}
void EX1_ISR () interrupt 2 {
if(k<177){
k = k + 1; //k is global
ind = 0; // for LED indication
}
else
ind = 1;
LCD_DISPLAY(k); // LCD function
}
void main(void){
.....
....
.....
while(1){
split2dig(k); // for sending individual digit
}
}
void split2dig(unsigned int val)
{
unsigned int val1, den = 10000;
s = 0; // global
while (den!=0){
digit= (char)(val1/den);
digit= digit+ 48;
val1 = val%den;
den = den / 10;
s = s + 1;
}
}