Psoc 4200M Writing to output port blocks other behavior, why?

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

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hello,

   

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

   


 

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

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

   

 

   

Bob

0 Likes