三星红外发射协议,载波事件
时间: 2023-07-21 21:55:56 浏览: 68
三星红外发射协议是一种红外通讯协议,常用于家电控制等领域。该协议使用38kHz的载波信号进行通讯,并采用了脉冲宽度编码(Pulse Width Modulation,PWM)技术。具体来说,每个数据位通过一系列的载波事件来表示,其中高电平载波事件表示0,低电平载波事件表示1。每个数据位的载波事件数量和载波事件持续时间的长短均不相同,这种编码方式可以有效地减少数据传输时的冗余信息,提高传输效率。
相关问题
三星红外发射协议,载波时间
在三星红外发射协议中,载波时间是指将38kHz载波信号分成若干个时间片段,每个时间片段的持续时间称为载波时间。具体来说,每个数据位由一组高低电平的载波事件组成,其中高电平载波事件表示0,低电平载波事件表示1。每个数据位的载波事件数量和载波事件持续时间的长短均不相同,但是每个时间片段的持续时间是固定的,通常为1.125ms或2.25ms。在使用三星红外发射协议进行通讯时,发送方需要按照协议规定的载波时间序列来发送数据,接收方则需要根据协议规定的载波时间序列来解码数据。
51单片机红外遥控发射NEC协议程序
以下是51单片机红外遥控发射NEC协议的程序代码:
```
#include<reg51.h>
#define uint unsigned int
#define uchar unsigned char
uchar code table[33] = {0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff};
uchar count, i, j;
void delay(uint x)
{
uint i,j;
for(i=x;i>0;i--)
for(j=110;j>0;j--);
}
void sendone(void)
{
P1 = 0;
delay(1);
P1 = 1;
delay(2);
P1 = 0;
delay(1);
}
void sendzero(void)
{
P1 = 0;
delay(1);
P1 = 1;
delay(1);
P1 = 0;
delay(2);
}
void send(uchar data)
{
uchar i;
for(i=0;i<8;i++)
{
if(data&0x01)
sendone();
else
sendzero();
data >>= 1;
}
}
void main()
{
TMOD = 0x01;
TH0 = 0xFC;
TL0 = 0x67;
TR0 = 1;
ET0 = 1;
EA = 1;
while(1)
{
send(0x00);
send(0x00);
send(0x00);
send(0x00);
send(0x00);
send(0x00);
send(0xff);
send(0x00);
send(0xff);
send(0x00);
send(0xff);
send(0x00);
send(0xff);
send(0x00);
send(0xff);
send(0x00);
send(0xff);
send(0x00);
send(0xff);
send(0x00);
send(0xff);
send(0x00);
send(0xff);
send(0x00);
send(0xff);
send(0x00);
send(0xff);
send(0x00);
send(0xff);
send(0x00);
send(0xff);
send(0x00);
send(0xff);
send(0x00);
delay(100);
}
}
void timer0() interrupt 1
{
TH0 = 0xFC;
TL0 = 0x67;
count++;
if(count == 15)
{
P1 = 1;
delay(1);
P1 = 0;
count = 0;
}
}
```
该程序使用了51单片机的定时器和外部中断,通过红外发射管发送NEC协议格式的红外码。在main函数中循环发送了一组红外码,通过定时器中断控制红外码的发送频率。其中sendone和sendzero函数分别表示发送1和0的红外码,send函数用于发送8位数据。注意在使用该程序时需要根据具体硬件电路设计进行相应的修改。
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![-](https://csdnimg.cn/download_wenku/file_type_lunwen.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)