Introduction:
In this example, it demonstrates how to use a produce consumer architecture to be able to send and receive commands from a COM Port. The producer loop handles all the user generated events while the consumer loop manages the communication to the COM Port.
Components to the Example:
1.) Initializes the Queue that passes the states.
2.) Produce Loop Cases of the Event Structure:
Timeout: Check to see if the is any errors.
Initialize: Sends the Initialize command
Write: Sends the write command
Close: Sends the Close Command
3.) Consumer Loop Cases of the Case Structure
Wait: Waits for a command from the Consumer loop
Initialize: Initialize the COM Port and send it to the Read Port State
Read Port: Checks the bytes at port and reads the data back from port
Write Port: Writes a command to the port and send it to the Read Port State
Close: Closes the Session and stops the while loop.
4.) Closes the Queue and displays errors.
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
Would you be willing to compile this app using LabVIEW 8.6?
What about add save to file functionality? Is it easy to implement it?
How do you use the write capability in the code? When I type in code, and press enter (or the write command button) nothing happens on my external unit. However, when I use the same settings and same code in Termite (a serial port terminal) I get the desired outcome.
Any ideas on why this is the case? Am I doing something incorrectly?
Thanks