LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

modifying sample RS232

Hello

I am currently working on modifying RS232 serial port communication sample file. My task is to modify the program that is more userfriendly.

First, in the sample program (serial.prj) user must
press "send" button to send the data to thru the port.
I would like to modify this so that by just pressing "enter" key, it will allow the user to send the information

Second, I would like to let the user open the multiple windows so that the user can communicate the multiple port at the same time... (one windows per poprt, so if user open the 8 windows, it should support 8 different/same port communications)

Any help would be appreciated...
0 Kudos
Message 1 of 2
(2,947 Views)
Franjun,

For the first question, a good solution would be to use Enter as a Shortcut Key for the Send button (and you can set this botton to invisible if you do not want to see it on the panel). You can do this by using SetCtrlAttribute. Select, under the Control Attribute field, Shortcut Key and for the Attribute Value VAL_ENTER_VKEY. In this way, every time you press the Enter key, the string will be sent.

Now, for the second question there are different ways in which you can have multiple windows to communicate with different ports. The easiest way to do it would be by running eight executables. Each executable will be in charge of configuring a specific port. A second option would be to have a user interface with eight buttons. If a button is pressed, th
en you can launch an executable with the ANSI_C system() function, which will wait for the program to be executed. For example, if you pressed button 1, and then called system(serial.exe 1), the program would open the serial.exe file and configure port 1. The advantage of using this fuction is that you cannot access other ports while configuring one and at the same time, you would only need to have one executable instead of eight on the target machine. Now, if you want to use multiple ports at the same time, a good idea would be to use LaunchExecutable instead of System. Finally, remember that you will need to perform command-line processing if you use this method. Good luck!
0 Kudos
Message 2 of 2
(2,947 Views)