The recipe for fixed frequency PWM on the P1 is pretty easy, but it does require a cog. I've used the attached strategy to drive motors and LEDs and other devices that need fixed-frequency PWM.
Here's the outputs captured on my LA; frequency is set to 24kHz with ch0 set to 20% and ch1 to 95%.
Thanks Jon, I’m sure I may have not been clear. I’m trying to connect something to the propeller that is outputting that signal on the scope so that I can read it into the propeller and convert it into a value inside the propeller.
Sorry, I misunderstood. No problem, there is a counter mode that can be used -- let me look it up.
A few minutes later....
Found it. I created a dual pwm-read object for a TV prop that was controlled via wireless DMX receiver; my object could read the PWM signal from the receiver and convert it to a value between 0..255. For this demo I added a conversion in the main code to get 0..100. The reader object should work -- if not, it will give you direction in how to use the counters to measure pulses.
Comments
Better said, I want to see if I can send this signal direct to the propeller and convert it to a value 0-100. Counter?
The recipe for fixed frequency PWM on the P1 is pretty easy, but it does require a cog. I've used the attached strategy to drive motors and LEDs and other devices that need fixed-frequency PWM.
Here's the outputs captured on my LA; frequency is set to 24kHz with ch0 set to 20% and ch1 to 95%.
Thanks Jon, I’m sure I may have not been clear. I’m trying to connect something to the propeller that is outputting that signal on the scope so that I can read it into the propeller and convert it into a value inside the propeller.
Sorry, I misunderstood. No problem, there is a counter mode that can be used -- let me look it up.
A few minutes later....
Found it. I created a dual pwm-read object for a TV prop that was controlled via wireless DMX receiver; my object could read the PWM signal from the receiver and convert it to a value between 0..255. For this demo I added a conversion in the main code to get 0..100. The reader object should work -- if not, it will give you direction in how to use the counters to measure pulses.
Awesome! I will hook this up tomorrow and test it out thanks a bunch for posting this.
My demo uses the pwm output from the first code I posted -- just disable that and connect your external signal to one of your PWM input pins.
This is an excellent document from Parallax:
https://obex.parallax.com/obex/propeller-p8x32a-counters-an001/