Click here to Skip to main content
15,890,609 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
I want to send integers from a vb.net program to my microcontroller using COM port1.
I had written the following code in vb but it is not working.Nothing appears on microcontroller ports.Microcontroller accepts 8 bits at a time.
VB
SerialPort1.Open()
SerialPort1.WriteLine(xco)

xco is my integer variable.In properties of serial window i had set the baud rate as 9600 and timeout as 500 and stop bit as one.
Can someone please help me...
Posted
Updated 16-Apr-11 4:16am
v2

1 solution

First thing to do:

Open HyperTerminal (or similar) set up the com port, the baud rate, bpc and stop bits.
Try to talk to your microcontroler using the keyboard. If that works, then move on to step two. If it doesn't work, then find out why first. It may be control lines (RTS/CTS etc.) it may be speed problems, it may be the microcontroller isn't powered on! Get that working first.

Then set up a SerialPort object with exactly the same parameters. Try sending bytes (not an integer, necessarily) and get some sensible response. You can then work on from that.

Don't try to code immediately: make sure you can talk first. Otherwise you are introducing factors you aren't sure about!
 
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