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

PSoC™ 4

Not applicable



in the attached project I try to adjust the brightness of the onboard LED with a Rotary Encoder


Question 1: If  I enable line 27 ("LED_BLUE_Write(0u);") by the removing the comment signs
                    the rest of the code does not work as I aspect. Turning the Rotary Encoder has no effect!
                    Why is this so? (with the line disabled it works as I aspect!)


Question 2: What do I have to change that the code from line 47 to 69 is executed in an interrupt routine, where the interrupt routine is initiated every time the Rotary Encoder is operated?


Thanks in advance,


Giel Peters



1 Reply
Level 10
50 questions asked 10 questions asked 1000 solutions authored
Level 10

Line 27 is like a shortcut, you write to a signal that comes from the PWM feeding to the LED. Which is going to win???


Better set the PWM accordingly by setting the compare value to zero to turn off the LED.


There is no interrupt for a counter change, but you may define an interrupt output for the phiA or phiB pins