as an Internet of things professional students, feel not to learn these things connected to the knowledge of the Internet can not afford their own, well, learning to start!!!
The CC2530 has 21 digital input/output pins, namely p01-p07, P10-P17, P20-P24. In particular, it is important to note that the input and output of the CC2530 pin is different from the 51 single chip microcomputer, look at the comparison of the picture.
Well, this has a basic understanding of our own ZigBee module to understand the hardware circuit connection, so you can start to prepare to write programs, is my own hands ZigBee LED circuit diagram
Before writing the program we also need to know how these IO port registers are configured, this is the most basic, of course, is of particular importance.
Port configuration can be divided into three kinds, general Io, pull, output, respectively, Pxsel, Pxdir, PXINP these three registers to control, correspondence relations.
For example I want to let P10 is input condition, I need to change; p1dir=0x80; 0x80=1000 0000;
OK, now it's time to start writing our program.
#include <ioCC2530.h> #define UINT unsigned int#define uchar unsigned char#define LED1 p1_0 //configuration p1_0 for Led1void Led_io () {p1dir=0xff;//define P1 as output mode led1=0; Light led1}void Main (void) { led_io (); while (1) { led1=0;}}
ZigBee Learning Notes Chapter One, "Light the first led"