STR serin data
Archiver
Posts: 46,084
Hey guys....I've succeded in at least retrieving a HEX data stream
from some equipment.
serin 0, 11505, [noparse][[/noparse]WAIT (2), STR serRAW\12]
this is the instruction I used.
the actually string is XXXX/YYYY/ZZ
/'s are transmitted.
Now, when I type a 'debug STR serRAW' I get the entire string. Fine.
But the 4 X's are each a HEX byte as are the Y's and Z's.
How do I go about stripping this data from this....or was there a way
to do this during the serin command?
I have to do some math do these numbers....sin/cos's; would it be
easier to do this in decimal?
Thanks
from some equipment.
serin 0, 11505, [noparse][[/noparse]WAIT (2), STR serRAW\12]
this is the instruction I used.
the actually string is XXXX/YYYY/ZZ
/'s are transmitted.
Now, when I type a 'debug STR serRAW' I get the entire string. Fine.
But the 4 X's are each a HEX byte as are the Y's and Z's.
How do I go about stripping this data from this....or was there a way
to do this during the serin command?
I have to do some math do these numbers....sin/cos's; would it be
easier to do this in decimal?
Thanks
Comments
This is still that wind instrument? It is hard to say how to convert
it without knowing more about what the data represents, or with some
examples of what comes out. Is it really HEX (with A-F mixed in as
digits), or is it BCD (only 0-9 as digits). In your first email you
mentioned "2's complement HEX"?
The TT or ZZ value is probably the number of times the cups have
turned in 5 seconds.
Yes, there are ways to get this kind of data converted directly as
part of the SERIN command. For example:
xxxx var word
yyyy var word
zz var byte
serin 0,11505, [noparse][[/noparse]wait(2),hex4 xxxx, skip 1, hex4 yyyy, skip 1, hex2 zz]
(Caveat--at 300 baud it might work okay, but not at higher baud
rates, depending on which Stamp chip you have.) That conversion
works for HEX, but not necessarily the way you might expect if it is
really BCD or some other format, (signed HEX?).
If you don't have the instruction manual for this thing, you are
going to have to experiment by recording the strings you get from the
debug command. Please ask the question again then.
-- best regards
Tracy Allen
electronically monitored ecosystems
http://www.emesystems.com
mailto:tracy@e...
>Hey guys....I've succeded in at least retrieving a HEX data stream
>from some equipment.
>
>serin 0, 11505, [noparse][[/noparse]WAIT (2), STR serRAW\12]
>
>this is the instruction I used.
>the actually string is XXXX/YYYY/ZZ
>/'s are transmitted.
>
>Now, when I type a 'debug STR serRAW' I get the entire string. Fine.
>
>But the 4 X's are each a HEX byte as are the Y's and Z's.
>How do I go about stripping this data from this....or was there a way
>to do this during the serin command?
>
>I have to do some math do these numbers....sin/cos's; would it be
>easier to do this in decimal?
>
>Thanks
>
>>
>>Hey guys, just trying to interface a stamp to a piece of wind
>>equipment that we use at work.
>>
>>This is my first time using a stamp/pic although I am electronics
>>trained.
>>
>>The equipment is on current loop. I convert it with a telebyte65A to
>>RS232 so no sweat here!
>>Looking at the docs for the equipment....the data is in 2's
>>compliment HEX. It has it's 'Start of Heading', 'Start of Text',
>>and 'End of Text' bytes....but as I use procomm plus to view this
>>rs232 raw data, I can't make heads or tails of what I'm seeing.
>>
>>This is the basic outlay of the raw message...
>>(STX)(NNNN)/(EEEE)/(TT)/(ETX)(C)(Z)(R)(N)
>>
>>STX-Start of Text (02hex)
>>NNNN - group of data representing North Component in 2's compliment
>>HEX.
>>EEEE - group of data representing East Component in 2's Compliment
>>HEX.
>>TT - # of cupwheel turns
>>ETX - End of text (03hex)
>>C - Check byte (XOR of all characters in message after STX and before
>>ETX.
>>Z - End of Transmission (04hex)
>>R - Carriage Return (0Ahex)
>>N - Line Feed (0Dhex)
>>*all data is averaged to past 5seconds.
>>
>>Now, I mucked around with trying to view this in a terminal program
>>which didn't make sense. Is there another program that WILL show me
>>raw data? OR is it that the 2's compliment (inverting of binary??)
>>is messing things up?
>>Could I just plug this in to a BS2 and be done with it...then debug
>>the array and have good data pop up??
>>
>>Thanks
>>Steve