Shop OBEX P1 Docs P2 Docs Learn Events
serout command — Parallax Forums

serout command

Larry~Larry~ Posts: 242
edited 2009-11-01 17:15 in BASIC Stamp
This command does not send the variables out
SEROUT 0,baudrate,[noparse][[/noparse]"at+iheadline=" ,a(0),a(1),a(2),a(3),a(4),a(5),a(6),a(7),a(8),a(9),a(10),a(11),a(12),a(13),a(14),CR,CR]


this command does send the variables out, I can replace ~ with dec and it also sends out, but it places a character in front of the variables
~ =

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-28 22:25
    The first version of SEROUT should work. You could use the "string" form instead:

    SEROUT 0,baudrate,[noparse][[/noparse]"at+iheadline=",str a\15,cr,cr]

    When you say "does not send the variables out" what do you mean? What's the content of "a"? I ask because there's nothing apparently wrong with the first statement, yet you say it doesn't work. The explanation may well be in something else you're not showing.
  • Larry~Larry~ Posts: 242
    edited 2009-10-28 23:57
    This is a serial to lan module Im trying to read the IP address and set it to a web page I can read it now and email it out. but not update the web page unless i use a ~ or dec,hex,bin just before the a(0) but this puts xtra numbers in front of the Ip address When I set my router (dsl) to dmz it gives my unit the providor IP that my modem works off so I can keep trak of where this thing is· on the net (non static IP). the syntax is the same as email but does not work correctly. I never used str I will try it


    ' {$STAMP BS2}
    a VAR Byte(20)
    baudrate VAR Word
    baudrate = 396

    PAUSE 1000
    SEROUT 0,baudrate,[noparse][[/noparse]"at+irp8",CR]
    LOW 2
    SERIN 2,baudrate,[noparse][[/noparse]a(0),a(1),a(2),a(3),a(4),a(5),a(6),a(7),a(8),a(9),a(10),a(11),a(12),a(13),a(14)]',a(15),a(16),a(17),a(18),a(19)]
    DEBUG a(0),a(1),a(2),a(3),a(4),a(5),a(6),a(7),a(8),a(9),a(10),a(11),a(12),a(13),a(14),CR'a(15),a(16),a(17),a(18),a(19),CR
    'SERIN 2,baudrate,[noparse][[/noparse]a(0),a(1),a(2),a(3),a(4),a(5),a(6),a(7),a(8),a(9),a(10),a(11),a(12),a(13),a(14)]',a(15),a(16),a(17),a(18),a(19)]
    'DEBUG a(0),a(1),a(2),a(3),a(4),a(5),a(6),a(7),a(8),a(9),a(10),a(11),a(12),a(13),a(14),CR'a(15),a(16),a(17),a(18),a(19),CR
    PAUSE 100
    SEROUT 0,baudrate,[noparse][[/noparse]"at+iheadline=",~a(0),a(1),a(2),a(3),a(4),a(5),a(6),a(7),a(8),a(9),a(10),a(11),a(12),a(13),a(14),a(15),a(16),a(17),a(18),a(19),CR]
    'PAUSE 1
    'LOW 2
    SERIN 2,baudrate,[noparse][[/noparse]a(0),a(1),a(2),a(3),a(4),a(5)]',a(6),a(7),a(8),a(9),a(10),a(11),a(12),a(13),a(14),a(15),a(16),a(17)]',a(18),a(19)] '
    DEBUG a(0),a(1),a(2),a(3),a(4),a(5),CR',a(6),a(7),a(8),a(9),a(10),a(11),a(12),a(13),a(14),CR'a(15),a(16),a(17),CR'a(18),a(19),CR
  • Larry~Larry~ Posts: 242
    edited 2009-10-29 00:20
    I put "here" on one line now it tells me that there is no CR i need to put two in not one I know I had two before but that was for testing only at that time


    a VAR Byte(20)
    baudrate VAR Word
    baudrate = 396


    PAUSE 1000
    SEROUT 0,baudrate,[noparse][[/noparse]"at+irp8",CR]

    LOW 2
    SERIN 2,baudrate,[noparse][[/noparse]WAIT("T"),STR a\8]
    DEBUG STR a\8,CR

    PAUSE 1000

    SEROUT 0,baudrate,[noparse][[/noparse]"at+iheadline=",STR a\8,CR] 'HERE'
    'LOW 2
    'PAUSE 1
    SERIN 2,baudrate,[noparse][[/noparse]STR a\15]
    DEBUG STR a\15,CR
  • Larry~Larry~ Posts: 242
    edited 2009-10-29 21:29
    Ok I'm now using strings! how do i use dec in front of each byte like dec a(0),dec a(1) to dec a(9) ?

    SEROUT 0,baudrate,[noparse][[/noparse]"at+ivalue=",STR a\7,CR]
  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-29 21:36
    You have to go back to listing each byte separately with a DEC in front like you described.

    I put "here" on one line now it tells me that there is no CR???? What else did you do with that line?
  • Larry~Larry~ Posts: 242
    edited 2009-10-29 22:34
    I did not think I did anything different But this thing is giving me fits
    It just won't take a variable
    SEROUT 0,baudrate,[noparse][[/noparse]"at+iheadline=",STR a\8,CR] This will not work gives one or another error message
    there is something different about sending strings!!

    SEROUT 0,baudrate,[noparse][[/noparse]"at+iheadline=192.168.1.1",CR] This works great

    I have debug screens and the correct values are there but the stamp and the other unit must be married because they just don't get along!
  • Larry~Larry~ Posts: 242
    edited 2009-10-29 22:44
    This line compilies and gives an ok message from the unit but the output is 4953585249585357 and should be 15:42:49 if I don't have hex bin dec then the other unit gives error messages if I do the values are wrong

    SEROUT 0,baudrate,[noparse][[/noparse]"at+ivalue=",DEC a(0),DEC a(1),DEC a(2),DEC a(3),DEC a(4),DEC a(5),DEC a(6),DEC a(7),CR]
  • Larry~Larry~ Posts: 242
    edited 2009-10-29 23:13
    Well what I guess I need it an ASC modifier even though thats what it should be sending
  • Larry~Larry~ Posts: 242
    edited 2009-11-01 17:15
    Ok I have the problem worked out but not sure if it’s a stamp problem or the device I'm sending to!!
    I found that there a five ASCII characters that cannot be sent to this device via variables using the bs2.
    ·
    ASCII code······· ········· character··················· name
    ·
    44··········································· /····················· forward slash
    58··········································· :······················ colon
    61··········································· =····················· equal sign
    63··········································· ?····················· Question mark
    126········································· }······················ bracket right
    Could this have something to do with command characters for the stamp? and being handled differently? These same characters can be sent to this device via straight command not using variables like
    serout 1,396,[noparse][[/noparse]“at+imyvalue=:”···········but cannot be sent out using··········· serout , 396,[noparse][[/noparse]“at+imyvalue=”a(0)··························· where a(0) value is : or any of the above five characters,
    this has been a real battle to figure out, I was trying to send the time and it was not going for it, two too many colons.
Sign In or Register to comment.