I recently took a DwF course on Processor Expert and MQX lite. One of the labs used PE to configure console I/O for input (using getchar) and output (using printf). When I follow the lab now, the getchar() function returns something even when nothing is typed, so the program continually scrolls the output. Even when I import the board configuration from the actual class it does not work correctly - the output continually scrolls with the "Invalid Selection" message.
Is there something that needs configuring on the Console I/O component so that getchar() will work correctly? I'm using CodeWarrior 10.5 and the CodeWarrior Terminal window (but HyperTerminal and TeraTerm do the same thing.). The code is:
while(1)
{
printf("Welcome to the PEx Serial Console\n");
printf("Select from the following menu: \n\n");
printf("1 : Blink Red LED\n");
printf("2 : Stop Blinking Red LED\n");
temp_char = getchar();
if (temp_char == '1')
{
printf("\nBlinking Red LED\n\n");
BlinkTimer_Enable(NULL);
}
else if (temp_char == '2')
{
printf("\nNot Blinking Red LED\n\n");
// Stop timer and turn off LED
BlinkTimer_Disable(NULL);
RedLED_PutVal(NULL, 1);
}
else
printf("\n\nInvalid Selection!!!\n\n");
}
Solved! Go to Solution.
Hello,
please find the attached hot-fix. After applying it you should be able to see the "Wait until at least one char is received" property and use ConsoleIO component without any additional problems. To apply the patch just copy MCU folder in the archive over existing MCU folder in your CW installation (details in the readme file in the archive).
We are sorry for inconvenience.
Best regards
Vojtech Filip
Processor Expert Support Team
Hi,
CW MCU v10.5 Update 1.0.0 Available on WEB!
This update is for CodeWarrior Development Studio for Microcontrollers v10.5. It fixes the following defects:
- ENGR00283122 – The Processor Expert ConsoleIO component changed from blocking to non-blocking, so code generated for the getchar() function returned something even when nothing is typed. The "Wait until at least one char is received" property was fixed to correct this issue.
This update solved the problem you've reported.
you can downloaded it from our web site via the link:
http://www.freescale.com/webapp/sps/site/overview.jsp?code=CW_UPDATES_MCU_10_5
Regards
Pascal
Hi,
new property "Wait until at least one char is received" has been added into the ConsoleIO component. Default value of this property is "yes". See componet help for more information. I have just tested your code with this setting and it works as expected. Please verify your ConsoleIO component setting or provide your project for testing.
MVa
Hello,
please find the attached hot-fix. After applying it you should be able to see the "Wait until at least one char is received" property and use ConsoleIO component without any additional problems. To apply the patch just copy MCU folder in the archive over existing MCU folder in your CW installation (details in the readme file in the archive).
We are sorry for inconvenience.
Best regards
Vojtech Filip
Processor Expert Support Team