Showing results for 
Search instead for 
Did you mean: 


hey everybody.


can anybody help me creating a vi with the following requirements:


Our hardware works like this:




·         We have a relay that turns on a digital input in labview when the viridian controller wants to turn the pump on . Lets call that INPUT_1 (module 9421 i.e. channel 1)

·         We have a second relay that sends power to the solar pump when a digital output in labview is turned on. Lets call that OUTPUT_1 (module 9472 i.e. channel 1)

·         We have an impulse flowmeter (1 pulse per litre of flow) in the solar circulation. Lets call that INPUT_2  cDAQ module (module 9421 i.e. channel 2)

What we need from Labview code is:


1.       1. Set-up a variable (integer) to count solar pump start attempts. Lets call it  COUNT. Set COUNT=0

2.       2. When INPUT_1 goes from LOW to HIGH labview turn on OUTPUT _1

3.       3. Count the pulses from INPUT_2

4.       4. If no pulses after 10 seconds, turn off OUTPUT_1 and increment COUNT. If some pulses from INPUT_2, keep OUTPUT_1 on until INPUT_1 goes low then go back to step 1.

5.       5. If count =3, raise an error message and hold OUTPUT_1 off.

6.       6. If count <3, wait 10 seconds and switch on OUTPUT_1

7.       7. If INPUT_1 goes low, go to step 1

8.       8. Go to step 4

I would appreciate any help.


Thank you



0 Kudos
Message 1 of 6
Have you looked in the examples for DIO operation? We do not write code on this forum we help you when you get stuck. Look at the examples that are provided with LabVIEW then come back when you have code and you need help.
0 Kudos
Message 2 of 6
In addition to the above suggestion, which will help with the hardware-side of the code, I would recommend perusing some of the articles in the NI KnowledgeBase on general architectures. I believe the state machine is your best bet.
0 Kudos
Message 3 of 6


In addition to the examples included in LabVIEW found in Help > Find Examples..., there are also many community examples available in the NI Developer zone here:


Alternatively, you can contact an Alliance Member who can write your program for you, to find an Alliance Members please visit


Kind regards,

Dominic Walker
Cardiff University
Electrical and Electronic Engineering Student
0 Kudos
Message 4 of 6

Thanks for all answers.


I have created a vi. It does work  for one attempt only. I wanted it in case there is pulse on 9421 channel 0 then turn on output 9472 channel 0, if no there is no pulse then wait 10 secs and then try again until 3 attempts. i f after 3 attemps still no pulse turn off Output 9472....


I got stuck as my vi works when there is a pulse but when there is no pulse it just turns off output 9472 channel 0 without waiting and attempting again for 3 times.


If you can help please do. I'd appreciate



0 Kudos
Message 5 of 6

The fundamental problem you have is that your process definition is not complete. For instance, you say in step 2 "When INPUT_1 goes from LOW to HIGH labview turn on OUTPUT _1" OK ... Does this mean you're supposed to sit there and wait for this event to happen? If you are supposed to sit there and wait, how long do you wait? Indefinitely? If it's LOW, do you then go to step 3, or do you go to step 3 regardless? It seems based on step 4, that the assumption is that OUTPUT_1 was turned on previously.


The other fundamental problem you have is that you are trying to turn a pretzel into a pancake. The process you have is a perfect example of a state machine, but you are trying to implement it using a flat architecture. This just becomes cumbersome.


You also have a couple of needless operations in your code. See attached figures.

Download All
0 Kudos
Message 6 of 6