This code is for a simple RGB LED controller for 8 LEDs using a PIC16F628. It is controlled by sending 3 bytes to the internal USART for the red, green, and blue color channels. The operation is very simple and so is the wiring. The PIC selects each LED then turns on/off the respective colors then goes to the next LED. Because of persistence of vision, the eye sees the LEDs as all being on at the same time.
Category: JAL Projects
JAL Libraries
Here are some of the libraries I have written for JAL:
675rs232_sw.jal | 675rs232_sw Software serial library for the PIC12F629/675 used in the PIC12F675 Oscilloscope. |
jpic628a.jal | jpic628a JPIC library for PIC16F628 microchips with serial routines and much more processor-specific code that allows one to take full advantage of the 628’s abilities. |
nibsBPs.jal | nibsBPs Simple library to convert bytes to nibbles (high and low) and bit-pairs. |
shiftIn.jal | shiftIn Simple library to shift data out using a clock and a data pin. Can provide the clock or use an external clock. |
shiftOut.jal | shiftOut Simple library to shift data in using a clock and a data pin. Can provide the clock or use an external clock. |
PIC16F628 8 RGB LED Controller
This code is for a simple RGB LED controller for 8 LEDs using a PIC16F628. The pattern is determined by the data in the EEPROM. Upon startup, the controller loads the data into RAM and starts up the sequence. The operation is very simple and so is the wiring. The PIC selects each LED then turns on/off the respective colors then goes to the next LED. Because of persistence of vision, the eye sees the LEDs as all being on at the same time. Currently the max number of display patterns is 20 (because the bank array is 80 bytes and each pattern is 4 bytes).
PIC12F675 Oscilloscope
This is a simple PC voltage oscilloscope using only a PIC12F675, a 20MHz oscillator, and a RS232 level shifter. The PIC takes a sample on GP2, immediately sends it to the PC at 115,200 baud using an software asynchronous serial routine, and repeats. It sends a 8-bit value that is read by the Visual Basic software and displayed on the screen (see examples below). The Visual Basic software deduces the time period between submissions and adjusts the display accordingly.
PIC16F628 Serial 1 RGB LED PWM Controller
This code is for a simple RGB LED controller for 1 LED using a PIC16F628 that has PWM control for the LED. It is controlled by sending 2 bytes to the PIC’s internal USART for the intensities of the red, green, and blue color channels. The operation is very simple and so is the wiring. The PIC loops and turns on the respective colors if they are less than or equal to theCount. Because of persistence of vision, the eye sees the LEDs as all being on at the same time. The 4-bit code below has 15 linear values of PWM. The 8-bit code has 255 linear values of PWM. The 4-bit exponential PWM code has 15 values fit to an exponential curve. This allows for more “even” color levels because the human eye does not readily perceive linear changes in light intensity. For LED applications, the 4-bit exponential code is recommended.
PIC16F628 Serial 8 RGB LED PWM Controller
This code is for a simple RGB LED controller for 8 LEDs using a PIC16F628 that has PWM control for the LEDs. It is controlled by sending 12 bytes to the PIC’s internal USART for the intensities of the red, green, and blue color channels. The operation is very simple and so is the wiring. The PIC selects each LED and turns on the respective colors if they are less than or equal to theCount then goes to the next LED. Because of persistence of vision, the eye sees the LEDs as all being on at the same time. However, because this is running off the internal OSC (4MHz) and the code is not optimized, there is some flickering evident when moving one’s head from side to side.
PIC12F675 Single RGB LED Controller
This code is for a simple RGB LED controller for 1 RGB LED using a PIC12F675 (or PIC12F629). The pattern is determined by the data in the EEPROM. When the PIC needs a new target for the PWM, it loads it from EEPROM. Pin 4 (GP3) is pulled high because it is used to switch between displays. Please see the source code for more information; the structure and design is commented. The operation of the controller is very simple and so is the wiring. Read More