Wanting 3 Synchronous PWM From 08M

rWAVE

Member
A previous, forgotten and unfinished project surfaced recently which I plan to finally complete: <A href='http://www.rev-ed.co.uk/picaxe/forum/Topic.asp?topic_id=6245&amp;forum_id=30&amp;Topic_Title=IF%2BPICAXE%2B%2526gt%253B%253D%2BSimple%2BTHEN%2BControl%255FRGB%255F&amp;forum_title=No+new+posts+please%21+22' Target=_Blank>External Web Link</a>

The above discussion ended with me intending to use 3-MAX7219 to drive my 8x8 RGB CC LED Matrix. After breadboarding, it became clear this would not work as the PWM generator on each of the 3-7219s were not sync'd and a call to technical support confirmed I would not be able to use these devices as intended (they would work if I used discrete LEDs, but this is not an option).

After a brief think, I realized this project could be done with just 1-7219 and 3 synchronized PWM generators!

I planned on using an 08M running a software loop to generate the required signals, but a recent posting about glitches has me concerned:
<A href='http://www.rev-ed.co.uk/picaxe/forum/Topic.asp?topic_id=7469&amp;forum_id=31&amp;Topic_Title=Pwmout%253A%2BGlitches%2Bwhen%2Bused%2Bin%2Ba%2Bloop&amp;forum_title=PICAXE+Forum' Target=_Blank>External Web Link</a>

Although I am not driving a motor and the glitches may not be seen on my LED matrix, I was curious of how you guys would approach generating 3 glitch-free signals from a single 08M. The only other function of this 08M is to respond to an external interrupt, which is used to re-program the duty cycles of the 3 signals. For this test, updates will only occur every 5 seconds or so.

Richard
 

premelec

Senior Member
take a look at the 14M possibly that will do it as it has motor bridge driver outputs... or probably simpler just use one PWM output to drive some drivers - unless they all have to be different... you're not giving so much info on that in your post.
 

rWAVE

Member
Sorry, I guess I was somewhat vague. Yes, I need 3 independent, fixed-frequency synchronous PWM generators. The idea is I will drive all 3 colors (RGB) from the same 7219 (with appropriate external hardware for sink current per color) and use each PWM signal to gate (on and off) the sink circuitry. With 4 discrete duty cycles (0, 30%, 60%, 90%) for each generator, I can create 4x4x4=64 different colors, more than enough for my application.

I planned on using a dedicated 08M software loop using the &quot;pins&quot; command to simultaneously set 3 outputs, each to their own pulse width . . . seems simple enough. Then the &quot;glitch&quot; post and I'm wondering what to expect. I plan to breadboard and code it up this weekend, but was hoping for some insight from others if there is a better way.

Richard
 

inglewoodpete

Senior Member
Richard, Power supply 'gliches' are eliminated with proper design of power supplies. The PICAXE chip needs a low power, stable supply. Other, higher current and/or reactive loads must have an appropriately sized and smoothed supply that does not inject 'noise' into the PICAXE circuit.

By good luck or good design, I have never had an unstable PICAXE project.

Have a look at the PC's motherboard. There are lots of capacitors (and sometines a few inductors) around the chips, particularly the CPU, to keep the power busses stable.

On the other topic (PWM), it may be possible to create an acceptable 3 channel PWM but you will have to either do it in software or additional, dedicated hardware. The software solution will depend on how much else the PICAXE has to do.
 

BeanieBots

Moderator
If you are going to use &quot;pins&quot; to set the outputs rather than pwm(out), then the 'glitch' caused by pwm updates is not in the equation.

Here's a rather hardware intensive way of producing 3 synchronous PWM signals controlled by one 08(M).

Create a sawtooth wave. (binary counter into D2A or op-amp generator, your choice).
Feed the sawtooth into three comparitors.
Feed each of the other inputs to the comparator from an RC which in turn has its voltage controlled by a PICAXE pwm output.
The PWM frequency will be determined by the sawtooth frequency. The duty will be determined by the voltage on the comparitor pin. (it's how pwm was done before micros were common).
 

premelec

Senior Member
BB... yep it still works - I made an 8 channel phase dimmer with an 8 Ch DAC controlled by the PICAXE 08M and triangle wave sync'd to 60Hz [USA] into 2 LM324 'comparators' to opto isolated triacs... I'm not quite following just what is wanted by this particular query however...
 
Top