This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Can i view the incoming bytes from COM1 when simulating?

Hi, everyone:
My program is communicating with a device via RS232. I issued debug commands like this:
mode COM1 19200,0,8,1
assign COM1 <sin >sout
Communication works well, and i can see the outgoing data (sent by my program) from within the Serial Window. I can also use the slog command to log the output into a file. But, how can i view the incoming data sent by the device during debug session?

regards,
d.curie

Parents
  • There are a number of ways. A few that come immediately to mind (and are, therefore, probably not perfect) are:

    1. Create a debugger function that is triggered by a breakpoint placed in your serial input processing code, be that an interrupt or loop or what have you. This signal function can use the debugger's printf() command to issue messages to the console.

    2. In your target application, use printf() or puts() at the same place as in #1 to send this data to the serial window. Of course, this may be problematic since you'll be using the same serial interface that your app is using to communicate.

    3. Set a Watch point on your incoming serial buffer.

    I'm sure there are better alternatives and permutations, but any of these methods should get you moving.

Reply
  • There are a number of ways. A few that come immediately to mind (and are, therefore, probably not perfect) are:

    1. Create a debugger function that is triggered by a breakpoint placed in your serial input processing code, be that an interrupt or loop or what have you. This signal function can use the debugger's printf() command to issue messages to the console.

    2. In your target application, use printf() or puts() at the same place as in #1 to send this data to the serial window. Of course, this may be problematic since you'll be using the same serial interface that your app is using to communicate.

    3. Set a Watch point on your incoming serial buffer.

    I'm sure there are better alternatives and permutations, but any of these methods should get you moving.

Children
  • Hi, David
    Thanks for your immediate help. And i prefer the 1st method. 8-)
    By the way, uVision seems not to distinguish between the receiving SBUF and the sending SBUF in 8051. When i execute the following command upon a breakpoint, what my program is sending, among others unknown, is echoed to the output window.
    printf("%02X \n", SBUF)
    I'm forced to use a somehow obscure alternative:
    printf("%02X \n", \isr\sci_isr\c)

    curie

  • uVision seems not to distinguish between the receiving SBUF and the sending SBUF in 8051

    Yep. That's the way the 8051 works.

    Maybe you should take a look at SIN and SOUT.

    Jon