Actually the sockets are mainly so I can recycle the LEDs into the next project.
Oddly enough the only dud Piranah LEDs I've had came from a reputable UK distributor; all the cheap ones I've bought off eBay from HK & China have never let me down.
I was asked to do it with the requirment that it has 9 RGB LEDs and runs on a 16F628.
Initially I thought it was complicated to achieve and pointless and wasn't that keen to take it on but now I've had it running in the workshop it's quite mesmerising - the video clip doesn't do it justice.
No I haven't used vertical counters on this, it doesn't lend itself to them because it needs 27 PWM channels, and even though it's split into 3 groups that's still 9 bits so it's not byte friendly.
I just used this basic method below. Because the PWM is only 6 bits (0-63) pwm.count is initalised to 256-63 at the start of each period, and is incremented. There's a little bit more code that's not shown to pull it altogether but this is the core of the PWM generation.
Code:
movfw pwm.count
addwf pwm.led1,W
rrf portb.copy,F
; ..... repeat for leds 2 thru 7
movfw pwm.count
addwf pwm.led8,W
rrf portb.copy,W
movwf PORTB
; deal with that pesky 9th LED on port A
; porta is also controlling the common anode source transistors
movfw pwm.count
addwf pwm.led9,W
skpnc
bsf porta.copy, led9
movfw porta.copy
movwf PORTA
This method is also a bit more handy for experimenting with different PWM resolutions too, just change the pwm.count intialisation value.
In my previous post I forgot to say that I think your demo' and prototype PCB looks extremely nice.
Thanks for posting the schematic. So, you're using direct drive from I/O for cathodes and source driver transistors on the common anodes as I suspected.
Did you limit software PWM duty cycle to 64 steps (6 bits) because of ISR driver "overhead" and to produce a decent refresh rate?
Pete did an extremely nice job on this project but I would like to update it with a BAM (bit angle modulation) driver of my own design which should allow for 8 or 9 bit resolution (256 or 512 steps, respectively) at extremely high refresh rates on the order of several hundred Hertz.
would be nice if i had some code to examine heh... when ready im sure it will be posted here. This is awesome tho really! Great job to the both of you. Its like thanking the guy who invented the wheel then the guy who smoothed it out heh
The whole thing was done as a bit of an experiment after I was asked if it could be done - they wanted 9 RGB channels and so the challange was there and I just had a play to see what I could do. The PCB had the option for an external crystal but I think I had no crystal to hand so it started with the internal 8Mhz RC.
I can't really remember too much about it, I hacked it together over a couple of evenings and haven't been back to it since. It uses sine wave data in a look up table (calculated in Excel) to generate the duty cycles.
Depending on the 'angle' between the RG & B offsets into the table and the channel index seperation you can tune the spread of colour across all the channels (full colour spectrum or narrow colour 'window' ) and also the rate it changes through the spectrum.
The source code is a bit rough and ready and was never really finished but here it is anyway
Attachement doesn't seem to want to open so here's a link direct to my website. **broken link removed**