how can we toggle a led

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

cross mob
Anonymous
Not applicable

how can we toggle an led in psoc by writing a single value in  control registers and using logic gates? i don't want to toggle it through command

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

Not quite clear what you exactly mean. Toggling an LED in software is a direct write to the GPIO pin.

A hardware approach usually takes a PWM or a Timer component and connect the appropriate output to the GPIO

A mixture is a Timer component connected to an interrupt. In the handler toggling the LED. I personally prefer that method because this single timer can perform additional jobs at maintaining an internal clock, delays and waits.

Bob

View solution in original post

3 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Not quite clear what you exactly mean. Toggling an LED in software is a direct write to the GPIO pin.

A hardware approach usually takes a PWM or a Timer component and connect the appropriate output to the GPIO

A mixture is a Timer component connected to an interrupt. In the handler toggling the LED. I personally prefer that method because this single timer can perform additional jobs at maintaining an internal clock, delays and waits.

Bob

RodolfoGL
Employee
Employee
250 solutions authored 250 sign-ins 5 comments on KBA

You can configure the Control Register to generate a pulse signal. Connect this pulse signal to the clock of a toggle flip-flop. Here is how this would look like:

pastedImage_0.png

NoriTan
Employee
Employee
25 sign-ins 5 questions asked 10 sign-ins

Actually the Control Registers output cannot be connected to the Macrocell's clock input of a UDB.  So, the 12MHz clock is connected to the TFF's clock input and the Control Register's output is connected to the TFF's clock enable input.  As the result there will be a short latency from the rising edge of the Control Registers' output and the TFF's output.

This is an another solution with a same concept.

GS003180.png

Both the Control Register's output and the TFF's output are explicitly synchronized to the 48MHz HFClk.

0 Likes