Change one variable value based on a range of measurements
Posted: Fri Aug 17, 2012 5:41 pm
Hi,
I'm not at all sure if the subject line describes what I'm trying to do but here goes.
I'm using a 12F617 under FCv4.
I have an A/D Channel watching a voltage rail. The program must set one variable called ACTIVE to '1' based on acceptance that the value read on the A/D input, falls between 2 windows of acceptable values.
I have set up in an opening statement,
A....VHiWindowU = 877 (meaning Voltage in the Hi Window...Highest acceptable value)
B....VHiWindowL = 809 (meaning Voltage in the Hi Window...Lowest acceptable value)
C....VLoWindowU = 479 meaning Voltage in the Lo Window...Highest acceptable value)
D....VLoWindowL = 418 (meaning Voltage in the Lo Window...Lowest acceptable value)
So, the circuit reads int value of the voltage (Variable called 'SUPPLY') and must set Variable 'ACTIVE' to '1' if the measured values falls between either A-B or C-D acceptable values and to '0' if outside the windows.........in other words if SUPPLY (int) is <D, >A or in between B & C then ACTIVE is '0'.
Hope this is clearly explained.
What I was trying to do was get the decision calculated within a single calculation icon rather than use multiple decision icons nested.
Is this possible, every form of calculation I try returns syntax error from FC so I've had to cry for help again...
Of course, this functionality must be performed continuously in a loop whilst other functions are called or called up as a macro at regular intervals perhaps once per second or two.
Dave
I'm not at all sure if the subject line describes what I'm trying to do but here goes.
I'm using a 12F617 under FCv4.
I have an A/D Channel watching a voltage rail. The program must set one variable called ACTIVE to '1' based on acceptance that the value read on the A/D input, falls between 2 windows of acceptable values.
I have set up in an opening statement,
A....VHiWindowU = 877 (meaning Voltage in the Hi Window...Highest acceptable value)
B....VHiWindowL = 809 (meaning Voltage in the Hi Window...Lowest acceptable value)
C....VLoWindowU = 479 meaning Voltage in the Lo Window...Highest acceptable value)
D....VLoWindowL = 418 (meaning Voltage in the Lo Window...Lowest acceptable value)
So, the circuit reads int value of the voltage (Variable called 'SUPPLY') and must set Variable 'ACTIVE' to '1' if the measured values falls between either A-B or C-D acceptable values and to '0' if outside the windows.........in other words if SUPPLY (int) is <D, >A or in between B & C then ACTIVE is '0'.
Hope this is clearly explained.
What I was trying to do was get the decision calculated within a single calculation icon rather than use multiple decision icons nested.
Is this possible, every form of calculation I try returns syntax error from FC so I've had to cry for help again...
Of course, this functionality must be performed continuously in a loop whilst other functions are called or called up as a macro at regular intervals perhaps once per second or two.
Dave