From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

State machine doubt

Hi,

            I am using JKI state machine with 4 states(read DAQ USB 6008, write some value to Serial device, display message, display message2) but now, I would like to implement more states on existing code.

             Those are read serial(save some data), read daq, write some value to serial, again do same thing with before two states depend on some condition(may be three times) and then last write the value to serial device and display the message.

 

          Later, I need to copy the same code and put is in event structure with two buttons(possibly both cases code is same but with different working conditions).

 

Can I go ahead in this way or may I need to go for Producer consumer loop. I am afraid to go with Producer consumer loop. I am working on only with few serial commands(3 or 4). Can any one suggest me. 

0 Kudos
Message 1 of 2
(2,491 Views)

If you need to duplicate code a subvi is the way to go.

And never, i really mean never, add code that executes in an event structure.

greetings from the Netherlands
0 Kudos
Message 2 of 2
(2,482 Views)