HT1621汇编程序示例、C程序示例
LCDADD EQU 22H LCDMM EQU 23H gnd equ p1.2 vdd equ p1.3 DATAB EQU P1.4 WRPIN EQU P1.5 CSPIN EQU P1.6 ORG 0000H LJMP MAIN ORG 0003H LJMP LINT0 ORG 0100H MAIN:clr gnd setb vdd SETB DATAB SETB WRPIN SETB CSPIN MOV LCDMM,#01H LCALL LCDCM MOV LCDMM,#03H LCALL LCDCM MOV LCDMM,#29H LCALL LCDCM MOV LCDMM,#04H LCALL LCDCM LOOP3: MOV DPTR, #0300H LCALL WRCOM lcall DLY100 MOV DPTR, #0310H LCALL WRCOM LJMP MAIN LCDCM: CLR CSPIN MOV A, #80H MOV R7, #03H LCM1: RLC A MOV DATAB,C NOP CLR WRPIN NOP NOP NOP SETB WRPIN DJNZ R7, LCM1 MOV R7, #08H MOV A, LCDMM LCM2: RLC A MOV DATAB,C NOP CLR WRPIN NOP NOP NOP NOP SETB WRPIN NOP NOP NOP DJNZ R7, LCM2 NOP NOP NOP NOP CLR DATAB NOP CLR WRPIN NOP NOP NOP NOP SETB WRPIN NOP NOP NOP NOP SETB CSPIN NOP NOP NOP NOP SETB DATAB RET WRCOM: CLR CSPIN MOV R7, #03H ;101 MOV A, #0A0H LWR1: RLC A MOV DATAB,C NOP CLR WRPIN NOP NOP NOP SETB WRPIN NOP NOP DJNZ R7, LWR1 MOV R7, #06H ;6 addres MOV A, #00H LWR2: RLC A MOV DATAB, C NOP NOP NOP NOP NOP CLR WRPIN NOP NOP NOP NOP NOP SETB WRPIN NOP NOP call DLY50 call DLY50 call DLY50 DJNZ R7, LWR2 MOV R2, #70H LOOP7:MOV A, #00H MOVC A, @A+DPTR MOV R7, #08H INC DPTR LCM3: RRC A MOV DATAB, C NOP CLR WRPIN NOP NOP NOP NOP lcall DLY50 call DLY50 call DLY50 call DLY50 SETB WRPIN NOP DJNZ R7, LCM3 DJNZ R2, LOOP7 NOP SETB CSPIN NOP SETB DATAB NOP RET DLY50:MOV R3,#01H DL511:MOV R4,#0DH DL522:MOV R6,#0AFH DL533:DJNZ R6,DL533 DJNZ R4,DL522 DJNZ R3,DL511 RET DLY100:MOV R3,#0aH DL111:MOV R4,#0FFH DL222:MOV R6,#0FFH DL333:DJNZ R6,DL333 DJNZ R4,DL222 DJNZ R3,DL111 RET LINT0:NOP NOP NOP NOP RETI ORG 0300H DB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH DB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH,0FFH DB 0AAH,0AAH,0AAH,0AAH,0AAH,0AAH,0AAH,0AAH DB 0AAH,0AAH,0AAH,0AAH,0AAH,0AAH,0AAH,0AAH DB 055H,055H,055H,055H,055H,055H,055H,055H DB 055H,055H,055H,055H,055H,055H,055H,055H DB 088H,088H,088H,088H,088H,088H,088H,088H DB 088H,088H,088H,088H,088H,088H,088H,088H DB 044H,044H,044H,044H,044H,044H,044H,044H DB 044H,044H,044H,044H,044H,044H,044H,044H DB 022H,022H,022H,022H,022H,022H,022H,022H DB 022H,022H,022H,022H,022H,022H,022H,022H DB 011H,011H,011H,011H,011H,011H,011H,011H DB 011H,011H,011H,011H,011H,011H,011H,011H END ORG 0310H DB 00H,00H,00H,00H,00H,00H,00H,00H DB 00H,00H,00H,00H,00H,00H,00H,00H END