Configuring Console I/O in Processor expert for Freedom KL-25Z

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Configuring Console I/O in Processor expert for Freedom KL-25Z

Jump to solution
1,810 Views
LanceHalsted
Contributor I

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");

  }

Labels (1)
1 Solution
797 Views
vfilip
NXP Employee
NXP Employee

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

View solution in original post

0 Kudos
4 Replies
797 Views
trytohelp
NXP Employee
NXP Employee

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:

  • General

- 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

0 Kudos
797 Views
MVa
NXP Employee
NXP Employee

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

0 Kudos
797 Views
LanceHalsted
Contributor I

Hi,

Thanks for your response. I cannot find the new property you mention in processor expert or in the help on component. I'm using CodeWarrior 10.5 with the integrated Processor Expert. I'm attaching my project.

Thanks, Lance

0 Kudos
798 Views
vfilip
NXP Employee
NXP Employee

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

0 Kudos