ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Independent Read write

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."

0 Kudos
Message 1 of 3
(3,059 Views)

WOW you sure over complicated that. What are all the Semaphores doing? None of this makes sense.

 

Unless I am misunderstanding something I would:

  1. Initialize the serial port
  2. VISA Read in a loop until timeout or data received
  3. Process the data received and Write a response back to the instrument if needed
  4. Also break out of the Read loop to send a command.

This sounds like a State Machine to me not a Producer Consumer architecture.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 3
(3,049 Views)

@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:

  1. Initialize the serial port
  2. VISA Read in a loop until timeout or data received
  3. Process the data received and Write a response back to the instrument if needed
  4. 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

0 Kudos
Message 3 of 3
(2,993 Views)