LCD驱动HT1621#include <reg51.h>#include <types.h>#include <intrins.h>#include <bin.h>extern BOOL PIN_1621_CS;extern BOOL PIN_1621_DAT;extern BOOL PIN_1621_WR;#define CLK_DELAY() {_nop_(); _nop_(); _nop_();}//--------------------------------------------------------------------------// Name: Write_1621_RAM//--------------------------------------------------------------------------void Write_1621_RAM(BYTE addr, BYTE idata *buf, BYTE size){BYTE i,j;BYTE tmp;PIN_1621_CS = 1; // clear CSCLK_DELAY();PIN_1621_CS = 0; // clear CS// CMD - 101tmp = B0000_0101;for (i=3; i>0; --i){PIN_1621_DAT = tmp & 0x04; tmp <<= 1;PIN_1621_WR = 0; CLK_DELAY();PIN_1621_WR = 1; CLK_DELAY();}// Addr - 0x00tmp = addr & B0011_1111;for (i=6; i>0; --i){PIN_1621_DAT = tmp & 0x04; tmp <<= 1;PIN_1621_WR = 0; CLK_DELAY();PIN_1621_WR = 1; CLK_DELAY();}// data - successive 32 bytesfor (j=size; j>0; --j){tmp = *buf;for (i=8; i>0; --i){PIN_1621_DAT = tmp & 0x01; tmp >>= 1;PIN_1621_WR = 0; CLK_DELAY();PIN_1621_WR = 1; CLK_DELAY();}buf ++;}}
猜您喜欢
评论