Tom et al.
I wish to modify my setup so the KFlop is output to the charge pump of the Gecko G540 whilst there is no emergency signal. The Charge pump must be greater than 10KHz.
So I have a whole bunch of questions around using the pins and timers.
For ease of use I'd like to take one of the spare IO pins on JP7. Is it simple enough to create a thread that utilises Delay_sec(0.0002) in an infinite loop. Also does setStateBit do what I think?
while(1) {
Delay_sec(0.0002);
setStateBit(44, ! readBit(44));
}
I also saw the example:
main()
{
SetBitDirection(26,1); // define bit as an output
FPGA(IO_PWMS_PRESCALE) = 65; // divide clock by 65 (1 KHz)
FPGA(IO_PWMS) = 128; // square wave
FPGA(IO_PWMS+1) = 1; // Enable
}
This seems more reliable to offload the PWM. Am I right in assuming dividing the clock by 650 to get 10KHz?
Finally in either case is the the ability to use an NC emergency switch, or should I route this to the Gecko as per normal?
- Paul