資源簡介
很好用的ST7565芯片的12864驅動

代碼片段和文件信息
/*-----------------------------------------------------------------------------
?*??Include
?*-----------------------------------------------------------------------------*/
#include?“system.h“
#include?
#include?
#include?“../inc/sopc.h“
#include?“../inc/lcd.h“
#include?
#include?“../inc/hzk12.h“
/*-----------------------------------------------------------------------------
?*??Function?
?*-----------------------------------------------------------------------------*/
void?initialize_lcd(void);
void?draw_screen(unsigned?char?*p);
void?clear(void);
void?write_data(unsigned?char?dat);
void?data_send(unsigned?char?dat);?
void?write_command(unsigned?char?com);
void?set_x(unsigned?char?x);
void?set_y(unsigned?char?y);
void?black(void);
void?clear_page(unsigned?char?page);
LCD_T?lcd={
????.initialize=initialize_lcd
????.write_command=write_command
????.write_data=write_data
????.set_x=set_x
????.set_y=set_y
????.clear=clear
????.black=black
};
/*?
?*?===??FUNCTION??======================================================================
?*?????????Name:??data_send
?*??Description:??
?*?=====================================================================================
?*/
void?data_send(unsigned?char?dat)
{
????unsigned?char?i;
????LCD_CS->DATA=0;
????LCD_SCL->DATA=0;
????for(i=0;i<8;i++){
????????if(dat&0x80)LCD_SI->DATA=1;
????????else?LCD_SI->DATA=0;
????????
????????dat<<=1;
????????LCD_SCL->DATA=0;
????????LCD_SCL->DATA=1;
????}
????LCD_CS->DATA=1;
}
/*?
?*?===??FUNCTION??======================================================================
?*?????????Name:??write_command
?*??Description:?
?*?=====================================================================================
?*/
void?write_command(unsigned?char?com)
{
????LCD_A0->DATA=0;?
????data_send(com);
}
/*?
?*?===??FUNCTION??======================================================================
?*?????????Name:??write_data
?*??Description:??
?*?=====================================================================================
?*/
void?write_data(unsigned?char?dat)
{
????LCD_A0->DATA?=?1;
????data_send(dat);
}
/*?
?*?===??FUNCTION??======================================================================
?*?????????Name:??clear
?*??Description:??
?*?=====================================================================================
?*/
void?clear(void)
{
????int?seg;
????int?page;
????for(page=0xb0;page<0xb8;page++){
????????write_command(page);
????????write_command(0x10);
????????write_command(0x00);
????????for(seg=0;seg<128;seg++){
????????????write_data(0);?
????????}
????}
}
/*?
?*?===??FUNCTION??======================================================================
?*?????????Name:??draw_screen
?*??Description:??
?*?=====================================================================================
?*/
voi
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????5558??2013-03-08?11:52??lcd.c
-----------?---------??----------?-----??----
?????????????????5558????????????????????1
評論
共有 條評論