Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/12/03 05:23
Read: times


 
#48130 - c=SBUF; what's going wrong?
#include <at89x51.h>
#include <intrins.h>

volatile unsigned char data c;

void main (void) {
// baud rate using timer1
TMOD = 0x20; // timer 1 in mode 2
TH1 = 0xFD; // 9600 baud
TR1 = 1; // start timer 1
SM0 = 0; SM1 = 1; // serial mode 1

REN = 1; // receive enabled
ES = 1; // enable serial interrupt
EA = 1;

while (1) {
P1 = c;
}
}


void receive(void) interrupt 4 {
if (_testbit_(RI)) {
c = SBUF; // why c always get 0 ?
}
}

When simulate using keil C debugger, the variable c always maintain 0x00 no matter what value SBUF is. I can't think of any explanation. Debugger's bug? Do you have any idea.

Regards,

of what going wrong?
>
>Regards


List of 11 messages in thread
TopicAuthorDate
c=SBUF; what's going wrong?            01/01/70 00:00      
   RE: c=SBUF; what\'s going wrong?            01/01/70 00:00      
      RE: c=SBUF; what\'s going wrong?            01/01/70 00:00      
   RE: c=SBUF; what\'s going wrong?            01/01/70 00:00      
   RE: c=SBUF; what's going wrong?            01/01/70 00:00      
      RE: c=SBUF; what's going wrong?            01/01/70 00:00      
   RE: c=SBUF; what's going wrong?            01/01/70 00:00      
      RE: c=SBUF; what's going wrong?            01/01/70 00:00      
   RE: c=SBUF; what's going wrong?            01/01/70 00:00      
      RE: c=SBUF; what's going wrong?            01/01/70 00:00      
      RE: c=SBUF; what's going wrong?            01/01/70 00:00      

Back to Subject List