This commit is contained in:
2023-12-29 00:57:13 +08:00
commit f11925818e
12 changed files with 495 additions and 0 deletions

14
include/ds18b20.h Normal file
View File

@ -0,0 +1,14 @@
#ifndef _ds18b20_H
#define _ds18b20_H
#include "public.h"
//管脚定义
#define DS18B20_PORT P3_7 //DS18B20数据口定义
#define _nop_() __asm NOP __endasm
//函数声明
u8 ds18b20_init(void);
float ds18b20_read_temperture(void);
#endif

26
include/intrins.h Normal file
View File

@ -0,0 +1,26 @@
#ifndef _INTRINS_H_
#define _INTRINS_H_
/* warning: __push __pop 使用堆栈临时保存 sfr 数据,必需成对使用!
__push(x);
... // 保护代码块
__pop(x) //缺少无该语句编译不会出错,但运行错误!
*/
#define __push(x) __asm push _##x __endasm /* void _push_ (unsigned char _sfr); */
#define __pop(x) __asm pop _##x __endasm /* void _pop_ (unsigned char _sfr); */
#define _push_ __push  /*兼容 keil c51*/
#define _pop_ __pop  /*兼容 keil c51*/
/* 安全使用保护宏:
pushSfr(x);
... // 受保护代码块
popSfr(x) // 缺少无该语句编译出错,确保生成正确代码。
*/
#define pushSfr(x) do{\
__push(x)
#define popSfr(x) __pop(x);\
}while(0)
#endif //_INTRINS_H_

14
include/public.h Normal file
View File

@ -0,0 +1,14 @@
#ifndef _public_H
#define _public_H
// #include "reg52.h"
#include <8052.h>
typedef unsigned int u16;
typedef unsigned char u8;
void delay_10us(u16 ten_us);
void delay_ms(u16 ms);
#endif

18
include/smg.h Normal file
View File

@ -0,0 +1,18 @@
#ifndef _smg_H
#define _smg_H
#include "public.h"
#define SMG_A_DP_PORT P0 //使用宏定义数码管段码口
//定义数码管位选信号控制脚
#define LSA P2_2
#define LSB P2_3
#define LSC P2_4
extern u8 gsmg_code[17];
void smg_display(u8 dat[],u8 pos);
#endif

22
include/uart.h Normal file
View File

@ -0,0 +1,22 @@
/**************************************************************************************
深圳市普中科技有限公司PRECHIN 普中)
技术支持www.prechin.net
实验名称:串口通信实验
接线说明:
实验现象:下载程序后,当串口助手发送数据给单片机,单片机原封不动转发给串口助手显示
注意事项使用黄色跳线帽将CH340旁的P5端子的UTX和P30短接URX和P31短接出厂默认已短接好
***************************************************************************************/
#ifndef _uart_H
#define _uart_H
#include "public.h"
extern __bit busy;
void uart_init(u8 baud);
void send_string(char *s);
void send_data(u8 dat);
int putchar(char c);
#endif