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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Michael Karas
02/20/12 09:25
  02/20/12 09:31

Read: 539 times
Beaverton Or

#186064 - READ_SERIAL
Responding to: ???'s previous message
When you write the instruction..

    JNB RI,$

.. it means "loop here forever until the RI bit becomes set". If that is the behavior that you expected then you are set. Single stepping the instruction would not advance until RI is advanced so the behavior you are getting would match your expectation.

If you wanted some other behavior so that the program that called your READ_SERIAL didn't freeze up then you will have to add some more code. You could change the test of the RI bit so that READ_SERIAL routine returned some indication that a byte was read or not. One way would be to return the CARRY flag set if a byte is read and cleared if not. This way the caller to READ_SERIAL could do other work as well and calling READ_SERIAL periodically to see if a byte comes in.

If in your debug process you have arranged for a byte to come to the UART such that the RI bit should be getting set from time to time and yet you still always freeze up at the JNB RI,$ then this could be indicative of any one of a number of errors or oversights in your program or hardware setup. These could be any one or more of:

a) Is the UART initialized and the receiver enable bit set?

b) Have you setup the UART with a valid baud rate clock? Input cannot be processed by the UART without a valid receiver side clock at 16X the desired baud rate.

c) Is the header file that defines the RI bit specifying the correct bit address? Check against the data sheet for your MCU to make sure.

d) Do you have the MCU internal peripheral logic configured properly to allow the RxD signal to make it from the designated pin to the onboard UART? As I see that you are using the SiLabs C8051F020 MCU this includes the proper initialization of the cross bar mechanism to allow the RxD signal from the pin to the UART.

e) Have you verified that the received serial data signal actually arrives at the proper MCU pin? An oscilloscope is the tool of choice to check this.

Michael Karas

List of 17 messages in thread
Help. Writing Hex code from serial port to External device      Dave McNamara      01/27/12 15:42      
   Look at this      Michael Karas      01/27/12 18:46      
      Using 8051      Dave McNamara      01/28/12 03:19      
   Why ASM?      Andy Neil      01/30/12 14:43      
      Design your subroutine(s)      David Prentice      01/30/12 15:20      
   RI Flag      Dave McNamara      02/20/12 08:48      
      READ_SERIAL      Michael Karas      02/20/12 09:25      
         RI setup      Dave McNamara      02/20/12 09:57      
            are you sure?      Erik Malund      02/20/12 10:04      
               CKCON      Dave McNamara      02/20/12 10:22      
                  well, then      Erik Malund      02/20/12 11:17      
                     Correct      Dave McNamara      02/20/12 12:11      
                        RI and TI      Erik Malund      02/20/12 12:24      
                           Ok      Dave McNamara      02/20/12 12:32      
                              Diff Of TI and RI      Michael Karas      02/20/12 12:57      
                                 Uart stall      Maarten Brock      02/22/12 07:01      
                        Oscilloscope      Per Westermark      02/20/12 17:04      

Back to Subject List