Hi Prateek,
(like Maarten I cannot see anything wrong with
your code or the generated assembly,)
just a guess, could you try:
unsigned char serial_read(){
unsigned char c;
while(!RI);
c = SBUF;
RI = 0;
return c;
}
instead of:
unsigned char serial_read(){
while(!RI);
RI = 0;
return SBUF;
}
the proposed code avoids the jbc instruction and
reads SBUF before resetting the RI bit.
Should not matter but might be worth a try.
Results in:
_serial_read:
; test.c:34: while(!RI);
00101$:
jnb _RI,00101$
; test.c:35: c = SBUF;
mov dpl,_SBUF
; test.c:36: RI = 0;
clr _RI
; test.c:37: return c;
ret
instead of:
_serial_read:
; test.c:25: while(!RI);
00101$:
; test.c:26: RI = 0;
jbc _RI,00108$
sjmp 00101$
00108$:
; test.c:27: return SBUF;
mov dpl,_SBUF
ret
Greetings,
Frieder
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user