PSoC4 Smart I/O controls multiple LEDs with one TCPWM channel

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.
KaKo_4074056
Level 4
Level 4
Distributor - Marubun (Japan)
First like given First solution authored 25 replies posted

Hi,

This sample program is run on CY8CKIT-149 (PSoC 4100S Plus, PSoC Creator 4.2). The output of one TCPWM is input to the Smart I/O and distributed to control multiple LEDs with the same period and duty ratio. This is useful to control more LEDs than the number of PWM channels. The timing of turning on and off each LED is controlled by API of LUT and Port. There are two types projects with and without the internal pin of Smart I/O. The following shows the one with the internal pin as P1[3].

cysch.PNG

smartio.png

        /* Turn on LED5 and off the others */

        SmartIO_LUT_ConfigureMode(SmartIO_LUT0, LUT_LED_ON, SmartIO_MODE_COMB);

        SmartIO_LUT_ConfigureMode(SmartIO_LUT2, LUT_LED_OFF, SmartIO_MODE_COMB);

        SmartIO_LUT_ConfigureMode(SmartIO_LUT4, LUT_LED_OFF, SmartIO_MODE_COMB);

        SmartIO_LUT_ConfigureMode(SmartIO_LUT6, LUT_LED_OFF, SmartIO_MODE_COMB);

2 Replies