muß im Prg eingefügt werden LCD_PORT Equ P0 ;Datenleitung auf Port 2 LCD_WR Equ P2.5 ;Schreibleitung LCD_RD Equ P2.4 ;Leseleitung LCD_CD Equ P2.6 ;Schreibleitung LCD_RST Equ P2.3 ;Leseleitung ;Belegung int. Ram segment data org 010H ;A/D-Wandler LCD_CMD ds 1 LCD_DATA ds 2 ;------------------------------------------------------------------- ;LCD_CS auf Dauer Low-Pegel setzen, keine Ansteuerung durch Prg. ;LCD_FS auf Dauer High-Pegel setzen, keine Ansteuerung durch Prg. ;------------------------------------------------------------------- INIT_LCD: setb LCD_RST setb LCD_WR setb LCD_RD setb LCD_CD clr LCD_RST nop nop nop nop nop nop nop nop setb LCD_RST mov LCD_DATA+0,#0 ;Text Home Adresse mov LCD_DATA+1,#0 mov LCD_CMD,#040H call SDATA call SCMD mov LCD_DATA+0,#010H;Text Area mov LCD_DATA+1,#0 mov LCD_CMD,#041H call SDATA call SCMD mov LCD_DATA+0,#00H ;Grafik Home Adresse mov LCD_DATA+1,#002H mov LCD_CMD,#042H call SDATA call SCMD mov LCD_DATA+0,#010H ;Grafik Area mov LCD_DATA+1,#0 mov LCD_CMD,#043H call SDATA call SCMD mov LCD_CMD,#080H ;Mode Set call SCMD mov LCD_DATA+0,#002H;Offset mov LCD_DATA+1,#000H mov LCD_CMD,#022H call SDATA call SCMD mov LCD_CMD,#09CH ;Text an, Grafik an call SDATA call SCMD mov LCD_DATA+0,#000H;Adress Pointer mov LCD_DATA+1,#000H mov LCD_CMD,#024H call SDATA call SCMD call CLR_LCDRAM ret SCMD: call STATUS ;sendet Commando mov LCD_PORT,LCD_CMD;an das Display setb LCD_CD clr LCD_WR setb LCD_WR ret SDATA: call STATUS mov LCD_PORT,LCD_DATA+0 clr LCD_CD clr LCD_WR setb LCD_WR SDATA_1: call STATUS mov LCD_PORT,LCD_DATA+1 clr LCD_CD clr LCD_WR setb LCD_WR ret SAWM: call STATUS_AM mov LCD_PORT,LCD_DATA+1 clr LCD_CD clr LCD_WR setb LCD_WR ret STATUS: mov P0,#0FFH STAT_1: setb LCD_CD clr LCD_RD mov A,LCD_PORT setb LCD_RD anl A,#3 cjne A,#3,STAT_1 ret STATUS_AM: mov P0,#0FFH STAT_2: setb LCD_CD clr LCD_RD mov A,LCD_PORT setb LCD_RD anl A,#8 cjne A,#8,STAT_2 ret CLR_LCDRAM: mov R0,#01FH mov R1,#0FFH mov LCD_DATA+0,#0 mov LCD_DATA+1,#0 mov LCD_CMD,#024H call SDATA call SCMD mov LCD_CMD,#0B0H call SCMD CLR_LCDRAM_0: mov LCD_DATA+1,#0 call SAWM djnz R1,CLR_LCDRAM_0 mov R1,#0FFH djnz R0,CLR_LCDRAM_0 mov LCD_CMD,#0B2H call SCMD ret STEXT: mov LCD_CMD,#024H call SDATA call SCMD mov LCD_CMD,#0B0H call SCMD STEXT_1: clr A movc A,@A+DPTR jz ETEXT clr C subb A,#020H mov LCD_DATA+1,A call SAWM inc DPTR ljmp STEXT_1 ETEXT: mov LCD_CMD,#0B2H call SCMD ret BSEND: mov LCD_DATA+1,A ;Sendet ein Byte und erh”ht call SDATA_1 ;den Adress-Pointer mov LCD_CMD,#0C0H call SCMD ;Daten-Highbyte senden ret Displ_Hex8: ;LCD_DATA=Adresse R0:Zahl ;stellt 8bit-Hex-Zahl dar mov LCD_CMD,#024H call SDATA call SCMD mov A,R0 swap A call Displ_Hex_Ziffer mov A,R0 call Displ_Hex_Ziffer ret Displ_Hex_Ziffer: ;stellt 4bit-Hex_Zahl im L-Nibble des Akku dar anl A,#00001111b clr C subb A,#0Ah jc Displ_Hex_Ziffer0 add A,#7 Displ_Hex_Ziffer0: add A,#03Ah clr C subb A,#020H call BSEND ret Displ_Zahl: ;A:DD RAM Adr (Display-Position), R0:Zahl mov LCD_CMD,#024H call SDATA call SCMD mov A,R0 mov B,#100 div AB jz Displ_Zahl1 add A,#010h call BSEND Displ_Zahl1: mov A,#10 xch A,B div AB jz Displ_Zahl2 add A,#010h call BSEND Displ_Zahl2: mov A,B add A,#010h call BSEND ret ret