⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 7279.h

📁 自动温度监测系统
💻 H
字号:
/*****************************************************************
*	浙江大学仪器系短学期实习项目:
*	电仪2004级
*       小组成员:韩灿 刘清文赵岩 许琳燕
*
*	文件名 	:
*	开发人  :韩灿
*	开发时间:2007-8-20
*	版本   	:
*	修改者  :  
*	修改时间:
*	修改说明:
******************************************************************/
#include<reg51.h>
#include<intrins.h>

sbit p27=P2^7;

/*********
*接口定义
*********/
sbit H_CS=P1^4  ;
sbit H_CLK=P1^1  ;
sbit H_DATA=P1^2 ;
sbit H_KEY=P3^2  ;


/*********
*HD7279各指令定义
*********/
#define REST 0xa4              //复位
#define TEST 0xbf              //测试
#define RLC  0xa3              //循环左移
#define RRC  0xa2              //循环右移
#define RL   0xa1              //左移
#define RR   0xa0              //右移
#define DECODE0  0x80          //译码方式0
#define DECODE1  0xc8          //译码方式1
#define UNDECODE 0x90          //译码方式2,不译码
#define HIDE     0x98          //消隐
#define FLASH    0x88          //闪烁
#define SEGON    0xe0          //段亮
#define SEGOFF   0xc0          //段灭
#define READ     0x15          //读键盘

/*********
按键定义
********/
#define S0 0x00                
#define S1 0x01
#define S2 0x02


/*************
*函数声明
*************/
/*****************************************************************
*	函数名 	:  Sdelay()
*	功能  	: 短延时
*	输入参数: 
*		Param1:
*		Param2:
*		Param3:
*	输出参数:
*		Param1:
*		Param2:
*		Param3:
*	返回值	:
******************************************************************/
void Sdelay(void);                                  //短延时

/*****************************************************************
*	函数名 	:  Ldelay()
*	功能  	: 长延时
*	输入参数: 
*		Param1:
*		Param2:
*		Param3:
*	输出参数:
*		Param1:
*		Param2:
*		Param3:
*	返回值	:
******************************************************************/
void Ldelay(void);                                  //长延时

/*****************************************************************
*	函数名 	:  delay10ms
*	功能  	: 延时10ms*n
*	输入参数: 
*		Param1: unsigned int t
*		Param2:
*		Param3:
*	输出参数:
*		Param1:
*		Param2:
*		Param3:
*	返回值	:
******************************************************************/
void delay10ms(unsigned t);                         //延时10MS

/*****************************************************************
*	函数名 	: sent_byte
*	功能  	: 在7279中写入一个字节
*	输入参数: 
*		Param1: unsigned char out_B
*		Param2:
*		Param3:
*	输出参数:
*		Param1:
*		Param2:
*		Param3:
*	返回值	:
******************************************************************/
void sent_byte(unsigned char out_B);                //发送一个字节

/*****************************************************************
*	函数名 	: receive_byte
*	功能  	: 接收一个来自7279的字节
*	输入参数: 
*		Param1: 
*		Param2:
*		Param3:
*	输出参数:
*		Param1:
*		Param2:
*		Param3:
*	返回值	:unsigned char in_B
******************************************************************/
unsigned char receive_btye();             //接收一个字节

/*****************************************************************
*	函数名 	:  write
*	功能  	: 在7279中写入指令
*	输入参数: 
*		Param1:unsigned char comd
*		Param2:unsigned char dat
*		Param3:
*	输出参数:
*		Param1:
*		Param2:
*		Param3:
*	返回值	:
******************************************************************/
void write(unsigned char comd,unsigned char dat);   //发送一个命令

/*****************************************************************
*	函数名 	:  read
*	功能  	: 读键码
*	输入参数: 
*		Param1:unsigned char command
*		Param2:
*		Param3:
*	输出参数:
*		Param1:
*		Param2:
*		Param3:
*	返回值	:unsigned char in_B
******************************************************************/
unsigned char read(unsigned char command);                                             //读键盘




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -