Hey there! Sign in to join this conversationNew here? Join for free
    • Thread Starter
    Offline

    3
    ReputationRep:
    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
    https://www.google.co.uk/url?sa=t&rc...OnGD4-8Yo2Cprg

    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
    Offline

    2
    ReputationRep:
    MSDN tends to have pretty good examples and documentation - https://msdn.microsoft.com/en-us/lib...code-snippet-1
 
 
 
Reply
Submit reply
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.

Updated: September 13, 2016
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • Poll
    What's your favourite Christmas sweets?
    Useful resources
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • 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

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