1415 views|0 replies

3836

Posts

19

Resources
The OP
 

CC2530 Basic Experiment 1 I/O Experiment Code [Copy link]

Code
#include "ioCC2530.h" //reference CC2530 header file

/**************************************************************
Function name: delayFunction
: software delay
Input parameter: time--delay loop execution times
Output parameter: none
Return value: none
***********************************************************/
void delay(unsigned int time)
{
unsigned int i;
unsigned char j;
for(i = 0;i < time;i++)
for(j = 0;j < 240;j++)
{
asm("NOP");//asm is used to embed assembly language operations in C code,
asm("NOP");//compilation command nop is a no-operation, consuming 1 instruction cycle.
asm("NOP");
}
}
/******************************************************************
Function name: mainFunction
: main function of program
Input parameter: none
Output parameter: none
Return value: none
**************************************************************/
void main(void)
{
P1SEL &= ~0xff;//Set all bits of P1 port to normal IO port
P1DIR |= 0xff;//Set all bits of P1 port to output port

while(1) //main loop of program
{
P1 = ~P1; //P1 port output status inversion
delay(1000); //delay
}
}

This post is from Wireless Connectivity
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews

Room 1530, Zhongguancun MOOC Times Building, Block B, 18 Zhongguancun Street, Haidian District, Beijing 100190, China Tel:(010)82350740 Postcode:100190

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list