Question: In this lab, you will use TI Code Composer Studio (CCS) to program the TC CC3220x LAUNCHXL to blink some LEDs. Blinking LEDs in the

  • In this lab, you will use TI Code Composer Studio (CCS) to program the TC CC3220x LAUNCHXL to blink some LEDs. Blinking LEDs in the embedded space is equivalent to Hello, world! in the desktop space.

    During this milestone you will use CCS to edit, compile, and load code into the CC32xx board. You will then proceed to use it for debugging. Throughout this process, you explore the components of a CCS project and the CCS code generator (system config). You will also be able to learn more about the PWM driver.

    Goal: Your objective is to blink the green and yellow LEDs on the board.

  • Develop code for all of the specified functionality of the PWM peripheral. The LEDs should alternate between 10% and 90% duty cycles.

#include

#include

/* Driver Header files */

#include

/* Driver configuration */

#include "ti_drivers_config.h"

/*

* ======== mainThread ========

* Task periodically increments the PWM duty for the on board LED.

*/

void *mainThread(void *arg0)

{

/* Period and duty in microseconds */

uint16_t pwmPeriod = 3000;

uint16_t duty = 0;

uint16_t dutyInc = 100;

/* Sleep time in microseconds */

uint32_t time = 50000;

PWM_Handle pwm1 = NULL;

PWM_Handle pwm2 = NULL;

PWM_Params params;

/* Call driver init functions. */

PWM_init();

PWM_Params_init(ms);

params.dutyUnits = PWM_DUTY_US;

params.dutyValue = 0;

params.periodUnits = PWM_PERIOD_US;

params.periodValue = pwmPeriod;

pwm1 = PWM_open(CONFIG_PWM_0, ms);

if (pwm1 == NULL) {

/* CONFIG_PWM_0 did not open */

while (1);

}

PWM_start(pwm1);

pwm2 = PWM_open(CONFIG_PWM_1, ms);

if (pwm2 == NULL) {

/* CONFIG_PWM_0 did not open */

while (1);

}

PWM_start(pwm2);

/* Loop forever incrementing the PWM duty */

while (1) {

PWM_setDuty(pwm1, duty);

PWM_setDuty(pwm2, duty);

duty = (duty + dutyInc);

if (duty == pwmPeriod || (!duty)) {

dutyInc = - dutyInc;

}

usleep(time);

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!