06-22-2017 02:59 PM
I'm writing a vi for communicating to a device that occasionally sends an update command to the computer. I've created a similar vi for debugging purposes to share (for advice/input below).
The requirements are as such:
1) After being initialized, the computer must listen to the device unless it is writing. (So that it can hear "!UPDATE!\n" [part 3])
2) The user interface will send commands to the device and wait for the device to send back a set of data with "!PRINT!\n" at the end. After "!PRINT!\n" is received, the center loop processes the data, and either writes a new request to the device or sends the data to the front panel.
3) Occasionally, the device will print "!UPDATE!\n" to verify that there is still a connection. If the computer receives "!UPDATE!\n," it needs to print back "!UPDATE!\n."
06-22-2017 03:16 PM
WOW you sure over complicated that. What are all the Semaphores doing? None of this makes sense.
Unless I am misunderstanding something I would:
This sounds like a State Machine to me not a Producer Consumer architecture.
06-23-2017 07:42 AM
@RTSLVU wrote:
WOW you sure over complicated that. What are all the Semaphores doing? None of this makes sense.
Unless I am misunderstanding something I would:
- Initialize the serial port
- VISA Read in a loop until timeout or data received
- Process the data received and Write a response back to the instrument if needed
- Also break out of the Read loop to send a command.
This sounds like a State Machine to me not a Producer Consumer architecture.
Duah! Thank you, I am dumb