2020-01-27 11:34发布
zjykwym 发表于 2013-4-18 13:41 void driver_ir_send_data(UINT8 ir_data) { IDATA UINT8 IR_bufdata[4]; //遥控代码存放缓冲 ...
zjx_arm 发表于 2013-4-20 14:40 你这个定时器的中断服务程序的代码没有贴出来啊,晶振是多少?什么型号的单片机啊。。。我的代码就是按照 ...
zjykwym 发表于 2013-4-9 14:05 中断要13us一次,不是26us
最多设置5个标签!
{
IDATA UINT8 IR_bufdata[4]; //遥控代码存放缓冲区
IDATA UINT8 i,j;
IR_bufdata[0] = 0x72;; //Sysc ode数据转移到IR_bufdata[]内
IR_bufdata[1] = 0xDD;
IR_bufdata[2] = ir_data;
IR_bufdata[3] = ~ir_data;
ir_endcount = 680; //发送9ms的起始码
ir_flag = 1;
ir_count = 0;
while(ir_count < ir_endcount);
ir_endcount = 172; //发送4.5ms的起始码
ir_flag = 0;
ir_count = 0;
while(ir_count < ir_endcount);
ir_endcount = 172; //发送4.5ms的起始码
ir_flag = 0;
ir_count = 0;
while(ir_count < ir_endcount);
for(j=0; j<4; j++) //发送4个字节32位遥控代码
{
for(i=0; i<8; i++)
{
ir_endcount = 40; //发送0.56ms的低电平,低电平时无38KHZ调制波
ir_flag = 1;
ir_count = 0;
while(ir_count < ir_endcount);
if(IR_bufdata[j] & 0x01) //判断二进制数最低位为1还是0
{
ir_endcount = 126; //0发送1.69ms的38KHZ调制高电平的红外?
}
else
{
ir_endcount = 40; //发送0.565ms的38KHZ调制高电平的红外波
}
ir_flag = 0;
ir_count = 0;
while(ir_count < ir_endcount);
IR_bufdata[j] = IR_bufdata[j] >> 1;
}
}
ir_endcount = 40; //
ir_flag = 1;
ir_count = 0;
while(ir_count < ir_endcount);
你看下我的,目前验证可用,昨天刚调试出来的,时间参数需要按照你自己的单片机做调整
你这个定时器的中断服务程序的代码没有贴出来啊,晶振是多少?什么型号的单片机啊。。。我的代码就是按照你这个代码改的,结果也不行额。。。前辈留个QQ号交流一下啊
51内核的无线芯片
请问为什么?
一周热门 更多>