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
Need help?

Need help?

Do you have a question about the CC2545 and is the answer not in the manual?

This manual is also suitable for:

Cc2544Cc2543Cc254 series

Table of Contents