Visual basic 6.0 serial port programming
Privacy policy. This topic describes how to use My. Ports to receive strings from the computer's serial ports in Visual Basic. Determine which serial port should provide the strings. This example assumes it is COM1. Use the My. OpenSerialPort method to obtain a reference to the port.
For more information, see OpenSerialPort. The Try Finally block allows the application to close the serial port even if it generates an exception.
All code that manipulates the serial port should appear within this block. Use the ReadLine method to read the next available line of text from the serial port. Text End If TextShow. Text End Sub. Copy code in ListBox below. Using Even in OnComm procedure. Final Notes 1. Check your serial port programming manual for the correct number of characters to be recieved and add one for the carriage return. The command sends both a carriage return and line feed thus two must be added to the number of characters expected.
For example, the "GO" command outputs to port A, the integer value position. If the position is a variable , a string to set the port to the value of this variable would look like; MSComm1. You may be many question how to communicate with microcontroller ,So, we can use concept on above to apply in your project ,process for communicate is like my exemple programming but you will be know protocol of those device.
Serail Port Project Page. As for your question, it is time to use your friends yahoo, google, ask, answers, bing and search for vb6 … Jump to Post. Input End If End Sub If you want to monitor the port download the following or a one similar to that so that you can see what hex data is sent back from the device. Marikanna, I have to say that you help me a lot starting this kind of communication but you are not completely right.
Sugarboy rider. Shefali, Here is some code live copy from a small RS tester I use. Edited 8 Years Ago by Dani because: Formatting fixed. Or else, just wait till you get data on next timer interrupt If you have not used timer before, try this- create a new project.
Get back if you need help. Shefali, Create a picture box on the form you are using. Also, place a command button named cmdRefresh.
We will call the com control as comm1. As you get more readings, you may simply change the x-axis scale. I am sure you will get it. By the way, what is the end use of the program? Regards Uday. Am I clear? Uday Wali. Shefali, Writing text on X axis is very simple.
If it is not clear, let me know again. Good Luck. Facebook Like. Twitter Tweet. Be a part of the DaniWeb community. Sign Up — It's Free! Reply to this Topic. This topic is old! No one has contributed to this discussion in over 9 years.
Are you sure you have something valuable to add to revive the existing conversation? Consider starting a new topic instead. Otherwise, please be thoughtful, detailed and courteous, and adhere to our posting rules.
0コメント