Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've connected a device into my computer and opened device manager. THe com port is is COM20.

I'm am trying to communicate with the device over serial by sending hex commands and will hopefully receive some hex.

How does VB know that I want to talk to that port? Do I have to add a serial port (from toolbox) to my form design?

What I have tried:

Well I ahvent tried anything just yet, thats' why I came here. I want to understand it too.
Posted
Updated 1-Sep-16 23:37pm

1 solution

Yes, you do add a SerialPort control, either from the designer, or in your code directly by creating an instance of the class yourself.
The SerialPort class has properties which allow you to set the port, as well as the communications parameters such as Baud rate, BPC, Parity and suchlike which must be correct in order to talk successfully to your specific device: SerialPort Class (System.IO.Ports)[^] - the link incliudes a basic example, but I'd strongly suggest that you "prove" teh communicatiosn via Hyperterminal or similar before you start coding. That way you at least know that the communications parameters that you think should work do, and that you can talk bidirectionally to the device before you start adding teh comlication of code that you don't know works either!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900