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: 

labVIEW code running control using Timer

I have a LabVIEW code which needs to be timer control in terms of code running. The code should work as follows?

1. Need a timer that resets every 60 seconds.

2. From 0-30 seconds, the code should write the value 0(zero) to Modbus register 9 of slave device address 5

3. from 31 - 60 seconds, the code will write the value 256 to same Modbus register 9 of slave device address 5.

4. The timer will reset to zero  and this loop continues for every 60 seconds.

Does anyone in the forum got an idea or a typical LabVIEW code that can perform the above function?

0 Kudos
Message 1 of 9
(3,545 Views)

Put what you want in the case structure.

 

snip.png

 

mcduff

0 Kudos
Message 2 of 9
(3,538 Views)

Can you please send me the VI?

0 Kudos
Message 3 of 9
(3,533 Views)

It is a snippet, if your have LabVIEW 2018 you should be able to download it and drag it to the block diagram and it will run. Note the code it meant to be in a loop.

 

What version do you have?

 

mcduff

0 Kudos
Message 4 of 9
(3,528 Views)

I have 2017 version

0 Kudos
Message 5 of 9
(3,524 Views)

Loop Example in LabVIEW 2017 attached. You may have to play with the rounding to get it just the way you want it.

 

mcduff

0 Kudos
Message 6 of 9
(3,517 Views)

Thanks. will try it out.

0 Kudos
Message 7 of 9
(3,512 Views)

I would just use the Elapsed Time VI in the Timing palette.  It can everything but the case structure for you.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 8 of 9
(3,495 Views)

@crossrulz wrote:

I would just use the Elapsed Time VI in the Timing palette.  It can everything but the case structure for you.


Never used it before, good catch.

 

mcduff

0 Kudos
Message 9 of 9
(3,491 Views)