资讯详情

ST7529和ST7586S的源代码(AVR单片机程序)

整理下前阵子的心得,ST7529和ST7586S的驱动体会。的PDF文档网上都能搜索到。 单片机都是AVR 的64A 点上土匪头像,98*98像素。吟湿一首,好湿啊好湿

//PIN7-PIN14 ---> DB0-DB7--->PF0-PF7 //PIN16 LED-K ---> PA7 //PIN15 /RST ---> PD4 //PIN6 /RD ---> PA3 //PIN5 /WD ---> PA4 //PIN4 RS ---> PA5 //PIN3 /CS ---> PA6 #define DATA_IO_INIT() { F=0xFF;PORTF=0x00;} #define _RST_ON() {DDRD|=BIT(4);PORTD&=~BIT(4);} #define LCD_RST_OFF() {DDRD|=BIT(4);PORTD|=BIT(4);} #define LCD_RS_LOW_COMMAND() {DDRA|=BIT(5);PORTA&=~BIT(5);} #define LCD_RS_HIGH_DATA() {DDRA|=BIT(5);PORTA|=BIT(5);} #define LCD_RD_LOW() {DDRA|=BIT(3);PORTA&=~BIT(3);} #define LCD_RD_HIGH() {DDRA|=BIT(3);PORTA|=BIT(3);} #define LCD_WR_LOW() {DDRA|=BIT(4);PORTA&=~BIT(4);} #define LCD_WR_HIGH() {DDRA|=BIT(4);PORTA|=BIT(4);} #define LCD_CS_LOW_ON() {DDRA|=BIT(6);PORTA&=~BIT(6);} #define LCD_CS_HIGH_OFF() {DDRA|=BIT(6);PORTA|=BIT(6);} #define LCD_LED_ON() {DDRA|=BIT(7);PORTA|=BIT(7);} #define LCD_LED_OFF() {DDRA|=BIT(7);PORTA&=~BIT(7);} /************************************************************** EXPLAIN: DEFINE FOR ST7529 DRIVER ***************************************************************/ #define EXT_IN 0x30 //(P=0 )Ext=0 Set #define EXT_OUT 0x31 //(P=0 )Ext=1 Set #define DISON 0xaf //(P=0 )Display On #define DISOFF 0xae //(P=0 )Display Off #define DISNOR 0xa6 //(P=0 )Normal Display #define DISINV 0xa7 //(P=0 )Inverse Display #define COMSCN 0xbb //(P=1 )COM Scan Direction #define DIS L 0xca //(P=3 )Display Control #define SLPIN 0x95 //(P=0 )Sleep In #define SLPOUT 0x94 //(P=0 )Sleep Out #define LASET 0x75 //(P=2 )Line Address Set #define CASET 0x15 //(P=2 )Column Address Set #define DATSDR 0xbc //(P=3 )Data Scan Direction #define RAMWR 0x5c //(P=N )Writing to Memory #define RAMRD 0x5d //(P=N )Reading from Memory #define PTLIN 0xa8 //(P=2 )Partial display in #define PTLOUT 0xa9 //(P=0 )Partial display out #define RMWIN 0xe0 //(P=0 )Read and Modify Write #define RMWOUT 0xee //(P=0 )RMW end #define A ET 0xaa //(P=4 )Area Scroll Set #define SCSTART 0xab //(P=1 )Scroll Start Set #define OSCON 0xd1 //(P=0 )Internal OSC on #define OSCOFF 0xd2 //(P=0 )Internal OSC off #define PWRCTRL 0x20 //(P=1 ) Control #define VOLCTRL 0x81 //(P=2 )EC control #define VOLUP 0xd6 //(P=0 )EC increase 1 #define VOLDOWN 0xd7 //(P=0 )EC decrease 1 #define RESERVED 0x82 //(P=0 )Not Use #define EPSRRD1 0x7c //(P=0 )READ Register1 #define EPSRRD2 0x7d //(P=0 )READ Register2 //#define NOP 0x25 //(P=0 )NOP Instruction //#define STREAD //(P=0 )Status Read #define EPINT 0x07 //(P=1 )Initial code(1) //Ext =1 #define GRAY1SET 0x20 //(P=16) E 1 Gray PWM Set #define GRAY2SET 0x21 //(P=16)FRAME 2 Gray PWM Set #define ANASET 0x32 //(P=3 )Analog Circuit Set #define SWINT 0x34 //(P=0 )Software Initial #define E IN 0xcd //(P=1 )Control #define EPCOUT 0xcc //(P=0 )Cancel EEPROM #define EPMWR 0xfc //(P=0 )Write to EEPROM #define EPMRD 0xfd //(P=0 )Read from EEPROM //***************************************** //***************************** #define LCM_SEG_MAX 255 #define LCM_COM_MAX 160 #define LCM_PAG_MAX 9 #define LCM_SEG_USE 240 #define LCM_COM_USE 160 #define LCM_PAG_USE 8 #define LCM_RATIO 1 #define LCM_VOP 2 #define LCM_STR_COM 0 #define LCM_STR_SEG 4 #define LCM_STR_PAG 0 #define LCM_COM_DIR 1 //0表示反向扫描,1表示正向扫描 #define LCM_SEG_DIR 1 //0表示反向扫描,1表示正向扫描 /***************************** 要显示的数据取模方式****************************/ /*从第一行开始向右, 取8个点作为一个字节, 然后从第二行开始向右 取8个点作为第二个字 节...依此类推。如果 最后不足8个点就补满 8位。 取模顺序是从高到低, 即第一个点作为最高位。 如*-------取为 10000000*/ //行列式,顺位,高位在前 //就举一个,用取模软件自己比对吧 const uchar Image24_ceng[]= {0x00,0x00,0x01,0x00,0x00,0x08,0x0F,0x0A,0x09,0x08,0x08,0x08,0x0F,0x00,0x02,0x03,0x02,0x02,0x03,0x02,0x02,0x03,0x02,0x00, 0x00,0x00,0x01,0xC1,0xC2,0x04,0xFB,0x18,0x99,0x99,0x9A,0x1C,0xE3,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00,0xFF,0x00,0x00, 0x00,0x00,0x80,0x00,0x00,0x18,0xF0,0x90,0x90,0x10,0x10,0x10,0xF0,0x00,0xC0,0x40,0x40,0x40,0xC0,0x40,0x40,0xC0,0x40,0x00};/*"曾",0*/ /*******************************LCD写命令**********************************/ void LCD_Cmd_Write(unsigned char cmd) { LCD_RS_LOW_COMMAND(); LCD_RD_HIGH(); /*LCD_ChkBusy();*/ //Call LCD_ChkBusy to Check Busy Bit LCD_WR_LOW(); NOP(); NOP(); DDRF = 0xFF; PORTF = cmd; LCD_CS_LOW_ON(); NOP(); NOP(); LCD_WR_HIGH(); Some_NOP(3); LCD_CS_HIGH_OFF(); } /*****************************LCD写数据**********************************/ void LCD_Data_Write(unsigned char data) { /*LCD_ChkBusy(); */ //Call LCD_ChkBusy to Check Busy Bit DDRF = 0xFF; LCD_RS_HIGH_DATA(); LCD_RD_HIGH(); PO
锐单商城拥有海量元器件数据手册IC替代型号,打造 电子元器件IC百科大全!

 锐单商城 - 一站式电子元器件采购平台  

 深圳锐单电子有限公司