SKIP command on BS2
Joms
Posts: 279
I am trying to use the SKIP command in a Serial In application on a BS2.· What I am trying to do is skip like the first 8 hex charators that come in, store the next two, then skip the rest.· I can't seem to make it work right as everytime I add the skip command I start getting garbage for the rest of the string.· Please let me know if you have any idea on where I can look for information about this.· The help file didn't seem too 'helpful'.
And a big thank you to Terry_Bear for all the help on the last question I asked.· I couldn't find that topic back today.· Thanks!
And a big thank you to Terry_Bear for all the help on the last question I asked.· I couldn't find that topic back today.· Thanks!
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye
Jeff T
Unless I miss my guess as to what you have, the sub-parameter SKIP 4 should do what you need, if the rest of the SERIN statement is correct. There are TWO characters in each "HEX" byte. Thus, if you say you want to bypass "first 8 hex charactors that come in" that represents 4 characters of actual BYTE data.
Additional information about the various SERIN formatters can be found in the PBASIC Reference Manual, or the PBASIC Help File near the end of the SERIN section.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Genius is one percent inspiration and ninety-nine percent perspiration."
Thomas Alva Edison
You're welcome; if any one of my thoughts is helpful, great. Otherwise, just ignore it!
Bruce appears to have nailed the problem. That sort of thing ha a lot of people confused, and even the un-confused ones count characters vs. bytes incorrectly...
Terry
You're welcome; if any one of my thoughts is helpful, great. Otherwise, just ignore it!
Bruce appears to have nailed the problem. That sort of thing ha a lot of people confused, and even the un-confused ones count characters vs. bytes incorrectly...
Terry
When I inserted the SKIP 4 command it actually just scrambles the data when it debugs it. Also, In my final product I will not be using the Debug command as I just want it compair the data.
Thanks for all the ideas so far, I need all the help I can get...
'{$STAMP BS2}
'{$PBASIC 2.5}
test VAR Byte(24)
DO
IF IN7=1 THEN
SEROUT 0, 16468, [noparse][[/noparse]06,01,78,48,81,74,09,48,48,48,48,09,49,53,04]
DO
LOOP UNTIL IN7=0
SERIN 1, 16468, [noparse][[/noparse]SKIP 4, STR test\24]
PAUSE 15
DEBUG STR test
ENDIF
IF TEST = (***Dont understand what format goes here***) THEN
LOW 14
ELSE
HIGH 14
ENDIF
LOOP
SEROUT 0, 84, [noparse][[/noparse]06,01,78,48,81,74,09,48,48,48,48,09,49,53,04]
DO
LOOP UNTIL IN7=0
SERIN 1, 84, [noparse]/noparse]STR test\[b]12[/b
Jeff T.
However...
The problem I am still having is that I cant seem to find out what for to put the compair. When I run this script I now get "4C" on the display which is what I am expecting. I just cant find what form it wants that data in. My next test will be to make a second variable and try to compair the two. Hopefully I can find away around this as I plan on using the rest of the variables for something else. Please let me know if you have any ideas.
IF TEST = (tried "4C", tried 5267) THEN
LOW 14
ELSE
HIGH 14
ENDIF
You probably want to use a hexadecimal constant. The way you specify hexadecimal is with the $ character. Here's what it would look like in your program:
IF test = $4C THEN ...
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Genius is one percent inspiration and ninety-nine percent perspiration."
Thomas Alva Edison
IF TEST(0)=$30 AND TEST(1)=$37 THEN
LOW 14
ELSE
HIGH 14
ENDIF