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

Back to Subject List

Thread Closed: Issue successfully resolved

???
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

List of 61 messages in thread
TopicAuthorDate
What is wrong in my serial comm prog            01/01/70 00:00      
   RE: What is wrong in my serial comm prog            01/01/70 00:00      
      RE: What is wrong in my serial comm prog            01/01/70 00:00      
         RE: What is wrong in my serial comm prog            01/01/70 00:00      
         RE: What is wrong in my serial comm prog            01/01/70 00:00      
            RE: What is wrong in my serial comm prog            01/01/70 00:00      
            You mean the ISR?            01/01/70 00:00      
   RE: What is wrong in my serial comm prog            01/01/70 00:00      
   RE: What is wrong in my serial comm prog            01/01/70 00:00      
      Deepak disappeared            01/01/70 00:00      
         RE: Deepak (dis)appeared            01/01/70 00:00      
            RE: Deepak (dis)appeared            01/01/70 00:00      
               The problem continues            01/01/70 00:00      
                  What I have understood till now            01/01/70 00:00      
                     RE: What I have understood till now            01/01/70 00:00      
                        RE: What I have understood till now            01/01/70 00:00      
                           Hans van Pelt & patrick de groote            01/01/70 00:00      
                           RE: What I have understood till now            01/01/70 00:00      
                           What is the problem now            01/01/70 00:00      
                           What is the problem now            01/01/70 00:00      
                              RE: What is the problem now            01/01/70 00:00      
                        Is this okay            01/01/70 00:00      
                           RE: Is this okay            01/01/70 00:00      
                              RE: Is this okay            01/01/70 00:00      
                              RE: Is this okay            01/01/70 00:00      
                                 RE: Is this okay            01/01/70 00:00      
                                    re:is this okay            01/01/70 00:00      
                                       RE: re:is this okay            01/01/70 00:00      
                                       RE: re:is this okay            01/01/70 00:00      
                                          I think this should be okay            01/01/70 00:00      
                                             RE: I think this should be okay            01/01/70 00:00      
                                                RE: I think this should be okay            01/01/70 00:00      
                                                   RE: I think this should be okay            01/01/70 00:00      
                                                   RE: I think this should be okay            01/01/70 00:00      
                                                      RE: I think this should be okay            01/01/70 00:00      
                                                      RE: I think this should be okay            01/01/70 00:00      
                                                         RE: I think this should be okay            01/01/70 00:00      
                                                            I will wait for my victory            01/01/70 00:00      
                                                               RE: I will wait for my victory            01/01/70 00:00      
                                                                  RE: I will wait for my victory            01/01/70 00:00      
                                                                     RE: I will wait for my victory            01/01/70 00:00      
                                                                     RE: I will wait for my victory            01/01/70 00:00      
                                                                        RE: I will wait for my victory            01/01/70 00:00      
                                                                           RE: your hardware            01/01/70 00:00      
                                                                        RE: I will wait for my victory            01/01/70 00:00      
                                                                     RE: I will wait for my victory            01/01/70 00:00      
                                                               RE: I will wait for my victory            01/01/70 00:00      
                                                                  RE: I will wait for my victory            01/01/70 00:00      
                                                                     I will be the victor soon            01/01/70 00:00      
                                                                        Protect dptr            01/01/70 00:00      
                                                                           RE: Protect dptr            01/01/70 00:00      
                                                                        RE: I will be the victor soon            01/01/70 00:00      
                                                                     RE: I will wait for my victory            01/01/70 00:00      
                                                                        RE: I will wait for my victory            01/01/70 00:00      
                                 RE: Is this okay            01/01/70 00:00      
                                    RE: Is this okay            01/01/70 00:00      
                                       RE: Is this okay            01/01/70 00:00      
                                    RE: Is this okay            01/01/70 00:00      
                                       RE: Is this okay            01/01/70 00:00      
                                       RE: Is this okay            01/01/70 00:00      
   close this discussion            01/01/70 00:00      

Back to Subject List