3 Replies Latest reply on Sep 5, 2017 12:21 AM by ntan

    how can we toggle a led

    anupam.mishra006_2693366

      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

        • 1. Re: how can we toggle a led
          user_1377889

          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

          4 of 4 people found this helpful
          • 2. Re: how can we toggle a led
            rlos

            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:

             

            3 of 3 people found this helpful
            • 3. Re: how can we toggle a led
              ntan

              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.