关键词不能为空

当前您在: 主页 > 英语 >

土壤温湿度传感器c程序

作者:高考题库网
来源:https://www.bjmy2z.cn/gaokao
2021-02-01 23:50
tags:

-

2021年2月1日发(作者:渔夫)


/*


* turangwenshiduchuanganqi1.c


*


* Created: 2015/8/5 9:18:56


* Author: Administrator


*/




/********** ************************************************** ************/


/*


常用头文件及宏定义








*/


/******************** ************************************************** **/



#include


#include




//


延时文件



#include





//


睡眠文件



#include




//


中断文件



#include




//eeprom


#define BIT(x) (1<<(x))


#define uchar unsigned char


#define uint unsigned int



/************************** **********************************************/


/* 1602 */


/*********************************** *************************************/



/* 8


位总线模式










*/



/*


引脚说明


*/



/* PC 0 RS PC 1 RW PC 2 E PC 3


背光


PB 0



PB 7


数据


*/



/*


宏定义


*/



#define DDR_SHUJU DDRB


#define PORT_SHUJU PORTB


#define PIN_SHUJU PINB


#define DDR_KZ DDRC


#define PORT_KZ PORTC


#define RS_H PORT_KZ|=BIT(0)


#define RS_L PORT_KZ&=~(BIT(0))


#define RW_H PORT_KZ|=BIT(1)


#define RW_L PORT_KZ&=~(BIT(1))


#define E_H PORT_KZ|=BIT(2)


#define E_L PORT_KZ&=~(BIT(2))


#define BEIGUABG_H PORT_KZ|=BIT(3)


#define BEIGUABG_L PORT_KZ&=~(BIT(3))



uchar lcd_read()






//


读忙函数



{



uchar bl;



DDR_SHUJU=0;






//


输入




PORT_SHUJU=0xff;





//


上拉电阻




RS_L;



RW_H;



E_H;



_delay_ms(1);



bl=PIN_SHUJU;



E_L;



RW_L;



PORT_SHUJU=0;



DDR_SHUJU=0xff;



return bl;


}


void lcd_write_char(uchar shuju)


//


写字符函数



{



while(lcd_read()&BIT(7));



RS_H;



RW_L;



PORT_SHUJU=shuju;



E_H;



E_L;



RS_L;


}


void lcd_write_string(char *str)


//


写字符串函数



{



while(*str!='0')



{




lcd_write_char(*str);




str++;



}


}


void lcd_write_zhiling(uchar zhiling)


{



while(lcd_read()&BIT(7));



RS_L;



RW_L;



PORT_SHUJU=zhiling;



E_H;

-


-


-


-


-


-


-


-



本文更新与2021-02-01 23:50,由作者提供,不代表本网站立场,转载请注明出处:https://www.bjmy2z.cn/gaokao/595922.html

土壤温湿度传感器c程序的相关文章