Hi
I am using codewarrior 10.5. I have created a new MQX Lite project. In that I am using Console_IO PE component. When I tried printing string it works well. When I tried printing integer values, I noticed some strange behavior. i.e
1. "\n" is not working when using at the end of a string.
2. For the following program, the values are coming abruptly
void Init_task(uint32_t task_init_data)
{
int i;
while(1)
{
printf ("i = %d\n", i++);
_time_delay_ticks(1000);
}
}
the o/p I am getting in terminal window is
I am using K60 uc. The above o/p is for one shot. i.e it repeats each time after _time_delay_ticks(1000);
I found one document MQX_IO drivers. http://cache.freescale.com/files/32bit/doc/user_guide/MQX_IO_User_Guide.pdf on page no 16, there are functions for IO so for printf we can use _io_printf but that is giving an error.
How do I fix this issue. Initially I will be displaying the data in terminal window later I will be storing the values in SD card. But if this error persists then It won't be possible. Please look into this matter.
Kind Regards
Amit Kumar
Hi,
you have to initialize variable i like this:
int i = 0;
Also it is better to use \r\n as line ending.
printf ("i = %d\r\n", i++);
Best regards,
Karel
Hi Carlos
I figured the issue but don't know how to resolve it. While debugging, The progrm was going to PEDebughalt (the uc was restarting)so on further investigation I found the issue was of _time_delay_ticks(100); on removing this line and using WAIT component of Erich Styger resolved the issue. One more issue I had was I wanted to print floating values to terminal so I used the following configurations.
So these 2 issue were there, which made the uc to restart.
The program I have attached had the _time_delay_ticks(100); issue.
The Floating point setting was found in the other program(MQX_Lite based). So my concern is how to resolve these issue? as I want ms level precision in my project and I will be logging data in SD card with ms i.e HH:MM:SS:ms format so I was thinking of using the system timer 1 i.e
I dont want to switch to codewarrior 10.6 as there are some issues with it Is there a bug in PE of codewarrior 10.6?
Kind Regards
Amit Kumar
Hi Karel
thanks for quick response I followed your instructions. I think the device is restarting by it self.
the result is as following
Kind Regards
Amit Kumar