Frequency output question- Flip-Flop?

Discuss issues and ideas you have to configuring displays with PowerVision
PeterV
Posts: 3
Joined: Fri Dec 09, 2016 7:00 pm

Frequency output question- Flip-Flop?

Post by PeterV » Sat Mar 11, 2017 11:49 am

I am new to PowerVision and discovering slowly how to program it. I am working with controlling the frequency output between 1Hz and 0 Hz to drive a small buzzer. I set up two calculation events under the IO.Frequency Output variable then created a User Event (FreqFromKeyboard0) which invokes the calculation to set the Frequency output to ) and then do the IO update. Next I mapped this event to a key on the display expecting that pushing the key would set the output frequency to 0. In actuality it is a flip-flop: every push changes the output frequency from 0 and then to 1 and then back to 0 etc. What is going on? Any help would be greatly appreciated. Peter
Flip-Flop.PNG
Flip-Flop.PNG (158.13 KiB) Viewed 68 times
boyce
Enovation Controls Development
Enovation Controls Development
Posts: 322
Joined: Wed Sep 08, 2010 5:09 pm

Re: Frequency output question- Flip-Flop?

Post by boyce » Mon Mar 20, 2017 8:49 am

This is the behavior that you would expect. The calculation is setting the variable to the result of the comparison (it's not an assignment statement that looks like it is always setting to 0). If IO_Frequency_Output is 0 (false) then IO_Frequency_Output will be true or 1. When IO_Frequency_Output is 1 (true) then IO_Frequency_Output will be set to false or 0. It does act like a flip-flop. It is not a simple assignment statement, it is a comparison statement that assigns the value of the result of the comparison. If you want to assign the value to 0 then the expression is just 0.
Boyce Schrack
Enovation Controls