lpc54102开发环境iar7.2 for arm
蓝牙cc2540f256开发环境iar8.3 for 51
测试硬件:nxp lpc54102+cc2540f256 usbdongle+pl2303 usb转串口板。
波特率9600bps,lpc发送数据给蓝牙,蓝牙收到后发送给电脑。
蓝牙串口中断接收并发送源代码
#include "ioCC2540.h"
#define CLKCON_CLKSPD_32M (0x00)
#define CLKCON_OSC 0x40
#define CLKCON_CLKSPD (0x07) // bit mask for the clock speed division
void delay(void)
{unsigned long i1;
for(i1=0;i1<10000;i1++)
asm(" nop ");
}
unsigned char rssi;
void main(void)
{
CLKCONCMD =0x80;
///CLKCONCMD = (CLKCONCMD & ~(CLKCON_CLKSPD | CLKCON_OSC)) | CLKCON_CLKSPD_32M;
// Wait until system clock source has changed to HS XOSC (CLKCONSTA.OSC = 0).
while(!(CLKCONSTA & 0x40));
P0SEL =0x0c;
P1SEL =0x0;
P0DIR=0xfb;
/// P1DIR=0xff;
U0CSR=0xc0;
U0UCR=0x02;
U0GCR=0x08;
U0BAUD=59;
PERCFG=0;
P2DIR=0x00;
IEN0=0x84;
///URX0IF=0;
while(1);
}
|