PDA

View Full Version : 30 PWM outputs on one chip?



Kamikaze47
- 24th September 2009, 07:17
I've got a 40-pin PIC that I would like to use 30 of the i/o pins as pwm outputs in order to drive 10 RGB LEDs. I would be using a frequency 60Hz for all and an 8-bit resolution on the duty cycle.

My thought is to use a timer interrupt of 60*256=15360Hz and have the interrupt for it set each output according to its individual duty cycle value.

I realise that this will be processor intensive, but I am planning on having 6 of these for a total of 180 PWM outputs all controlled by a main master PIC which will do most of the processing and simply send the duty cycle values to the other PICs.

Can anyone see any problems with this?

One thing I have thought of is the current - unless i have a transistor on each output i will only be able to draw about 6.7mA per output due to the PIC's max current sink/source of 200mA.

Alternately, does anyone have any better ideas on how to drive 60 RGB LEDs?

aratti
- 24th September 2009, 08:04
Alternately, does anyone have any better ideas on how to drive 60 RGB LEDs?

Read the following thread:

http://www.picbasic.co.uk/forum/showthread.php?t=7393&highlight=bambam

Al.

Kamikaze47
- 24th September 2009, 08:33
Very interesting, thanks aratti.

It looks like MIBAM will be the way to go.

Ingvar
- 25th September 2009, 15:44
I would say that 60Hz would be too low when using this type of PWM, i don't know about MIBAM since i've never used it. Using old(normal) style PWM you will see flickering when using low dutycycles, the problem is that the pauses between the pulses of light is long enough for the eye to see(atleast for my eyes, this varies for different people). I've done a pwm controller once and found that i still had visible flicker at 100Hz when using dutycycles below 2-3%. At 200Hz the problem went away. Thinking about it, i would suspect that MIBAM would have the same problem, atleast at 1 LSB dutycycle.

Kamikaze47
- 25th September 2009, 16:32
Thanks Ingvar - You are right, I found that 60Hz was too low.

I tried DT's MIBAM but for some reason it kept crashing the compiler. So I ended up implementing MIBAM myself at 90Hz (including the mirror image, so equivalent to 180Hz standard BAM) and am quite happy with the result. 30 outputs, 8-bit resolution running on an 18F4550 @ 48MHz.