Regards all, This codes generates a hang on cpu . Please kindly take this & guid me : #include <w78e65.H> #include <stdio.h> main() { unsigned char i; TMOD=0x20; SCON=0x52; TH1=0xfa; TR1=1; for(i=0;i<=255;i++) { printf("%bd",i); P2=i; } } /**************************************/
Suggestion: Add a loop counter variable to tell you exactly how many times it executes before er.. hanging. I would suggest adding a delay inside the loop, enough to allow for the uart to transmit the byte before writing a new value into sbuf, say 2ms @ 9600baud. Why use printf() for this? It's as easy as that.
Run it in the simulator and see what happens.
William, You are right, i faced a similar problem, which was because of sending a byte too early when the previous one is being transmitted.
I would suggest adding a delay inside the loop, enough to allow for the uart to transmit the byte before writing a new value into sbuf To what purpose, what is wrong with testing RI? Erik
For starters... it wouldn't work. Testing "TI" might though. :)
OOPS Erik