;---CPU: Siemens 80C535 @12MHz ;---Pinbelegungen: ;---RS:Port 1.0 ;---R/W:Port 1.1 ;---E:Port 1.2 ;---DB4/0:Port 1.3 ;---DB5/1:Port 1.4 ;---DB6/2:Port 1.5 ;---DB7/3:Port 1.6 ;mail to: dirk_schnitzler@web.de ; ; ;___________________________________________________________________ lcddata EQU 30h ; ORG 0 jmp main ; main: call initdisp call delay41 mov lcddata,#'a' mov r3,#5 m1: call lcddout ;5x a ausgeben call delay41 djnz r3,m1 ; jmp $ ; ;___________________________________________________________________ ;Sendet DATEN nibbleweise an das LCD-Display lcddout: push acc mov a,lcddata rr a ;msb->acc.6 clr acc.2 ;LCD-Enable=0 setb acc.0 ;LCD-RS=1 clr acc.1 ;LCD-RW=0 mov p1,a call lcd_en call delay41 ;2. Nibble senden, dazu mehrmals im Akku rotieren. mov a,lcddata rl a ;msb->acc.4 rl a ;msb->acc.5 rl a ;msb->acc.6 clr acc.2 ;LCD-Enable=0 setb acc.0 ;LCD-RS=1 clr acc.1 ;LCD-RW=0 mov p1,a call lcd_en call delay41 pop acc; ; ;___________________________________________________________________ ;Sendet KOMMANDOS nibbleweise an das LCD-Display lcdcout: push acc mov a,lcddata rr a ;msb->acc.6 clr acc.2 ;LCD-Enable=0 clr acc.0 ;LCD-RS=0 clr acc.1 ;LCD-RW=0 mov p1,a call lcd_en call delay41 ;2. Nibble senden, dazu mehrmals im Akku rotieren. mov a,lcddata rl a ;msb->acc.4 rl a ;msb->acc.5 rl a ;msb->acc.6 clr acc.2 ;LCD-Enable=0 clr acc.0 ;LCD-RS=0 clr acc.1 ;LCD-RW=0 mov p1,a call lcd_en call delay41 pop acc ; ;___________________________________________________________________ initdisp: push 00h mov p1,#0 mov r0,#8 initd1: call delay41 ;Warte 33ms nach POR djnz r0,initd1 ; ; mov p1,#24 ;DB4,5=1 call lcd_en ;E=0-1-0 ; call delay41 call delay41 call delay41 call delay41 ; call lcd_en ; ; call delay41 call delay41 call delay41 ; call lcd_en ; call delay40 ; call delay41 ; mov p1,#16 ;Function-Set:DB5=1 call lcd_en ;E=0-1-0 call delay41 call delay41 call delay41 call delay41 call delay41 ; ;Ab hier: 4-Bit-Interface! ; mov p1,#16 call lcd_en ; mov p1,#64 ;NLINES(DB7)=1,FONT(DB6)=0 call lcd_en ; call delay41 call delay41 call delay41 call delay41 call delay41 ; mov p1,#0 call lcd_en ; mov p1,#120 ;Display an, Cursor an, Blink an call lcd_en ; call delay41 call delay41 call delay41 call delay41 call delay41 call delay41 ; mov p1,#0 call lcd_en ; mov p1,#8 ;Display löschen call lcd_en ; call delay41 call delay41 call delay41 call delay41 call delay41 call delay41 ; mov p1,#0 call lcd_en ; mov p1,#48 ;Entry-Mode: Increment, shift off call lcd_en ; call delay41 call delay41 call delay41 call delay41 call delay41 ; pop 00h ret ; ;___________________________________________________________________ ;Erzeugt eine High->Low-Flanke auf der Enable-Leitung lcd_en: nop nop nop setb p1.2 ;Enable call delay40 clr p1.2 ;Disable nop nop nop nop nop ret ; ;___________________________________________________________________ ;Erzeugt eine Verzoegerung von >4,1ms delay41: push 00h push 01h mov r0,#82 dell41: mov r1,#52 dell41a: djnz r1,dell41a djnz r0,dell41 pop 01h pop 00h ret ; ;___________________________________________________________________ ;Erzeugt eine Verzoegerung von >41us delay40: push 00h mov r0,#45 del40a: djnz r0,del40a pop 00h ret ;___________ END