For a project I’m working on, I would like to use the Atom-28 PRO’s hardware PWM generation to produce a continuous 38 KHz signal to drive an LED on one of the pins in the background, while the rest of the program runs. Then, after I’m done with it, I’d like to return the pin to a low state, to turn the LED off again.
I sat down with the manual, and have succeeded in creating a very pretty 38 KHz square wave on pin #10, using HPWM. When it comes to turning it off and returning pin #10 to a normally addressable state again, I have problems. I can turn off the pulses and return the pin to a low state (or very nearly so) by using the command:
hpwm OutPin, 32767, 0
…but the pin remains under the control of the hardware PWM engine. After I am done generating pulses, I would like to disable the hardware PWM engine, and return the pin to “normal” control, where I can change its state with the usual HIGH and LOW commands. I suspect that the line:
ccp2con = 0
…in the demo program on page 141-142 of the manual (version 8.0.0.0) achieves this, but when I attempt to use this line, the IDE spits it out as an unrecognized command.
I’m sure that I’m probably just overlooking something obvious, but so far I haven’t been able to wrest command of pin 10 back from the HPWM module after using it once in the program. What am I missing?