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

Testing binary serial input in µVision4 debugger

I wrote a piece of code which uses small memory model. It compiles to 65 bytes data and 1646 bytes code. I'm using 3 register banks and all 16 bytes of bit addressable memory. My SP is initialized to address 30h. My main only initializes the hardware and goes into busy wait. I use timer interrupts to send output to parallel ports. The system receives 8-bit commands via serial port, and all commands are binary, like machine code.

My problem is that I can't send my commands to serial port in the debugger in µVision4. The serial window allows me to type to the serial port, but most of my commands do not map to typable characters in ASCII table. The serial tool allows me to trigger and interrupt by setting either RI or TI, but I can't set the contents of the buffer for receive interrupt.

The solution I came up with is to put a breakpoint in the serial interrupt routine, just after the contents of the buffer are read, and use watch window to set the variable into which it is read to the value of my desired command. However, my code is behaving erratically when I do this and I'm not sure whether this is because of the way I'm testing or some other error I've made. It works fine when I don't trigger any serial interrupt. Also, triggering a serial RI interrupt without touching any variables in watch window works without problems: the system receives and executes the 0x00 command. However, when I change a variable in watch window, it sometimes works as intended and sometimes jumps to a forbidden code memory location filled with zeroes.

Any pointers, either towards more reliable code or more reliable testing, would be much appreciated. Thanks in advance.

Parents Reply Children