Hello everyone, I’m new to programming in Labview, having started 2 months ago. Recently I’m doing a project which involves counters, switch cases and logic gates – which I’m still trying hard to understand. I apologise if I’m not being specific on the details.
I’m trying to build a program to count the number of people entering and exiting the room by using 2 proximity sensors (S1 and S2). My program will have 3 counters to track the number of INs and OUTs to derive the number of people in the room. Hence the number of people in the room will be INs – OUTs. For this purpose, I am using 2 toggle switches to simulate the sensors.
The logic of the counters are as follows:
IN counter: When someone enters the room, S1 is activated first before S2 is activated. When this happens, IN counter will increase by ‘1’.
OUT counter: When someone exits the room, S2 is activated first before S1 is activated. When this happens, OUT counter will increase by ‘1’.
Whenever a cycle is complete; ie both S1 and S2 equals to ‘1’, the sensors will revert back to ‘OFF’ state in accordance to whether they are being triggered as IN or OUT.
The resets are as follow:
IN scenario: S1 is reset to ‘0’ first before S2 is reset to ‘0’.
OUT scenario: S2 is reset to ‘0’ first before S1 is reset to ‘0’.
The reset part is where I encounter problem. For example, when I simulate the ‘IN’ scenario, the IN Counter = 1, while the OUT Counter = 0, which is as intended. However, when I perform the reset – S1 = 0, then S2 = 0, the OUT Counter increases by ‘1’. The opposite happens when performing the reset for the ‘OUT’ scenario. Is there a way to rectify this?
Thanks in advanced for the help, I hope that I can learn something from this.
P.S. Screenshots are attached.
Cheers!
ET