lecutus
Joined: 12 Aug 2009 Posts: 40
|
Proper use of get_string |
Posted: Thu Sep 17, 2009 3:48 pm |
|
|
Proper use of get_string
My situation is that I can't get the output from the rs232 using get_string(str1,30) to stay in the output shown:
!!!5000;740;124;500;0&&&
The str1 for what ever reason doesn't stay in this format. When I try to print str1, it shows only partial data:
!!!5000;740;1
Another odd scenario, is when I use get_string any printf's following will not be executed. It seems to just do, get_string(str1,30), and jump out of the subroutine.
What am I doing wrong?
Situation:
From a computer a packet is sent over rs232 to the PIC18F258, this where some of the processing is done, then to the engine via canbus/j1939. At this point everything is halted and waits for a response.
Response sensed and is sent back to the PIC, over the rs232, and back to the computer for final processing and display.
Problem area/code:
Code: | get_string(str1, 30);// yes this puts string to output
printf("srt1 = %s and is %u long", str1, strlen(str1)); line_feed(); <,<<not executed
|
Sample output:
2009/09/17 15:56:46:1093 PIC5000 started
2009/09/17 15:56:46:4062 5000 's port_in has: !5000;740;124;500;0&&&
2009/09/17 15:56:46:8750 5000 's port_in has: !5000;74
2009/09/17 15:56:47:3906 5000 's port_in has: !!!5000;
2009/09/17 15:56:48:8750 5000 's port_in has: !5000;740;124;500;0&&&
2009/09/17 15:56:49:3750 5000 's port_in has: !!!5000;
PCHWD 4.079
Thanks
L. |
|