cancel
Showing results for 
Search instead for 
Did you mean: 

Code Examples

Contributor

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
Moderator
Moderator

Dear Author,

We appreciate your contribution for this.

Best regards.

Contributor

Hi,

Sorry, there is a software bug that causes the LEDs to turn on when calling SmartIO_Start in the main function.In the TopDesign.cysh of the projects, it's because each LUT of SmartI/O is uninitialized and all zero by default. Initializing it with 0x81 or 0xFF will solve this problem.

Best regards,

Top labels