当前位置:网站首页>基于51单片机红外无线通讯仿真
基于51单片机红外无线通讯仿真
2022-04-23 17:07:00 【Xiao~小艳】
目录
资料下载地址:基于51单片机红外无线通信仿真
一、项目功能
该项目分为主机和从机,主机采集温度和光照强度通过IRLINK红外无线发射器传送给从机,并在在12864液晶屏幕上显示出来。
二、仿真
温度83、无亮度

温度65、有亮度
三、程序
部分程序
#include <REG51.h>
#include <intrins.h>
#include "hongwaifashe.h"
void hongwaifashe(void)
{
TMOD = 0x01; //T0 16位工作方式
IR=1; //发射端口常态为高电平
ZZ(setdata[0]);
ZZ(setdata[1]);
}
void ZZ(uchar x)
{
TT0(1,m9); //高电平9mS
TT0(0,m4_5); //低电平4.5mS
/*┈ 发送4帧数据 ┈*/
Z0(SBM);
Z0(~SBM);
Z0(x);
Z0(~x);
/*┈┈ 结束码 ┈┈*/
TT0(1,m_56);
TT0(0,m40);
}/*┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
函数功能:单帧发送程序
入口参数:1帧数据
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈*/
void Z0(uchar temp)
{
uchar v;
for (v=0;v<8;v++) //循环8次移位
{
TT0(1,m_56); //高电平0.65mS
if(temp&0x01) TT0(0,m1_68); //发送最低位
else TT0(0,m_56);
temp >>= 1; //右移一位
}
}
/*┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
函数功能:38KHz脉冲发射 + 延时程序
入口参数:(是否发射脉冲,延时约 x (uS))
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈*/
void TT0(bit BT,uint x)
{
TH0 = x>>8; //输入T0初始值
TL0 = x;
TF0=0; //清0
TR0=1; //启动定时器0
if(BT == 0) while(!TF0); //BT=0时不发射38KHz脉冲只延时;BT=1发射38KHz脉冲且延时;
else while(1) //38KHz脉冲,占空比5:26
{
IR = 0;
if(TF0)break;
if(TF0)break;
IR = 1;
if(TF0)break;
if(TF0)break;
if(TF0)break;
if(TF0)break;
if(TF0)break;
if(TF0)break;
if(TF0)break;
if(TF0)break;
if(TF0)break;
if(TF0)break;
}
TR0=0; //关闭定时器0
TF0=0; //标志位溢出则清0
IR =1; //脉冲停止后,发射端口常态为高电平
}
版权声明
本文为[Xiao~小艳]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_35654286/article/details/124360345
边栏推荐
- How to implement distributed locks with redis?
- Shell脚本——Shell编程规范及变量
- ASP. Net core configuration options (Part 2)
- SQL: How to parse Microsoft Transact-SQL Statements in C# and to match the column aliases of a view
- ACL 2022 | dialogved: a pre trained implicit variable encoding decoding model for dialogue reply generation
- 文件操作《二》(5000字总结篇)
- freeCodeCamp----shape_ Calculator exercise
- freeCodeCamp----prob_ Calculator exercise
- [markdown notes]
- Idea of batch manufacturing test data, with source code
猜你喜欢

Bottom processing of stack memory in browser

Sub database and sub table & shardingsphere

SQL database

Milvus 2.0 质量保障系统详解

Feign report 400 processing

TypeError: set_figure_params() got an unexpected keyword argument ‘figsize‘

Shell script -- shell programming specification and variables

groutine

How much do you know about the process of the interview

Quick install mongodb
随机推荐
JSON deserialize anonymous array / object
Freecodecamp ---- budget & category exercise
Rtklib 2.4.3 source code Notes
ClickHouse-SQL 操作
Shell-sed命令的使用
Detailed explanation of C webpai route
Go language RPC communication
_ Mold_ Board_
Idea of batch manufacturing test data, with source code
Nodejs installation and environment configuration
Introduction to new functions of camtasia2022 software
Expression "func" tSource, object "to expression" func "tSource, object" []
【生活中的逻辑谬误】稻草人谬误和无力反驳不算证明
Production environment——
Solution architect's small bag - 5 types of architecture diagrams
Blue Bridge Cup provincial road 06 -- the second game of the 12th provincial competition
Milvus 2.0 質量保障系統詳解
PHP高效读大文件处理数据
[problem solving] [show2012] random tree
【解决报错】Error in v-on handler: “TypeError: Cannot read property ‘resetFields’ of undefined”