help with SERIN
mais
Posts: 5
I have a module (3axis electronic compass) which gives me data using UART interface in ASCII format.
The data coming out from the module are like:
174.9,0.1,18.6
174.8,-0.0,18.4
174.9,0.1,18.6
170,2,-0.0,8.4
...
I want to handle this data with a basic stamp module.
If i run the following code the debug window is like the attached file.
ser VAR Word
' {$PBASIC 2.5}
' {$STAMP BS2}
Main:
SERIN 8, 19200, [noparse][[/noparse]ser]
DEBUG ? ser
GOTO Main
Could you please help me? I want the data in the debug window to be like 174.9,0.2,19.6 and not like the screenshot
The data coming out from the module are like:
174.9,0.1,18.6
174.8,-0.0,18.4
174.9,0.1,18.6
170,2,-0.0,8.4
...
I want to handle this data with a basic stamp module.
If i run the following code the debug window is like the attached file.
ser VAR Word
' {$PBASIC 2.5}
' {$STAMP BS2}
Main:
SERIN 8, 19200, [noparse][[/noparse]ser]
DEBUG ? ser
GOTO Main
Could you please help me? I want the data in the debug window to be like 174.9,0.2,19.6 and not like the screenshot
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
The longest variable that i can use due to stamp editor help guide is WORD which means 2 Bytes, how can I handle 15 bytes data?
Could you please send me an example? because the examples in help index of stamp editor didn't help me
There are sample programs which can be downloaded from the link below, as well as all of the other HM-55B documentation that's available. Download the link which indicates "source code" for the programming examples.
http://www.parallax.com/detail.asp?product_id=29123
To answer your question more directly, you make multiple accesses of the compass module before a full set of data is obtained. The compass module documentation explains that aspect, and the source code shows how it is actually done.
By the way, as I remember, you don't use SERIN to access the compass module data, SHIFTIN must be used since it is a synchronous serial device (it has it's own clock).
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
First of all I want to thank you for your reply.
I 'm not using the HM55B compass·but the honeywell HMR3300(it's a 3axis compass module)
pg. 405 in the Syntax and Ref Manual (rev2.2) has a quick and straight forward example
that might work for your cause.
regards,
kristian