Hi,
Da Displays ja immer sehr beliebt hier mal eine kleine Ansteuerung für das DG-16080 welches es für knapp 7eur bei Pollin gibt.
Das Display hat einige nette Vorteile der Zeichensatz z.b. ist ASCII Kompatibel und es kann 10x27 Zeichen oder halt 160x80px im Grafigmode.
Auch das senden ist recht einfach man setzt die Startadresse und kann dann solange Zeichen senden wie man möchte.
Der code ist für Textmode/Grafigmode und läuft in beiden nach den gleichen Muster (Start Addy setzen und senden)
Ansteuerung für den Touch liefere ich noch nach der will noch nicht so recht.
Komplettes Projekt(Piklab):
http://www.mikrocontroller.net/attachment/65669/dg-16080.tar.gzSenden:
movlw 0x00
movwf adrl ; LOW ADR
movlw 0x00
movwf adrh ; High ADR
call disp_send_char ; Adressregister setzen und vorbereiten zum Daten schreiben
movlw B'01001000' ; H
call disp_send_d
movlw B'01100001' ; a
call disp_send_d
movlw B'01110101' ; u
call disp_send_d
Display Anschlüsse:
#define RS PORTC, 0 ; Display Command(H)/DATA(L)
#define RW PORTC, 2 ; Display Read(H)/Write(L)
#define E PORTC, 3 ; Display Enable
#define CS PORTC, 4 ; Display Chip Enable(L)
#define WDATA PORTB ; Display Datenport (PORTB)
#define YM PORTA, 3 ; Touch y- ADC
#define YP PORTA, 2 ; Touch y+ PWR
#define XP PORTA, 4 ; Touch x+ PWR
#define XM PORTA, 1 ; Touch x- ADC
dg-16080.inc
disp_init ; Display Inialisieren
bcf RW ; Startbedinungen herstellen
nop
bcf CS
movlw 0x00 ; Mode Control REG
call disp_send_c ; Send Command
movlw b'00111000' ; DB5=ON/OFF, DB4=Master/Slave, DB3=Blink, DB2=Coursor, DB1/DB0=TEXT(00)/GRAFIG(10)
call disp_send_d ; Send Data
movlw 0x01 ; Character Pitch REG
call disp_send_c ; Send Command
movlw 0x75 ; 7x8px
call disp_send_d ; Send Data
movlw 0x02 ; Nummer oh Char REG
call disp_send_c ; Send Command
movlw D'26' ; Anzahl horit. Zeichen -1
call disp_send_d ; Send Data
movlw 0x03 ; Display Duty REG
call disp_send_c ; Send Command
movlw 0x4F ; Display Duty
call disp_send_d ; Send Data
movlw 0x04 ; Cursor Position REG
call disp_send_c ; Send Command
movlw D'7' ; Curserstrich y-Pos -1
call disp_send_d ; Send Data
return
disp_send_c ; Send Command
bsf RS
movwf WDATA
bsf E
nop
bcf E
call delay_10_µs
return
disp_send_d ; Send DATA
bcf RS
movwf WDATA
bsf E
nop
bcf E
call delay_10_µs
return
disp_cls ; Display Löschen Textmode
movlw 0x0A ; Low Reg
call disp_send_c
movlw 0x00 ; Low Adr
call disp_send_d
movlw 0x0B ; High Reg
call disp_send_c
movlw 0x00 ; High Adr
call disp_send_d
movlw 0x0C ; DATA REG
call disp_send_c
movlw D'65'
movwf count
disp_cls_loop
movlw B'00100000' ; 65x5
call disp_send_d
call disp_send_d
call disp_send_d
call disp_send_d
call disp_send_d
decfsz count,1
goto disp_cls_loop
return
disp_send_char ; Zeichen senden (ADRL,ADRH,Char)
movlw 0x0A ; Low Reg
call disp_send_c
movf adrl,w ; Low Adr
call disp_send_d
movlw 0x0B ; High Reg
call disp_send_c
movf adrh,w ; High Adr
call disp_send_d
movlw 0x0C ; DATA REG
call disp_send_c
return