Hey there! Sign in to join this conversationNew here? Join for free

Sending hex over serial in vb2010

Announcements Posted on
Why bother with a post grad course - waste of time? 17-10-2016
    • Thread Starter

    Not sure if this is right forum. Been looking online for a while now on how to do this but each time i try implement a soltion, there is always a problem.

    So i have the optris ct sensor, here is the link to the commands provided by manufacturer

    WHen I plug the sensor in, on device manager, it says COM20.

    So my question is, how do I send 01(check link, examples section) to the sensor and get a corresponding hex string(04 D3 expected ) from sensor?

    Do i need to add a serial port control to form?
    So far

    Imports System.IO.PortsPublic Class Form1
    SerialPort.PortName = "COM20"
    SerialPort.BaudRate = 9600
    SerialPort.StopBits = IO.Ports.StopBits.One
    SerialPort.DataBits = 8
    SerialPort.Parity = IO.Ports.Parity.None

    Dim Buffer() As Byte = {&H01)

    SerialPort.Write(Buffer, 0, 1) 'for example

    Dim receiveBuf(1024) as byte
    SerialPort.Read(receiveBuf,0,rec eiveBuf.Length)

    End Class

    I want the user to type in the hex string (in textbox) and then have a value (displayed in second textbox)

    Any help will be appreciated, thanks

    MSDN tends to have pretty good examples and documentation - https://msdn.microsoft.com/en-us/lib...code-snippet-1
Write a reply…


Submit reply


Thanks for posting! You just need to create an account in order to submit the post
  1. this can't be left blank
    that username has been taken, please choose another Forgotten your password?
  2. this can't be left blank
    this email is already registered. Forgotten your password?
  3. this can't be left blank

    6 characters or longer with both numbers and letters is safer

  4. this can't be left empty
    your full birthday is required
  1. Oops, you need to agree to our Ts&Cs to register
  2. Slide to join now Processing…

Updated: September 13, 2016
TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

Would you want to know what your pet is thinking about you?
Useful resources

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.