RGB PWM control
I broke some printers to get the stepper motors for my DIY CNC, some of the parts what I kept was the scanner lamps, but not all of them are lamps. In this program I tested the RGB led from Canon, it's a small bright led with a common anode in the corner of a long clear light conductor. The led is operating directly under 5V, I used a NPN 574 transistor as a current amplifier for the PIC16F84 outputs.
The schematic is simple, but the result is interesting. If you are used to see a color picker only in computer, this the project to see it live.
The colors obtained by a color picker are not the same as in real LED, even the hexadecimal values are the same, a current adjustement are needed to make it near.
The current in this program is controlled by PWM, and the hexadecimal values are displayed in the LCD to make it easy for the user to adjust colors as in a color picker.
This material can be used for free, but for your own risk!
RGB schematic
The LCD HD44780 displays in the first line1 Labels R G B and a variable hexadecimal values in line2 from 00 to FF under each label.
RB0-RB3 connected to LCD D4-D7, RB4->E, RB5->RS, R/W->GND
RA0 to a 10K resistor driving a transistor BC547 for Red, a 47R or 330R resistor in serie with every LED to limit the current(I add it to limit the current to protect the LED, but it can be replaced by other value if a bright light is needed), RA1-> Green, RB6-> Blue
RA2 increment selected hexadecimal bit code, RA3 decrement selected bit.
RA4 to choose the bit HI or LOW for each color, starting from RED and loop after Blue LOW bit.
Note: ther is some uneccessary variables and not accurate comments, as I use the same template to start a new project timers for example are not accurate here.
Bellow are the .asm and HEX files for download (right click the icon, and choose "Save Link As.." from the drop down menu)