One of the difficult problems when creating programs for working with peripheral devices is organizing program access to computer ports. If you write in the Basic programming language, Microsoft Visual Studio 2005 will help you with this problem. If you have previously programmed in a different environment, download and install the program.
Necessary
the Internet
Instructions
Step 1
Start Microsoft Visual Studio 2005. This software is installed by default on a personal computer along with the operating system. You can find it through the "Start" menu. Create a new project using the menu "File" - "New" - "Project". Specify Windows as the object type, and in the Templates group select Console Application.
Step 2
Create the SendSerialData and ReceiveSerialData methods using the following command (you must specify it inside the method): Using com1 As IO. Ports. SerialPort = _ My. Computer. Ports. OpenSerialPort ("COM1") Reading can be done with the com1. ReadLine () method. - com1. WriteLine (data). Do not forget to close the port at the end of the method with the com1. Close () procedure.
Step 3
Provide a procedure to start reading or writing at user request or otherwise. The launch implementation can be extended later, after testing the program with serial ports. For now, starting from the console will suffice. Run the program using the menu buttons or by pressing CTRL + F5 on your keyboard. Correct any errors if they appeared during testing.
Step 4
For more information, refer to the Basic language manuals. You can find similar solutions to this problem on the thematic sites on Basic programming. You can also find help information on the Microsoft website. In general, we can say that it is not so easy to gain access to the ports of a computer, since such operations require a certain skill of working on a personal computer, as well as working with Internet systems. Try not to open all ports, as your computer will be completely vulnerable on the network, which can lead to serious consequences.