Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Spency's 18F PIC Micro RGB Led Program

Status
Not open for further replies.

spency_picbasic

Newbie level 2
Joined
May 2, 2008
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Australia
Activity points
1,300
picmicro led pwm

I know there are 100's of RGB LED circuits and programs out there, but here's my take on things ;)

I've made a program that allows the user to control the brightness of each LED from 0 to 100% by modifying a register from 0 to 255 for each color

What makes this program different? I back up the system registers before the interrupt, and restore them afterwards, so your main program could be doing absolutely anything (within reason), and the three PWM signals will function perfectly, and are all editable on-the-fly

It also includes a very handy mS register that can be used anywhere in the main program to create delays and the such, eg;

Code:
Red_Duty = 0                     // Clear the Red_Duty register
While Red_Duty < 255             // Create a loop condition
    Inc(Red_Duty)                // Increment the Red Duty Cycle
    mS = 0                       // Clear the mS register
    repeat
    until mS = 10                // Wait for 10mS to elapse
wend

This example will delay 10mS between each increment of the Red Duty Cycle. The main program is a little more elaborate, and generates a random number to decide which color to increase/decrease, for something so simple, the results are amazing in real life.

The Common Anode RGB LED's I used can be found at Core Electronics (they are very bright and have very vivid colors)
**broken link removed**

You can get very stunning effects with these LED's, and the video's I took didn't give them the justice! I used three LED's and a large white semi transparent bowl to diffuse the light and make a "mood rock" type feature.
http://www.box.net/shared/6eik4gs4co
**broken link removed**

More info about the program and circuit can be found here
http://www.digital-diy.net/18F%20Examples/RGB%20LED's.aspx
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top