Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Triggering write commands

Hi,

I currently have a load cell that I have interfaced with a RS232 port. The load cell is sending string data which I am collecting using the I/O Instrument Assist manager in LabView. I am collecting that data, converting to dynamic type and writing to a LabView meaurement file. I have this setup in a while loop to keep collecting data. I am also writing string data via another RS232 port to a stepper motor driver. I am currently just doing testing of the driver/motor using the LabView example code Basic_read_and_write.vi. What I basically wish to do is that when the load cell reading reaches a target value, I send a diferrent string to the stepper motor driver. The initial write string to the drive cell is "M+", which makes the motor move forward at constant velocity. The motor will apply a force on the load cell. When this force reaches a target value, I want the write string to the driver to change to "M-", which moves the stepper motor backwards at constant velocity.

I was thinking of using the case structure function and having the "true" case as the move forwatd string and the "false" case as the move backward string. I was then going to use the function in the string palette that outputs a boolean "true" or "false" depending on the value of the input string, where the "true" or "false" output is wired to the case structure.

Does anyone have some better suggestions than what I have thought of? This seams a bit convuluted. Can someone see a modification of the 2 port read/write example. Any help would be really appreciated.

Cheers,
Dave
0 Kudos
Message 1 of 2
(3,225 Views)
Hello Dave,

This sounds like the exact programming logic you should be using. Case structures are the perfect tool for decision making for a continuous process. You basically want to execute different code (write commands) based upon input values from earlier code (read commands). This is exactly what case structures are used for.

Thank you and good luck,
0 Kudos
Message 2 of 2
(3,205 Views)