SX28 serin question

martinbushnellmartinbushnell Posts: 1
edited 2013-12-23 - 17:09:46 in Microcontrollers
I know that much has been written about SERIN for the SX28 but I'm a bit confused about the subroutine required for receiving strings.
Can anyone suggest how I recreate the following statement from a Stamp BS2 programme for use with the SX28

SERIN rxpin, baud, [WAIT("SENDRX")]

Many thanks

Martin

Comments

  • ZootZoot Posts: 2,226
    edited 2013-12-23 - 17:09:46
    SERIN just gets a byte, so you generally want to wrap it in a subroutine. Presume that each call to my_ser_in gets one byte
    
    Main:
    
    
    Wait_For_Header:
        tmpB1 = my_ser_in
        IF tmpB1 <> "S" THEN Wait_For_Header
        tmpB1 = my_ser_in
        IF tmpB1 <> "E" THEN Wait_For_Header
        tmpB1 = my_ser_in
        IF tmpB1 <> "N" THEN Wait_For_Header
        tmpB1 = my_ser_in
        IF tmpB1 <> "D" THEN Wait_For_Header
        tmpB1 = my_ser_in
        IF tmpB1 <> "R" THEN Wait_For_Header
        tmpB1 = my_ser_in
        IF tmpB1 <> "X" THEN Wait_For_Header
    ' only here if correct header received, so next two bytes (??) are data
    
        tmpB1 = my_ser_in
        tmpB2 = my_ser_in
    
       IF tmpB1= "." THEN Do_Something
       IF tmpB1= "," THEN Do_Something_Else
    
    ' etc
    
      GOTO Main
    
    
    
    FUNCTION my_ser_in
         SERIN ..... your code into one byte, say, "tmpB1"
         RETURN tmpB1
         ENDFUNC
    
    
    When the going gets weird, the weird turn pro. -- HST

    my site: 1uffakind.com
    create bitmap data tool: 1uffakind.com/robots/povBitMapBuilder.php
    resistor ladder tool: 1uffakind.com/robots/resistorLadder.php
    convert images to ascii art: 1uffakind.com/apptoys/convtoascii/
    MC6808/Hero-1 assembler: 1uffakind.com/apptoys/onlinecompilers/MC6800/
Sign In or Register to comment.