09-07-2012 05:04 AM
I have made a program with a state machine, but I have one problem. I don't know how I can count the time that the output is active. I have tried several things, but the timer doesnt do what I want. The one time it counts up, also when the output is not active, or it starts counting again (start at 0) everytime its active.
Furthermore I have made a delay before the output is active and a delay when a other output is active. The first time it runs it works, but the next time it also doenst work. I think the source of this problem is the same as the one from the counter but I dont know for sure.
Can anybody help me with this? See the attachment for my VI. The counter is in case "pump up 10".
09-07-2012 05:32 AM
09-07-2012 06:04 AM
Hi SrikrishnaNF,
Thanks for your reply. The output now is a boolean, but after I finished my program it will be a output from the NI 9481.
09-07-2012 06:13 AM
I just have tried the tick count. Maybe I am doing something wrong, but this also do not work. It is still counting when the output is not active. You cannot see that it is counting when the output is not active, but when it becomes active again, you can see that on the background it have been counting, because the timer jumps from (for example) 7450 to 7480. It also starts with a strange time, it doesnt begin at 0 seconds. Am I doing something wrong?
09-07-2012 06:24 AM
What is the sequence yo are trying to achieve.
1. Start exceution ..
2.check Pressure. If it goes above 5, then turn on the digital line and waits for 'x ' secs
3.After x secs switch off Pump5
4.Check if pressure exceeds 9 and turn on pump 10 for y secs..
5.after y secs turn off pump 10
6. Stop the execution.
Is this what you are trying ?
09-07-2012 06:35 AM
Hi Frabto,
It goes something like that. What I am trying to do is the following:
09-07-2012 07:09 AM - edited 09-07-2012 07:10 AM
You are not reseting the timer . Wire true to auro reset so that it resets after counting the pre-defined time.
With hardware, this digital line( for compresor and ventiel) would be set using a DAQ. You are repeatedly wrting the Digital line in while loop. Its sufficient set the digital line when there is a logic state change.
09-07-2012 07:38 AM
Hi Frabto,
I have put an True before auto reset, but this do not work. The timer still counts on, also when the boolean (compressor) is not active. Try it and you see what I mean. I have put the new VI in the attachment.
The problem is, I only want to count when the boolean (compressor) is high.
Regarding the digital lines in the while loop. Is this a problem and do I need to change this?
09-07-2012 08:09 AM - edited 09-07-2012 08:10 AM
I have made a quick draft copy .You can further implement additional logic.
09-07-2012 08:27 AM
Thanks Frabto,
I don't understand completely what this does, but I am now going to look at this and see if I can understand it.