Skip to main content

Timeline for Software Gate on a PWM port

Current License: CC BY-SA 4.0

9 events
when toggle format what by license comment
Aug 5, 2018 at 18:31 vote accept Wildview
Aug 5, 2018 at 17:29 answer added Edgar Bonet timeline score: 1
Aug 5, 2018 at 16:27 comment added Wildview Jot 23, do you know of any good code examples using a timer interrupt on a PWM port to achieve what I'm looking for? Currently, I have 2 PWM ports 1 at running at 111Hz and 1 running at 1110Hz and both need a controllable gate of 5. to 7Hz applied to it. If the timer interrupt would be fast enough to work, that would be neat since I'd like to do this all in software if possible. In theory it should work. The Teensy v3.2 is a fast processor.
Aug 5, 2018 at 16:16 comment added Wildview btw, this is for a brain tuner circuit I'm building. The brain is stimulated at freqs of 111Hz and 1110HZ, but pulsing the freq slightly w/ a controllable gate will alter the shape to create different types of stimulation modes. This is what I'm trying to achieve using the freq gate on the PWM port. The accuracy should be as close as possible. Once the wave form is created, it will be put through another circuit that includes a transformer to create the final output signal. If I can do the gating in software that would be really cool =) Tnx for your help.
Aug 5, 2018 at 16:05 comment added Wildview Yes, I understand fully what the PWM port does and how it works and have been using it for years =) What I’m trying to achieve is how to change the shape of the freq by adding a controllable gate on the PWM port in software. I can do this by outputting the PWM freq into a collector of an 2N3904 transistor and drive the base of the transistor w/ another PWM acting has the gate freq and the emitter will have the newly shaped freq which seems to work, but would like to do it all in software using a timer on the PWM port. Is this possible?
Aug 5, 2018 at 15:55 comment added Jot You could use one timer for the 111Hz and another timer with interrupt. In the interrupt turn the other timer on and off. It is even possible to use the tone() for 111Hz and millis() in the loop() to create that .5 to 7Hz. Can you explain what this is for? Is it a modulated 111Hz? How accurate should it be?
Aug 5, 2018 at 15:50 review First posts
Aug 5, 2018 at 16:15
Aug 5, 2018 at 15:49 comment added chrisl PWM is not for outputting different frequencies, but for outputting a square wave of a fixed frequency with different duty cycles. And it's not clear, what do you mean by "gate that freq at .5-7hz" What exactly you are trying to achieve?
Aug 5, 2018 at 15:46 history asked Wildview CC BY-SA 4.0