Shop OBEX P1 Docs P2 Docs Learn Events
Data sending to BS2 from VB Express — Parallax Forums

Data sending to BS2 from VB Express

ctrlBuffctrlBuff Posts: 3
edited 2010-02-20 07:03 in BASIC Stamp
·I am trying to send data to the BS2 with VB Express. I am using the visual basic statement:

SerialPort.Write(Chr(128))

The code works great for any number 0 - 127. Any number from 128 to 255 is received by the BS2 as 63.

The attached screen shot shows the stamp terminal program running with the VB program on top. The screen shot shows the numbers·0 - 127 and 63 for numbers 128 - 255.

Is there a· way to show the correct numbers 128 - 255?

Comments

  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2010-02-19 13:20
    Hi , there is another way to use the Write instruction and that is to write a buffer array of bytes , or one byte if you wish.

    Dim my_array(1) As Byte

    my_array(0)=223

    SerialPort1.Write(my_array,0,1)

    the above creates an array of the type byte with one element and assigns a value to that element.

    The write instruction requires the array name , the index value to start writing from and the number of bytes to write.

    Jeff T.
  • ctrlBuffctrlBuff Posts: 3
    edited 2010-02-20 07:03
    Thanks, Jeff, for the array setup. It worked great. I even expanded it so I can send word data up to 65535.

    Rich V W
Sign In or Register to comment.