【资源下载】下载地址如下:
https://docs.qq.com/doc/DTlRSd01BZXNpRUxl
51汽车保护装置设计-HX711+红外避障-RELAY-RFID
本设计由STC89C52单片机电路+HX711称重模块电路+红外避障传感器电路+继电器模块电路+RFID模块电路电源电路。
1、如果重量超过一定值(具体值由通旺科技自行确定)或者红外避障传感器检测到障碍物,则继电器断开。(继电器默认闭合)
2、称重传感器量程是0-5kg,模拟重量即可。
3、RFID模块刷卡(设定好的卡)后,则继电器2打开(继电器2打开5秒后自动断开)否则,继电器2不动作。
#include<reg52.h> //包含头文件,一般情况不需要改动,头文件包含特殊功能寄存器的定义
#include<stdio.h>
#include <intrins.h>
#include "delay.h"
#include "rc522.h"
#include "hx711.h"
sbit relay1 =P1^3; //引脚定义
sbit relay2 =P1^4;
sbit hotm = P1^2;
/*********/
unsigned char code yxID[4]={0x04,0x97,0x80,0x63}; //有效卡号
/*********/
xdata long Weight_Shiwu=0; //实物重量
xdata unsigned long Weight_Maopi=0; //读取初始化值
unsigned char UID[5]; //读取到的卡号
unsigned char Temp[4] ; //定义中间变量数组
unsigned long time_20ms;//定时器计数
bit readFlag; //显示更新标志
unsigned char relayLater = 0;//继电器动作延时
void Init_Timer0(void); //函数声明
void uartSendStr(unsigned char *s,unsigned char length);
void UART_Init(void);
void uartSendByte(unsigned char dat);