新手上路
- 积分
- 46
- 金钱
- 46
- 注册时间
- 2015-5-16
- 在线时间
- 25 小时
|
10金钱
各位老师,学生我最近在学习433M无线发射模块,想用曼切斯特编码,返回的16位值想用用串口打印,看看值,但值一直不对,写一个0x02,串口打印的是-10919.哪位老师懂得,给学生指导一下。然后就是,如何把值给IO口,让它把数据给无限模块发射呢?多谢各位老师。代码如下:
#include "Mqst.h"
unsigned int ManchesterOut = 0;
unsigned int CharToManchester(unsigned char Encode_Data)
{
unsigned char i = 0;
for(i=0;i<8;i++)
{
if(( Encode_Data&0x80)==0x80)
{
ManchesterOut = ManchesterOut + 1;
ManchesterOut = ManchesterOut << 1;
if(i<7)
{
ManchesterOut <<= 1;
Encode_Data <<= 1;
}
}
else if(( Encode_Data&0x80)==0)
{
ManchesterOut <<= 1;
ManchesterOut += 1;
if(i<7)
{
ManchesterOut <<= 1;
Encode_Data <<= 1;
}
}
}
return ManchesterOut;
}
|
|