Hi All,
As you might know Im working with a bluetooth module.
I'm able to configure this module trough the UART component and that aspect is working really well, only I have some trouble handling the responses.
I have no trouble with receiving these responses but I need to isolate the different responses.
I don't know how to describe what Im after, but its kind of like detecting a newline char / code to know when a response ends.
for instance when the module boots up I get the following response "viewed with serial monitor"
But what I see on My LCD screen when receiving with RXINT0 is the following (well looks pretty close)/(If you look Ad the video I posted you can see what I mean) :
V5.0 RC11 ||| || Rea
The 3 vertical bars is the way the LCD interprets the 0x0A char and the 2 vertical is the 0x0D char don't know of hand if this is newline or line feed.
I need I way to receive the responses just like the serial monitor showing in the above image.
I hope somebody can help me with this, because I can't come up with something that works. I have the same problem with the Vinculum 1 Component.
Regards Jordy
PS. the video link: http://www.matrixmultimedia.com/mmforum ... 58&t=14623
Handling Received RS232 Messages
Moderator: Benj
- Jordy101091
- Posts: 519
- Joined: Sat Jan 08, 2011 4:02 pm
- Location: The Netherlands
- Has thanked: 25 times
- Been thanked: 188 times
- Contact:
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
- Contact:
Re: Handling Received RS232 Messages
The 0x0a & 0x0d combination signals the end of a line. So you should use it to skip to the start of the next line on your display. While in command mode these characters will always be end of line. Terminal emulation software responds to the characters as old teletypes would, 0x0a is new line, so the cursor will move to the next line at the same column it was (so if at line 1, column 10 it will go to line 2 column 10) and 0x0d is carriage return, which resets the cursor position the to start of the (same) line.
When reading the characters from the module you can effectively use 0x0d to signal the end of the line and ignore the 0x0a.
You might want to take a look at the Hayes command set for some background information.
When reading the characters from the module you can effectively use 0x0d to signal the end of the line and ignore the 0x0a.
You might want to take a look at the Hayes command set for some background information.
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
- Jordy101091
- Posts: 519
- Joined: Sat Jan 08, 2011 4:02 pm
- Location: The Netherlands
- Has thanked: 25 times
- Been thanked: 188 times
- Contact:
Re: Handling Received RS232 Messages
But how do I go about detecting 0x0A & 0x0D in flowcode.
Can I do this with the Char$() function in flowcode, I have looked ad the wiki but I could not find any information about that.
Regards Jordy
Can I do this with the Char$() function in flowcode, I have looked ad the wiki but I could not find any information about that.
Regards Jordy
the will to learn, should not be stopped by any price
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
- Contact:
Re: Handling Received RS232 Messages
1) Use ReceiveChar to read the output and compare the value received with 10 (0x0a) or 13 (0x0d).
2) With ReceiveString, get the Length$ of the returned string, then use Loop to check every element of the string (Str[index]) comparing it to the values.
Example for 2: When using method 2, keep in mind a response can split over two read attempts (if larger then result string length or due to timing)
Hope this helps
2) With ReceiveString, get the Length$ of the returned string, then use Loop to check every element of the string (Str[index]) comparing it to the values.
Example for 2: When using method 2, keep in mind a response can split over two read attempts (if larger then result string length or due to timing)
Hope this helps
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
- Jordy101091
- Posts: 519
- Joined: Sat Jan 08, 2011 4:02 pm
- Location: The Netherlands
- Has thanked: 25 times
- Been thanked: 188 times
- Contact:
Re: Handling Received RS232 Messages
thanks for your help so far,
I will have a go with option number 2, I let you know how all works out.
regards Jordy
I will have a go with option number 2, I let you know how all works out.
regards Jordy
the will to learn, should not be stopped by any price