---------------------
switch(Test_UCA0RXBUF)
{
//1:字符/16进制 2:整型 4:浮点型
case '1': //字符、hex(uchar)
{
}
break;
case '2': //整型(int16)
{
times++;
//低位在前,高位在后
//接收10进制(size uint8)
if(2 == times)
{
times = 0;
data_uint16 = data_uint16|((uint)Test_UCA0RXBUF<<8);
EraseSeg_Flash(0x1000);
p_uint = SingleWrite_Flash(p_uint,data_uint16); //存入Flash
USCIA_Send_string("choice Y[continue] or N[back to mode status]?");
//mode = 1; //进入校正模式
//USCIA_Send_string("Exit mode status... ");
//USCIA_Send_string("Enter data status... ");
}
else if(1 == times)
{
data_uint16 = (uint)Test_UCA0RXBUF;
}
}
break;
case '4': //浮点(float32)
{
times++;
//低位在前,高位在后
//接收浮点(size float32)
if(1 == times)
{
data_float32 = (ulong)(Test_UCA0RXBUF);
}
else if(2 == times)
{
data_float32 = (float)((ulong)data_float32|((ulong)Test_UCA0RXBUF<<8));
}
else if(3 == times)
{
data_float32 = (float)((ulong)data_float32|((ulong)Test_UCA0RXBUF<<16));
}
else if(4 == times)
{
times = 0;
data_float32 = (float)((ulong)data_float32|((ulong)Test_UCA0RXBUF<<24));
EraseSeg_Flash(0x1000);
p_float = SingleWrite_Flash(p_float,data_float32); //存入Flash
USCIA_Send_string("choice Y[continue] or N[back to mode status]?");
}
else
{
if('N' == Test_UCA0RXBUF) //退回mode状态,并打印出mode菜单
{
jz_status = 0;
mode_flag = 0; //返回mode状态
times = 0;
//打印mode菜单
Timer1_A2_Stop();
USCIA_Send_string("The Mode status: ");
USCIA_Send_string("0.Printing menus, ");
USCIA_Send_string("1.Start reading RH, ");
USCIA_Send_string("2.stop reading RH, ");
USCIA_Send_string("3.send data. ");
return;
}
else if('Y' == Test_UCA0RXBUF)
{
USCIA_Send_string("wait for data... ");
USCIA_Send_string("Choice receive data size: ");
USCIA_Send_string("1 char/hex, ");
USCIA_Send_string("2 uint16, ");
USCIA_Send_string("4 float32. ");
return;
}
}
}
break;
}
----------------------------------------------
if('4' == Test_UCA0RXBUF)
{
times++;
//低位在前,高位在后
//接收浮点(size float32)
if(1 == times)
{
data_float32 = (ulong)(Test_UCA0RXBUF);
}
else if(2 == times)
{
data_float32 = (float)((ulong)data_float32|((ulong)Test_UCA0RXBUF<<8));
}
else if(3 == times)
{
data_float32 = (float)((ulong)data_float32|((ulong)Test_UCA0RXBUF<<16));
}
else if(4 == times)
{
times = 0;
data_float32 = (float)((ulong)data_float32|((ulong)Test_UCA0RXBUF<<24));
EraseSeg_Flash(0x1000);
p_float = SingleWrite_Flash(p_float,data_float32); //存入Flash
USCIA_Send_string("choice Y[continue] or N[back to mode status]?");
}
else
{
if('N' == Test_UCA0RXBUF) //退回mode状态,并打印出mode菜单
{
jz_status = 0;
mode_flag = 0; //返回mode状态
times = 0;
//打印mode菜单
Timer1_A2_Stop();
USCIA_Send_string("The Mode status: ");
USCIA_Send_string("0.Printing menus, ");
USCIA_Send_string("1.Start reading RH, ");
USCIA_Send_string("2.stop reading RH, ");
USCIA_Send_string("3.send data. ");
return;
}
else if('Y' == Test_UCA0RXBUF)
{
USCIA_Send_string("wait for data... ");
USCIA_Send_string("Choice receive data size: ");
USCIA_Send_string("1 char/hex, ");
USCIA_Send_string("2 uint16, ");
USCIA_Send_string("4 float32. ");
return;
}
}
}
----------------------------------------
if()
{
}
else if()
{
}
else if()
{
}
else if()
{
}
else
{
}
----------------------------------------
switch(Test_UCA0RXBUF)
{
//mode状态
case '0': //打印命令菜单
{
Timer1_A2_Stop();
USCIA_Send_string("The Mode status: ");
USCIA_Send_string("0 Printing menus, ");
USCIA_Send_string("1 Start reading RH, ");
USCIA_Send_string("2 stop reading RH, ");
USCIA_Send_string("3 send data.");
}
break;
case '1': //开启TimerA1_A2,读取RH测试值
{
USCIA_Send_string("1 status... ");
Timer1_A2_Init();
}
break;
case '2': //停止TimerA1_A2,停止读RH测试值
{
Timer1_A2_Stop();
USCIA_Send_string("2 status... ");
}
break;
case '3': //选择接收数据类型
{
Timer1_A2_Stop();
USCIA_Send_string("3 status... ");
Timer1_A2_Stop();
USCIA_Send_string("Choice receive data size: ");
USCIA_Send_string("c char/hex, ");
USCIA_Send_string("d uint16, ");
USCIA_Send_string("f float32, ");
}
break;
}
----------------------------------------
switch(Test_UCA0RXBUF)
{
//mode状态
case '0': //打印命令菜单
{
Timer1_A2_Stop();
USCIA_Send_string("The Mode status: ");
USCIA_Send_string("0 Printing menus, ");
USCIA_Send_string("1 Start reading RH, ");
USCIA_Send_string("2 stop reading RH, ");
USCIA_Send_string("3 send data.");
}
break;
case '1': //开启TimerA1_A2,读取RH测试值
{
USCIA_Send_string("1 status... ");
Timer1_A2_Init();
}
break;
case '2': //停止TimerA1_A2,停止读RH测试值
没有合适的资源?快使用搜索试试~ 我知道了~
MSP430串口,湿度定标,上位机控制指令码控制
共24个文件
r43:5个
c:5个
h:2个
需积分: 10 11 下载量 166 浏览量
2011-01-24
15:40:59
上传
评论 1
收藏 77KB RAR 举报
温馨提示
上位机软件发送字符命令控制MSP430完成显示湿度,定标湿度,擦除保存数据
资源推荐
资源详情
资源评论
收起资源包目录
MSP430小板源码.rar (24个子文件)
test1
main.h 1019B
main.c 6KB
settings
test11.dbgdt 10KB
test11.dni 1KB
test11.cspy.bat 3KB
test11.wsdt 3KB
test.txt 13KB
test1.txt 4KB
SB_Config.h 455B
test11.ewp 46KB
Debug
Obj
MSP430x21x2_USCIA.r43 12KB
MSP430x21x2_Cplusplus_FLASH_.r43 17KB
main.r43 36KB
MSP430x21x2_JC_Functions.r43 33KB
test11.pbd 454B
MSP430x21x2_System.r43 9KB
List
Exe
test11.d43 80KB
MSP430x21x2_System.c 6KB
MSP430x21x2_JC_Functions.c 4KB
MSP430x21x2_Cplusplus_FLASH_.c 5KB
test11.eww 160B
MSP430x21x2_USCIA.c 2KB
test11.ewd 13KB
test11.dep 8KB
共 24 条
- 1
资源评论
fanyan1110
- 粉丝: 5
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功