How to control the intensity of the led

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi.. I want to control the intensity of the led ... off state to low intensity then gradually it will increase its intensity to the peak and then again it should reduce and gets off.

   

How can i perform this task? What component should i use ?

0 Likes
5 Replies
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Use the PrISM component, or a PWM and vary its compare value.

   

 

   

   

 

   

Regards, Dana.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

To succesively change the intensity of an LED follow Dana's advice and additionally use a timer that interrupts at certain times, so that you can change the PrISM's density value or the PWM's compare value.

   

Do not forget to read the Timer's status register in the interrupt handler to clear the interrupt.

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

You can avoid reading the Timer status register by attaching an ISR component

   

to Tc output of timer. And set up timer to just run continuously, no ISR.

   

 

   

Regards, Dana.

   

 

   

   

 

   

Or eliminate the timer and use the M3 core systick to gen the ISR, save resources.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Some systick related stuff -

   

 

   

    

   

          

   

http://www.cypress.com/?id=4&rID=94607     PSOC 4 Systick

    http://www.cypress.com/?docID=49253     AN90799 (Systick as well)(   

 

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

or use 2 pwms with slightly diffferent values of compare and period, and connect to a simple xor gate I think, use the output of the gate to drive the led.

   

it will look like its breathing.

   

 yup just tested it, works 🙂 its one of the things that altera trys to get you to do for fpga's, so it works good on the psoc5lp too should work on 3 4 and 5lp

0 Likes