ZigBee Learning Notes Chapter One, "Light the first led"

Source: Internet
Author: User

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"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.