??? 03/08/04 10:01 Read: times |
#66228 - RE: What is the problem now Responding to: ???'s previous message |
Deepak Kash wrote:
------------------------------- I re-wrote a program to use transmit buffer,simulation is perfect but when I load it on the 2051 chip there is nothing The program is supposed to send 'r' on separate line continously what's the problem ? Lots of things, lets look at them one at a time: Your ISR ;Serial ISR ;On serial interrupt at 0023h we analyse RI or TI,If RI is set then mov content of sbuf into accumlator ;and clr RI and RETI , else check if it was TI then clr TI incremement the circular buffer pointer R0 and ;move data the location pointed by R0 to sbuf and RETI SERIAL: JB TI,CLEAR mov sbuf,#00h clr ri reti CLEAR: CLR TI cjne r0,#43h,next sjmp out next:inc r0 mov sbuf,@r0 out:RETI END 1) your comment is not correct and incomplete. 2) what is the meaning of mov sbuf,#00h clr ri reti 3) where do you send "r" continuously? The only thing I see here is that you test for your pointer being equal to 0x43, and only then transmitting a char (code in bold) 4) if you are trying to accomplish this with following code: load:mov r0,#40h LOOP: cjne r0,#43h,send sjmp load send:mov sbuf,@r0 SJMP LOOP it will not work either... you first load r0 with 0x40 you then test if r0 is equal to 43... if it's not you reload your R0 with 0x40 again... You'll never reach 0x43 in R0... My advice: a) Carefully read the bible and the tutorials b) Take a blank sheet of paper, draw a decent flow-chart. and only then try to implement this step by step. If it does not work, look at what you have written and do manually what you cpu would do. Only then will you see where your logic was wrong. You will never debug a program by just looking at it and trying to do something without actually understanding what you do. regards Patrick |