|
1.LCD驅(qū)動(dòng)器1621 HT1621為128(32×4)段LCD驅(qū)動(dòng)器。它可設(shè)置為1/2或1/3偏置且通過(guò)S/W配置設(shè)置為2,3或4個(gè)共用的LCD驅(qū)動(dòng)器。這使得HT1621適于多LCD應(yīng)用。LCD驅(qū)動(dòng)時(shí)鐘
圖5.6 HT1621功能框圖 從系統(tǒng)時(shí)鐘內(nèi)產(chǎn)生,一般為256KHZ。圖5.6為HT1621功能框圖 2.EM78X56與HT1621接口 EM78X56與HT1621接口只須四條線。CS線用以初始化串行接口電路且終止EM78X56與HT1621的通信。若CS=1,EM78X56及HT1621間發(fā)送的命令首先被禁止即而進(jìn)行初始化。在模式命令或模式轉(zhuǎn)換發(fā)出前,需要一高電平脈沖以初始化HT1621的串行接口,數(shù)據(jù)的讀/寫(xiě)及命令的寫(xiě)人必須通過(guò)數(shù)據(jù)線。RD為輸入,RAM內(nèi)的數(shù)據(jù)在RD信號(hào)的下降沿同步送出至數(shù)據(jù)線上。這使EM78X56可以在RD信號(hào)的升沿及下一個(gè)下降沿到來(lái)期間讀人正確的數(shù)據(jù)。WR為寫(xiě)輸入,數(shù)據(jù)線上的數(shù)據(jù)、地址及命令將在WR信號(hào)上升寫(xiě)入HT1621。一條可選擇的IRQ線也可用作EM78X56及HT1621間的接口。 1. 讀/寫(xiě)命令時(shí)序控制及命令集
| Command Code | D/C | Function | READ | 110 a5 a4 a3 a2 a1 a0 d0 d1 d2 d3 | D | Read data in the RAM | WRITE | 101 a5 a4 a3 a2 a1 a0 d0 d1 d2 d3 | D | Write data to the RAM | READ MODIFY WRITE | 101 a5 a4 a3 a2 a1 a0 d0 d1 d2 d3 | D | READ and WRITE to RAM | SYS DIS | 100000000000X | C | Turn off bth system oscillator And LCD blas generator | SYS EN | 100000000001X | C | Turn on system oscillator | LCD OFF | 100000000010X | C | Turn off LCD blas generator | LCD ON | 100000000011X | C | Turn on LCD bias generator | XTAL 32K | 1000000101XXX | C | System clock source,crystal oscillator | BIAS 1/2 | 1000010abX0X | C | LCD 1/2 bias sption ab=00:2 commons option ab=01:3 commons option ab=10:4 commons option | BIAS 1/3 | 1000010abX1X | C | LCD 1/2 bias sption ab=00:2 commons option ab=01:3 commons option ab=10:4 commons option |
4. 應(yīng)用電路 圖 5.7 HT1621應(yīng)用框圖 5. 編程示例
R1 EQU 0X01 R2 EQU 0X02 R3 EQU 0X03 IOC5 EQU 0X05 IOC6 EQU 0X06 PORT5 EQU 0X05 PORT6 EQU 0X06 IOCB EQU 0X0B IOCC EQU 0X0C IOCD EQU 0X0D IOCE EQU 0X0E IOCF EQU 0X0F S1 EQU 0X10 S2 EQU 0X11 S3 EQU 0X12 S4 EQU 0X13 S5 EQU 0X14 S6 EQU 0X15 S7 EQU 0X16 S8 EQU 0X17 S8S7 EQU 0X18 S9 EQU 0X19 S10 EQU 0X1A COMMAND EQU 0X1B R_LOOP EQU 0X1C S_LOOP EQU 0X1D SEG0 EQU 0X1E SEG1 EQU 0X1F SEG2 EQU 0X20 SEG3 EQU 0X21 SEG4 EQU 0X22 SEG5 EQU 0X23 SEG6 EQU 0X24 SEG7 EQU 0X25 SEG8 EQU 0X26 SEG9 EQU 0X27 SEG10 EQU 0X28 LCD_MAP EQU 0X29 LCDRAM EQU 0X2A KEY2 EQU 0X2B KEY7 EQU 0X2C KEY_SX EQU 0X2D LP_CNT0 EQU 0X2E LP_CNT1 EQU 0X2F
ORG 0X000 JMP MAIN NOP MAIN: CLRA ;P50-P53 SET TO OUTPUT IOW IOC5 IOW IOCE MOV A,@0B11110000 ;P60-P63 SET TO OUTPUT IOW IOC6 ;P64-P67 SET TO INPUT MOV A,@0X0F MOV PORT5,A ;P50-P53 RESET TO 1 CLR PORT6 ;P60-P63 RESET TO 0 BC PORT5,0 ;RESET 1621 INTERFACE BS PORT5,0 BC PORT5,0 BS PORT5,0 ;P50 SET TO 1,/CS=1 MOV A,@0B11100011 ;COMMAND TNORMAL MOV COMMAND,A CALL C_WRITE MOV A,@0B10000000 ;COMMAND /IRQ DIS MOV COMMAND,A CALL C_WRITE MOV A,@0B00010100 ;COMMAND XTAL32K MOV COMMAND,A CALL C_WRITE MOV A,@0B00101001 ;COMMAND BIAS1/3,4 COM MOV COMMAND,A CALL C_WRITE MOV A,@0B00001000 ;COMMAND TONE OFF MOV COMMAND,A CALL C_WRITE MOV A,@0B00000101 ;COMMAND WDT DIS MOV COMMAND,A CALL C_WRITE MOV A,@0B00000100 ;COMMAND TIMER DIS MOV COMMAND,A CALL C_WRITE MOV A,@0B00000001 ;COMMAND SYS_EN MOV COMMAND,A CALL C_WRITE MOV A,@0B00000011 ;COMMAND LCD_ON MOV COMMAND,A CALL C_WRITE MOV A,@0X0FF ;LCD MAP SET TO 1 MOV SEG0,A MOV SEG2,A MOV SEG3,A MOV SEG4,A MOV SEG5,A MOV SEG6,A MOV SEG7,A MOV SEG8,A MOV SEG9,A MOV SEG10,A CLR LCD_MAP ;FIRST MAP ADD IS 0 CALL LCD_WRITE ;DISPLAY ALL SEGS (BREAK): LCD_OFF: CLR COMMAND ;TURN OFF LCD SYSTEM CALL C_WRITE C_WRITE: MOV A,@0X08 MOV R_LOOP,A BS PORT5,2 ;/WR=1 BC PORT5,0 ;/CS=0 BC PORT5,2 ;/WR=0 BS PORT5,3 ;DATA=1 BS PORT5,2 ;/WR=1 BC PORT5,2 ;/WR=0 BC PORT5,3 ;DATA=0 BS PORT5,2 ;/WR=1 BC PORT5,2 ;/WR=0 BC PORT5,3 ;DATA=0 BS PORT5,2 ;/WR=1 BC PORT5,2 ;/WR=0 C8_C1_WRITE: JBC COMMAND,7 ;COMMAND,7=0 JMP SET_DATA_1 BC PORT5,3 ;DATA=0 JMP NEXT_1 SET_DATA_1: BS PORT5,3 ;DATA=1 NEXT_1: RLC COMMAND BS PORT5,2 ;/WR=1 BC PORT5,2 ;/WR=0 DJZ R_LOOP JMP C8_C1_WRITE BC PORT5,3 ;DATA=0 BS PORT5,2 ;/WR=1 BS PORT5,0 ;/CS=1 RET LCD_WRITE: BS PORT5,2 ;/WR=1 BC PORT5,0 ;/CS=0 BC PORT5,2 ;/WR=0 BS PORT5,3 ;DATA=1 BS PORT5,2 ;/WR=1 BC PORT5,2 ;/WR=0 BC PORT5,3 ;DATA=0 BS PORT5,2 ;/WR=1 BC PORT5,2 ;/WR=0 BS PORT5,3 ;DATA=1 BS PORT5,2 ;/WR=1 BC PORT5,2 ;/WR=0 ;WRITE THE LCD MEMORY ADD 00 BC PORT5,3 ;DATA=0, 1 BS PORT5,2 ;/WR=1 BC PORT5,2 ;/WR=0 ;DATA=0, 2 BS PORT5,2 ;/WR=1 BC PORT5,2 ;/WR=0 ;DATA=0, 3 BS PORT5,2 ;/WR=1 BC PORT5,2 ;/WR=0 ;DATA=0, 4 BS PORT5,2 ;/WR=1 BC PORT5,2 ;/WR=0 ;DATA=0, 5 BS PORT5,2 ;/WR=1 BC PORT5,2 ;/WR=0 ;DATA=0, 6 BS PORT5,2 ;/WR=1 MOV A,SEG0 MOV LCDRAM,A ;SEG0 CALL LCDDATA_W MOV A,SEG1 MOV LCDRAM,A ;SEG1 CALL LCDDATA_W MOV A,SEG2 MOV LCDRAM,A ;SEG2 CALL LCDDATA_W MOV A,SEG3 MOV LCDRAM,A ;SEG3 CALL LCDDATA_W MOV A,SEG4 MOV LCDRAM,A ;SEG4 CALL LCDDATA_W MOV A,SEG5 MOV LCDRAM,A ;SEG5 CALL LCDDATA_W MOV A,SEG6 MOV LCDRAM,A ;SEG6 CALL LCDDATA_W MOV A,SEG7 MOV LCDRAM,A ;SEG7 CALL LCDDATA_W MOV A,SEG8 MOV LCDRAM,A ;SEG8 CALL LCDDATA_W MOV A,SEG9 MOV LCDRAM,A ;SEG9 CALL LCDDATA_W MOV A,SEG10 MOV LCDRAM,A ;SEG10 CALL LCDDATA_W BS PORT5,0 ;/CS=1 RET LCDDATA_W: MOV A,@0X04 ;RAM DATA WRITE MOV R_LOOP,A DATA_W JBC LCDRAM,0 JMP RAM_SET BC PORT5,3 ;DATA=0 JMP NEXT_3 RAM_SET: BS PORT5,3 ;DATA=1 NEXT_3: RRC LCDRAM BS PORT5,2 ;/WR=1 BC PORT5,2 ;/WR=0 DJZ R_LOOP JMP DATA_W RET EOP
|