|
|||||||||||
|
Technical Support Support Resources
Product Information |
µVISION DEBUGGER: Problems Simulating the Serial InterfaceInformation in this article applies to:
QUESTIONI'm using the µVision Debugger to simulate my serial interface and I'm having problems receiving characters. My function to receive characters appears as follows:
char getch (void) {
while (!RI);
RI = 0;
return (SBUF);
}
This function always returns a value of zero when I run it in the simulator. It seems to work on the real hardware so why does the µVision simulator fail? ANSWERThis function is potentially unsafe because it resets the RI bit before reading the SBUF register. In the real hardware, this code may work most of the time. However, the RI bit is being cleared too early. The µVision debugger always returns 0 in such cases. You should change the function to the following:
char getch (void) {
char ch;
while (!RI);
ch = SBUF;
RI = 0;
return (ch);
}
SEE ALSOLast Reviewed: Tuesday, February 23, 2021 | ||||||||||
|
|||||||||||
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.