MSP430F149学习之路——蓝牙模块
注意蓝牙模块的接法!
#include <msp430x14x.h>
char data[];
int k=;
void int_clk()
{
BCSCTL1 &= ~XT2OFF;
BCSCTL2 |= SELM_2 + SELS;
do
{
IFG1 &= ~OFIFG;
for(int i=;i<;i++)
_NOP();
}while((IFG1 & OFIFG)!=);
IFG1 &= ~OFIFG;
}
void int_usart()
{
U0CTL |= SWRST;
U0CTL |= CHAR; U0TCTL |= SSEL1;
U0BR1 = 0X03;
U0BR0 = 0X41;
U0MCTL = 0X00; ME1 |= UTXE0 + URXE0;
U0CTL &= ~SWRST;
IE1 |= URXIE0; P3SEL |= BIT4 + BIT5;
P3DIR |= BIT4;
}
void Sent_Byte()
{
while((IFG1 & UTXIFG0)==);
U0TXBUF = data[k++];
if(k == )
k = ;
}
#pragma vector=USART0RX_VECTOR
__interrupt void USAR_RX()
{
char flag;
flag = U0RXBUF;
if(flag == )
{
for(int j=;j<;j++)
Sent_Byte();
}
}
void main()
{
WDTCTL = WDTPW + WDTHOLD;
int i;
for(i=;i<;i++)
data[i]=i;
int_clk();
int_usart();
_EINT();
}
MSP430F149学习之路——蓝牙模块的更多相关文章
- MSP430F149学习之路——捕获/比较模式
1.捕获模式 #include <msp430x14x.h> unsigned ,last1=; unsigned ,j=; void mian(void) { WDTCTL = WDTP ...
- python学习之路-7 模块configparser/xml/shutil/subprocess以及面向对象初级入门
本篇记录内容 模块 configparser xml shutil subprocess 面向对象 面向对象基础 面向对象编程和函数式编程对比 面向对象中对象和类的关系 面向对象之构造方法 面向对象之 ...
- Python学习之路12☞模块与包
一 模块 1.1 什么是模块? 一个模块就是一个包含了python定义和声明的文件,文件名就是模块名字加上.py的后缀. 1.2 为何要使用模块? 如果你退出python解释器然后重新进入,那么你之前 ...
- MSP430F149学习之路——AD
代码一:Timer_A触发转换 #include <msp430x14x.h> void main() { WDTCTL = WDTPW + WDTHOLD; P6SEL |= BIT0; ...
- MSP430F149学习之路——SPI
代码一: //****************************************************************************** //Description: ...
- MSP430F149学习之路——UART
代码一: #include <msp430x14x.h> void int_clk() { BCSCTL1 &= ~XT2OFF; BCSCTL2 |= SELM_2 + SELS ...
- MSP430F149学习之路——比较器Comparaor_A
代码一: #include <msp430x14x.h> ; void int_clk() { BCSCTL1 &= ~XT2OFF; BCSCTL2 |= SELM_2 + SE ...
- MSP430F149学习之路——PWM信号
代码一: /******************************* 程序功能:ACLK=32768Hz PWM波 T=512/32768 占空比75% ******************** ...
- MSP430F149学习之路——时钟1
1.看门狗产生方波 #include <msp430x14x.h> void main() { WDTCTL = WDT_MDLY_32; IE1 |= WDTIE; P1DIR |= B ...
随机推荐
- ApiCloud重新定义移动应用开发
http://www.apicloud.com/ 为APP开发者提供云端的API服务和数据存储服务,动态生成RESTful API,支持在线NoSQL数据表设计.API调试及用量分析:同时提供推送.云 ...
- 异常处理:Sys.WebForms.PageRequestManagerParserErrorException:The message……
如果你为了使页面可以达到局部刷新的效果,并且用了UpdatePanel控件,这是如果你在后台页面用到Response对象时肯呢过会抛出一下异常: 解决方法:$(document).ready(func ...
- item3 二维数组中的查找[剑指offer]
题目:在一个二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序. 请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有这个整数? 8 9 思路:查找7 ...
- HTML ISO-8859-1 参考手册
HTML 4.01 支持 ISO 8859-1 (Latin-1) 字符集. ISO-8859-1 的较低部分(从 1 到 127 之间的代码)是最初的 7 比特 ASCII. ISO-8859-1 ...
- butterknife 使用注意事项
写了个demo,一直报错 Caused by: java.lang.IllegalStateException: Required view 'tv1' with ID 2131492943 for ...
- ROM, RAM, Flash Memory
ROM Read-only memory (ROM) is a class of storage medium used in computers and other electronic devic ...
- Exception error message with incorrect line number
In Release mode the number in front of the exception is NOT the line of code. Instead it's an offset ...
- [Android NDK/JNI-1A]-开发环境搭建
NDK简介 NDK能干什么:NDK使得在android中,java可以调用C 函数库. 1.Android平台从诞生起,就已经支持C.C++开发.众所周知,Android的SDK基于Java实现,这意 ...
- 使用jackson进行json数据格式转换
private static final JsonFactory factory = new JsonFactory(); StringWriter jsonOut = new StringWrite ...
- [实变函数]3.1 外测度 (outer measure)
1 并不是所有的集合都可求测度. 我们的想法是先对 $\bbR^n$ 中的任一集合定义一个``外 测度'' (outer measure), 然后再加上适当的条件 (Caratheodory 条件), ...