Shop OBEX P1 Docs P2 Docs Learn Events
VB Problem — Parallax Forums

VB Problem

NewzedNewzed Posts: 2,503
edited 2004-12-09 04:14 in General Discussion
I have a small VB-related problem.· I've written a four-bank PS2P24 program for a customer.· The Stamp program is OK.· However, the customer is using a VB program to communicate with the Stamp.· At one point in the Stamp program, the Stamp must receive .......[noparse][[/noparse]22], where 22 is a relay number.· Not [noparse][[/noparse]dec 22] and not [noparse][[/noparse]"22"], just plain [noparse][[/noparse]22].· If I understand the customer correctly, he is telling me that VB an not send
[noparse][[/noparse]22], only [noparse][[/noparse]"22"].· Is this correct?· Is the anyway for VB to send the Stamp equivalent of:

serout 16, baud, [noparse][[/noparse]22]

Thanks

Sid

Comments

  • sryansryan Posts: 6
    edited 2004-12-05 15:41
    It's not clear exactly what needs to be sent to the Stamp- a four-byte string composed of the ASCII code for "[noparse][[/noparse]", "2", "2", "]"? A two-byte 0x02, 0x02? Once you know exactly what data is expected, it's a fairly simple operation to send it out with a PRINT # or PUT # statement. If you use the PRINT # statement, make sure you end the statement with a semicolon to supress a CR-LF after the data.

    For instance:

    Open "COM1:9600,N,8,1" For Output As #1
    Print #1, "[noparse][[/noparse]22]"; 'outputs four-byte string "[noparse][[/noparse]","2","2","]"
    Print #1, Chr$(2); Chr$(2);'outputs two bytes 0x02, 0x02
    Close #1
  • NewzedNewzed Posts: 2,503
    edited 2004-12-05 15:47
    I know nothing about VB, so your example doesn't help me.· As I said, the Stamp needs to receive a plain 22, not dec 22 and not "22".· Can VB send just 22 without the quotes as a byte.· If VB has to enclose everything in quotes I have a work-around for it but it will involve handling the incoming VB data as a serstring\2 and doing a lot of extra programming.



    Sid
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-12-06 00:21
    I've written a couple articles about PC-to-Stamp communication using VB. This one is the latest:

    http://www.parallax.com/dl/docs/cols/nv/vol3/col/nv89.pdf

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • Jared HoylmanJared Hoylman Posts: 2
    edited 2004-12-09 04:14
    In short, yes, VB can do this.

    MSComm1.Output = Chr$(22)

    Hope this helps...

    Jared
Sign In or Register to comment.