Write Software - Texas Instruments CC2545 User Manual

Table of Contents

Advertisement

A.7 Write Software
At this point, the project is configured and you can write your first lines of code. We will show a small
blinking LED example.
In the project, create a new file that you save as blinky.c. Type the following code:
#include <ioCC2543.h>
int main(void)
{
int i;
// Set P1.0 of CC2543 as output
P1DIR |= 0x01;
// Toggle P1.0
for(;;)
{
P1_0 ^= 1;
for(i = 0; i < 10000; i++)
{
asm("NOP");
}
}
}
The code will toggle P1.0 quickly.
Add the file to the project by right clicking the project and selecting Add "blinky.c" as seen in Figure 24
- Add Source File to Project.
You are now ready to compile and download the code to the target!
Figure 24 - Add Source File to Project
35/37
swru318

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cc2544Cc2543

Table of Contents