• Pandeme
    了解作者
  • C/C++
    开发工具
  • 148KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 0
    下载次数
  • 2020-03-02 13:41
    上传日期
51单片机DS12C887时钟驱动程序,带原理图
11-时钟DS12C887.zip
  • 程序
  • OBJ
  • delay.obj
    5.1KB
  • DS18B20.obj
    6.6KB
  • main
    46KB
  • MatrixKeyboard.obj
    6.2KB
  • LED_7SEG.obj
    5KB
  • onewire.obj
    10.7KB
  • main.obj
    6KB
  • main.hex
    5.3KB
  • Timer0.obj
    7.2KB
  • Handle.obj
    11.2KB
  • Enable138.obj
    4.4KB
  • UART.obj
    5.8KB
  • DS12887.obj
    9.5KB
  • main.lnp
    190B
  • 1602.obj
    12.4KB
  • main.plg
    3.8KB
  • USER
  • UART.lst
    1.8KB
  • main.uvproj
    14KB
  • main.LST
    2.3KB
  • main_uvproj.bak
    14.2KB
  • MatrixKeyboard.lst
    5.9KB
  • Handle.LST
    8.5KB
  • LED_7SEG.lst
    3.2KB
  • main.c
    845B
  • Handle.c
    3.1KB
  • STARTUP.A51
    6.2KB
  • onewire.lst
    6.2KB
  • DS12887.lst
    3.7KB
  • 1602.lst
    6.7KB
  • Timer0.lst
    2.2KB
  • main.m51
    28.2KB
  • DS18B20.lst
    3.6KB
  • main.uvopt
    60.9KB
  • Handle.h
    254B
  • Enable138.lst
    1.6KB
  • delay.lst
    1.4KB
  • main.h
    372B
  • main_uvopt.bak
    58.6KB
  • main.plg
    172B
  • FWLIB
  • 1602.c
    3.5KB
  • DS12887.c
    1.6KB
  • DS12887.h
    718B
  • 1602.h
    668B
  • MatrixKeyboard.h
    142B
  • delay.h
    111B
  • delay.c
    335B
  • MatrixKeyboard.c
    2KB
  • 电路图.pdf
    63.9KB
内容介绍
#include"1602.h" /*****************LCD延时********************/ void Delay(WORD n) { WORD x; while(n--) { x=500; while(x--); } } /************************************************************************ Function name: write_cmd Descriptions: 向lcd输入指令 ************************************************************************/ void write_cmd(BYTE cmd) { BYTE dl; do { dl=rd_com; } while((dl&0x80)!=0); //判忙 wr_com= cmd; Delay(1); } /********************************************************************** Function name: write_data Descriptions: 写入数据 **********************************************************************/ void write_data(BYTE dat) { BYTE dl; do { dl=rd_com; } while((dl&0x80)!=0); //判忙 wr_data= dat; Delay(1); } /*********************************************************************** Function name: write_string Descriptions: 写入字符串 ***********************************************************************/ void write_string(BYTE *s) { while(*s != '\0') //'\0'为字符串结束标志 { write_data(*s); s++; } } /********************************************************************** Function name: set_display_place Descriptions: 设置字符的显示位置 **********************************************************************/ void set_display_place(BYTE line,column) { BYTE address; if(line == 1) { address = 0x80 + column; } else if(line == 2) { address = 0xc0 + column; } write_cmd(address); } /******************************************************************* Function name: 将字符串写到指定的位置 Descriptions: 将字符串显示在lcd的特定位置 *******************************************************************/ void write_string_lcd(BYTE line,column,unsigned char *string) { set_display_place(line,column); write_string(string); Delay(1); } void write_sfm2(BYTE line,column,unsigned char date) // ASCII 代码 0x30=0: 0x39=9 { set_display_place(line,column); write_data(0x30+date/10%10); write_data(0x30+date%10); Delay(1); } void LCD_Show_Time(unsigned char Hour_Read,Min_Read,Sec_Read,Year_Read,Month_Read,Day_Read) // BCD代码 { set_display_place(1,5); write_data(0x30+Year_Read/16); write_data(0x30+Year_Read%16); set_display_place(1,8); write_data(0x30+Month_Read/16); write_data(0x30+Month_Read%16); set_display_place(1,11); write_data(0x30+Day_Read/16); write_data(0x30+Day_Read%16); set_display_place(2,4); write_data(0x30+Hour_Read/16); write_data(0x30+Hour_Read%16); set_display_place(2,7); write_data(0x30+Min_Read/16); write_data(0x30+Min_Read%16); set_display_place(2,10); write_data(0x30+Sec_Read/16); write_data(0x30+Sec_Read%16); Delay(1); } /*************************************************** ************液晶模块初始化****************************** ****************************************************/ //write_string_lcd(1,0," 2019-01-07 ");//5 8 11 //write_string_lcd(2,0," 18:50:00 ");//4 7 10 void Init_1602(void) { write_cmd(0x38);// write_cmd(0x0c);// write_cmd(0x06);// write_cmd(0x01);// 清屏 write_cmd(0x01);// 清屏 write_string_lcd(1,0," 2019-01-07 ");//5 8 11 write_string_lcd(2,0," 17:50:00 ");//4 7 10 write_string_lcd(1,0," 2019-01-07 ");//5 8 11 write_string_lcd(2,0," 17:50:00 ");//4 7 10 }
评论
    相关推荐