HELP- PIC LED flasher

Started by asha_2108 March 21, 2005


Hi,
does anyone have any source codes for flashing an RGB(tricolour) LED
using a PIC 12F675 or similar PIC?? I'm doing a project on it, and
need some help with the coding.
Have to use assembler, but even C would do. trying to program it by
using different hex values and varying the duty cycles to produce all
colours of the spectrum using red green and blue. HELP!!
Asha



This sounds like a fun project. An LED colour changer.
You're basically looking at a simple PWM controller to control the LED
intensity. As the smaller PICs have only one PWM, you'll have to do it
in software.
Start easy with just one LED and vary the intersity. As this sounds like
homework, I'm not going to give you any code, just the idea on how to do it.

Example for 50% intensity.
Start: turn on the LED
load counter 1 with 128
load counter 2 with 256
loop decrement counter 1 (when counter 1 reaches zero, turn off LED)
decrement counter 2 (when counter 2 reaches zero, goto
start)
goto loop

The intensity can be changed by setting a new value for counter 1,
Smaller value, lower intensity.

This example is really crude, but it will work. You'll find the
limitations when you use it :)

Good luck,

Eugene
asha_2108 wrote:

>
>Hi,
>does anyone have any source codes for flashing an RGB(tricolour) LED
>using a PIC 12F675 or similar PIC?? I'm doing a project on it, and
>need some help with the coding.
>Have to use assembler, but even C would do. trying to program it by
>using different hex values and varying the duty cycles to produce all
>colours of the spectrum using red green and blue. HELP!!
>Asha




----- Original Message -----
From: "Eugene Gopalan" <>
To: <>
Sent: Tuesday, March 22, 2005 8:42 AM
Subject: Re: [piclist] HELP- PIC LED flasher >
> This sounds like a fun project. An LED colour changer.
> You're basically looking at a simple PWM controller to control the LED
> intensity. As the smaller PICs have only one PWM, you'll have to do it
> in software.
> Start easy with just one LED and vary the intersity. As this sounds like
> homework, I'm not going to give you any code, just the idea on how to do
> it.
>
> Example for 50% intensity.
> Start: turn on the LED
> load counter 1 with 128
> load counter 2 with 256
> loop decrement counter 1 (when counter 1 reaches zero, turn off LED)
> decrement counter 2 (when counter 2 reaches zero, goto
> start)
> goto loop
>
> The intensity can be changed by setting a new value for counter 1,
> Smaller value, lower intensity.
>
> This example is really crude, but it will work. You'll find the
> limitations when you use it :)

That's a neat way to do simple PWM, I haven't seen it before.

Leon


On 'the other' piclist - www.piclist.com - there was a discussion on this a few weeks back.  I didn't pay took much attention to the result, but it will be in the archives.
 
Various methods were discussed, including compensation for the fact the different colours appears brighter to the human eye at the same power level, ie green > red > blue.  Also went thru fading smoothly between colours.
 
Our eyes are most sensitive to green, and anyone who has looked carefully at a 15,000mCd green LED while wondering if it works, and then finding out that it does indeed work, will agree.  Who needs a laser to blind yourself with?
 
Tony
 
-----Original Message-----
From: asha_2108 [mailto:a...@yahoo.com]
Sent: Monday, 21 March 2005 6:04 PM
To: p...@yahoogroups.com
Subject: [piclist] HELP- PIC LED flasher



Hi,
does anyone have any source codes for flashing an RGB(tricolour) LED
using a PIC 12F675 or similar PIC?? I'm doing a project on it, and
need some help with the coding.
Have to use assembler, but even C would do. trying to program it by
using different hex values and varying the duty cycles to produce all
colours of the spectrum using red green and blue. HELP!!
Asha


to unsubscribe, go to http://www.yahoogroups.com and follow the instructions

Hai,
    My advice is to connect 3 pinsRGB to separate pins of microntroller. create three variables as counters for each colour. first keep two counters as constant 50% duty cycle throgh PWM (simple run a timer and just set and clear the corresponding pin connected to LED) counters for each then use an inbuild timer to vary the PWM duty cycle for each colour keeping other two constant. this method will defenately work fine use a break for each inc in count to diagonise and note the value. 
refer the led datasheet.
 
Regards,
Murugan V
BlueQuanta Technologies, Chennai-17.
Ph: +91-044-52186383
www.bluequanta.com
 

DISCLAIMER:
This message and any attachment(s) contained here are information that is
confidential, proprietary to BlueQuanta Technologies and its customers.
Contents may be privileged or otherwise protected by law. The information is
solely intended for the individual or the entity it is addressed to. If you
are not the intended recipient of this message, you are not authorized to
read, forward, print, retain, copy or disseminate this message or any part
of it. If you have received this e-mail in error, please notify the sender
immediately by return e-mail and delete it from your computer.  The views
or opinions presented in this e-mail are solely those of the author
and do not necessarily represent those of the company.  The recipient
should check this e-mail and any attachments for the presence of
viruses.  The company accepts no liability for any damage caused,
directly or indirectly,
 
 
----- Original Message -----
From: Tony Smith
To: p...@yahoogroups.com
Sent: Wednesday, March 23, 2005 1:30 PM
Subject: RE: [piclist] HELP- PIC LED flasher

On 'the other' piclist - www.piclist.com - there was a discussion on this a few weeks back.  I didn't pay took much attention to the result, but it will be in the archives.
 
Various methods were discussed, including compensation for the fact the different colours appears brighter to the human eye at the same power level, ie green > red > blue.  Also went thru fading smoothly between colours.
 
Our eyes are most sensitive to green, and anyone who has looked carefully at a 15,000mCd green LED while wondering if it works, and then finding out that it does indeed work, will agree.  Who needs a laser to blind yourself with?
 
Tony
 
-----Original Message-----
From: asha_2108 [mailto:a...@yahoo.com]
Sent: Monday, 21 March 2005 6:04 PM
To: p...@yahoogroups.com
Subject: [piclist] HELP- PIC LED flasher



Hi,
does anyone have any source codes for flashing an RGB(tricolour) LED
using a PIC 12F675 or similar PIC?? I'm doing a project on it, and
need some help with the coding.
Have to use assembler, but even C would do. trying to program it by
using different hex values and varying the duty cycles to produce all
colours of the spectrum using red green and blue. HELP!!
Asha


to unsubscribe, go to http://www.yahoogroups.com and follow the instructions

to unsubscribe, go to http://www.yahoogroups.com and follow the instructions