Pic assembly code for EADOG graphic display (ST7565)

jpanhalt

Joined Jan 18, 2008
11,087
I am using the ST7567, which seems similar on superficial review of its datasheet.

1) Which interface are you using. Mine is serial hardware SPI.
2) Do you need to read the display (including the busy bit)? Can't be done with serial.
3) Do you need line 65? ("logo"). I do not use it.
4) As I recall, the setup was straight forward, except getting the intensity right was the most difficult. It is very sensitive to the settings as I recall.
5) Which series of PIC's? I use the enhanced mid-range.
 

Thread Starter

roxi60

Joined Sep 2, 2018
73
Thank you Ian, jpanhalt.
I managed a code by myself on a basis I found on web by Joe Colquitt, so you see what I intended.
This code is a complete assembly one to display two lines of text on EADOG.
It is possible also to simulate with Labcenter proteus (see attachment).
Not easy to find a complete code on web, at least for me, so hope it can be useful for others.
Regards
Code:
;====================================================================
; Main.asm file generated by New Project wizard
; File:EADOG_asm code
; Created:   dom lug 19 2020
; Processor: PIC18F452
; Compiler:  MPASM (Proteus)
;REV.1_modified according web "F Text on a KS0108 Graphic LCD
;from Joe Colquitt
;REV.2_two rows with subroutine and macro
;PORTB.5 ---> C1SB of EADOG
;PORTB.6 ---> A0 of EADOG
;PORTB.0 ---> GLCD RST of EADOG
;PORTC.3 ---> CLK of EADOG SPI
;PORTC.5 ---> MOSI of EADOG SPI
;====================================================================
; DEFINITIONS
;====================================================================

#include p18f452.inc                ; Include register definition file
CONFIG WDT=OFF
;====================================================================
; VARIABLES
;====================================================================
A0                     equ     06h
SCK                 equ        03h
ch6                 equ     1200h
strings equ     1000h
;====================================================================
; RESET and INTERRUPT VECTORS
;==================================================================== 
RST               code  0x0
lin               res 2
col                     res 2
temp0                res 2
cblock  0x0040
         str_copy:12        
         endc
    goto  Start

;====================================================================
; CODE SEGMENT
;====================================================================

PGM   code
Start

;******************** PROGRAM ORIGIN *****************************************************
;*******************************************************************************************
;-------------------------------------------------------------------------------------------
;-------------------- PORTB AND SPI SETTING ----------------------------------------------
;-------------------------------------------------------------------------------------------
MOVLW 00h
MOVWF TRISB ;SET PORTB AS AN OUTPUT
MOVWF TRISC ;SET PORTC AS AN OUTPUT
    MOVWF PORTC ;CLEAR PORTC
CLRF PCLATH ;ENSURE PCLATH BIT 3 IS CLEARED
    bsf SSPSTAT,CKE
    MOVLW 0x20
MOVWF SSPCON1
;-------------------------------------------------------------------------------------------
;-------------------- PROGRAM ROUTINE ----------------------------------------------------
;-------------------------------------------------------------------------------------------
goto MAIN
INIT
bsf PORTB,0
movlw 0x40
call PutCDM
movlw 0xA1
call PutCDM
    movlw 0xC0
call PutCDM
    movlw 0xA6
call PutCDM  
    movlw 0xA2
call PutCDM
    movlw 0x2F
call PutCDM
    movlw 0xF8
call PutCDM
    movlw 0x00
call PutCDM
    movlw 0x27
    call PutCDM
    movlw 0x81
call PutCDM
    movlw 0x10
call PutCDM
    movlw 0xAC
call PutCDM
    movlw 0x00
call PutCDM
    movlw 0xAF
call PutCDM
    return

pgm_ram  macro   var           ;macro to copy string from ROM to RAM
         movlw   upper(var)    ;load TBLPTR with string address
         movwf   TBLPTRU
         movlw   high(var)
         movwf   TBLPTRH
         movlw   low(var)
         movwf   TBLPTRL
         tblrd*+  
         call    get_txt
         endm
  
get_txt  movf   TABLAT,0      ;get characters until
         btfsc  WREG,7       ;W > 0x7f (ie FF terminator)
         return
         movwf  POSTINC1     ;store in RAM
         TBLRD*+
         bra     get_txt
                                  
golc     movf      lin,w
                        call      PutCDM         ;set row
                        swapf                    col,0                                      
                        andlw                    0x0F
                        iorlw                    0x10  
                        call      PutCDM         ; set coloumn high byte
                        movlw                 0xF
                        andwf                    col,0  
                        call      PutCDM         ; set coloumn low byte
                        return
                              
wrstr movlw 0x00
                        movwf TBLPTRU
                        movlw high(ch6)
                        movwf TBLPTRH
                        movlw low(ch6)
                        movwf TBLPTRL
                        movf POSTINC1,0        
                        btfsc STATUS,2                  
                        goto golc
      addlw   -0x20          
                        mullw   .6             
      movf   PRODL,0           
      addwf   TBLPTRL
      movf   PRODH,0
      addwfc  TBLPTRH
      movlw   .6              
      movwf   temp0
      movlw   0x00            
      call    PutDat
                      
p1_data  TBLRD*+                
         movff      TABLAT,WREG
         call    PutDat         
         decfsz  temp0
         bra     p1_data         
         bra     wrstr         
                                    return      

MAIN
call INIT  
movlw    0xB5
    movwf    lin
    movlw    .10
    movwf    col
    call golc
    lfsr FSR1,str_copy
    pgm_ram pressu
    clrf POSTINC1
    lfsr FSR1,str_copy
    call wrstr
    movlw    0xB7
    movwf    lin
    movlw .10
    movwf    col
    call golc
    lfsr FSR1,str_copy
    pgm_ram tempera
    clrf POSTINC1
    lfsr FSR1,str_copy
    call wrstr

FINISH
GOTO FINISH
;-------------------------------------------------------------------------------------------
;-------------------- TRANSMISSION SUBROUTINE --------------------------------------------
;-------------------------------------------------------------------------------------------

PutCDM
    bcf PORTB,A0
    bcf PORTB,5
MOVWF SSPBUF ;PLACE DATA IN BUFFER TO SEND
LOOP BTFSS SSPSTAT, BF ;CHECK IF TRANSMISSION IS COMPLETE
GOTO LOOP ;
bsf PORTB,5
RETURN ;RETURN FROM SUBROUTINE
;*******************************************************************************************
PutDat
    bsf PORTB,A0
    bcf PORTB,5
MOVWF SSPBUF ;PLACE DATA IN BUFFER TO SEND
LOOPD BTFSS SSPSTAT, BF ;CHECK IF TRANSMISSION IS COMPLETE
GOTO LOOPD ;
bsf PORTB,5
RETURN ;RETURN FROM SUBROUTINE
;*******************************************************************************************
    org strings
pressu     db "Pressure",0xFF
tempera db "Temperature",0xFF

org 0x1200
    db 0x0000,0x0000,0x0000,0x0000,0x0000,0x00        ;space
db 0x0000,0x0000,0x005f,0x0000,0x0000,0x00        ;!
db 0x0000,0x0007,0x0000,0x0007,0x0000,0x00  ;"
db 0x0014,0x007f,0x0014,0x007f,0x0014,0x00  ;#
db 0x0024,0x002a,0x007f,0x002a,0x0012,0x00  ;$
db 0x0023,0x0013,0x0008,0x0064,0x0062,0x00  ;%
db 0x0036,0x0049,0x0055,0x0022,0x0050,0x00  ;&
db 0x0000,0x0005,0x0003,0x0000,0x0000,0x00  ;'
db 0x0000,0x001c,0x0022,0x0041,0x0000,0x00  ;(
db 0x0000,0x0041,0x0022,0x001c,0x0000,0x00  ;)
db 0x0014,0x0008,0x003e,0x0008,0x0014,0x00     ;*
db 0x0008,0x0008,0x003e,0x0008,0x0008,0x00  ;+
db 0x0000,0x0050,0x0030,0x0000,0x0000,0x00  ;,
db 0x0008,0x0008,0x0008,0x0008,0x0008,0x00  ;-
db 0x0000,0x0060,0x0060,0x0000,0x0000,0x00  ;.
db 0x0020,0x0010,0x0008,0x0004,0x0002,0x00  ;/

;ASCII 30 - 3f, 48 - 63

db 0x003e,0x0051,0x0049,0x0045,0x003e,0x00  ;0
db 0x0000,0x0042,0x007f,0x0040,0x0000,0x00  ;1
db 0x0042,0x0061,0x0051,0x0049,0x0046,0x00  ;2
db 0x0021,0x0041,0x0045,0x004b,0x0031,0x00  ;3
db 0x0018,0x0014,0x0012,0x007f,0x0010,0x00  ;4
db 0x0027,0x0045,0x0045,0x0045,0x0039,0x00  ;5
db 0x003c,0x004a,0x0049,0x0049,0x0030,0x00  ;6
db 0x0001,0x0079,0x0005,0x0003,0x0001,0x00  ;7
db 0x0036,0x0049,0x0049,0x0049,0x0036,0x00  ;8
db 0x0006,0x0049,0x0049,0x0029,0x001e,0x00  ;9
db 0x0000,0x0036,0x0036,0x0000,0x0000,0x00  ;:
db 0x0000,0x0056,0x0036,0x0000,0x0000,0x00  ;;
db 0x0008,0x0014,0x0022,0x0041,0x0000,0x00  ;<
db 0x0014,0x0014,0x0014,0x0014,0x0014,0x00  ;=
db 0x0000,0x0041,0x0022,0x0014,0x0008,0x00  ;>
db 0x0002,0x0001,0x0051,0x0009,0x0006,0x00  ;?

;ASCII 40 - 4f, 64 - 79

db 0x0032,0x0049,0x0079,0x0041,0x003e,0x00  ;@
db 0x007e,0x0011,0x0011,0x0011,0x007e,0x00  ;A
db 0x007f,0x0049,0x0049,0x0049,0x0036,0x00  ;B
db 0x003e,0x0041,0x0041,0x0041,0x0022,0x00  ;C
db 0x007f,0x0041,0x0041,0x0022,0x001c,0x00  ;D
db 0x007f,0x0049,0x0049,0x0049,0x0041,0x00  ;E
db 0x007f,0x0009,0x0009,0x0009,0x0001,0x00  ;F
db 0x003e,0x0041,0x0049,0x0049,0x007a,0x00  ;G
db 0x007f,0x0008,0x0008,0x0008,0x007f,0x00  ;H
db 0x0000,0x0041,0x007f,0x0041,0x0000,0x00  ;I
db 0x0020,0x0041,0x0041,0x003f,0x0001,0x00  ;J
db 0x007f,0x0008,0x0014,0x0022,0x0041,0x00  ;K
db 0x007f,0x0040,0x0040,0x0040,0x0040,0x00  ;L
db 0x007f,0x0002,0x00c0,0x0002,0x007f,0x00  ;M
db 0x007f,0x0004,0x0008,0x0010,0x007f,0x00  ;N
db 0x007e,0x0041,0x0041,0x0041,0x007e,0x00  ;O

;ASCII 50 - 5f, 80 - 95

db 0x007f,0x0009,0x0009,0x0009,0x0006,0x00  ;P
db 0x003e,0x0041,0x0051,0x0021,0x005e,0x00  ;Q
db 0x007f,0x0009,0x0019,0x0029,0x0046,0x00  ;R
db 0x0026,0x0049,0x0049,0x0049,0x0032,0x00  ;S
db 0x0001,0x0001,0x007f,0x0001,0x0001,0x00  ;T
db 0x003f,0x0040,0x0040,0x0040,0x003f,0x00  ;U
db 0x001f,0x0020,0x0040,0x0020,0x001f,0x00  ;V
db 0x003f,0x0040,0x0030,0x0040,0x003f,0x00  ;W
db 0x0063,0x0014,0x0008,0x0014,0x0063,0x00  ;X
db 0x0007,0x0008,0x0070,0x0008,0x0007,0x00  ;Y
db 0x0061,0x0051,0x0049,0x0045,0x0043,0x00  ;Z
db 0x0000,0x007f,0x0041,0x0041,0x0000,0x00  ;[
db 0x0000,0x0000,0x0000,0x0000,0x0000,0x00  ;spare (Yen)
db 0x0000,0x0041,0x0041,0x007f,0x0000,0x00  ;]
db 0x0004,0x0002,0x0001,0x0002,0x0004,0x00  ;^
db 0x0001,0x0001,0x0001,0x0001,0x0001,0x00  ;_

;ASCII 60 - 6f, 96 - 111

db 0x0000,0x0001,0x0002,0x0004,0x0000,0x00  ;'
db 0x0020,0x0054,0x0054,0x0054,0x0078,0x00  ;a
db 0x007f,0x0048,0x0044,0x0044,0x0038,0x00  ;b
db 0x0038,0x0044,0x0044,0x0044,0x0020,0x00  ;c
db 0x0038,0x0044,0x0044,0x0048,0x007f,0x00  ;d
db 0x0038,0x0054,0x0054,0x0054,0x0018,0x00  ;e
db 0x0008,0x007e,0x0009,0x0001,0x0002,0x00  ;f
db 0x000c,0x0052,0x0052,0x0052,0x003e,0x00  ;g
db 0x007f,0x0008,0x0004,0x0004,0x0078,0x00  ;h
db 0x0000,0x0044,0x007d,0x0040,0x0000,0x00  ;i
db 0x0020,0x0040,0x0040,0x003d,0x0000,0x00  ;j
db 0x007f,0x0010,0x0028,0x0044,0x0000,0x00  ;k
db 0x0000,0x0041,0x007f,0x0040,0x0000,0x00  ;l
db 0x007c,0x0004,0x0018,0x0004,0x0078,0x00  ;m
db 0x007c,0x0008,0x0004,0x0004,0x0078,0x00  ;n
db 0x0038,0x0044,0x0044,0x0044,0x0038,0x00  ;o

;ASCII 70 - 7f, 112 - 127

db 0x007c,0x0014,0x0014,0x0014,0x0008,0x00  ;p
db 0x0008,0x0014,0x0014,0x0018,0x007c,0x00  ;q
db 0x007c,0x0008,0x0004,0x0004,0x0008,0x00  ;r
db 0x0048,0x0054,0x0054,0x0054,0x0020,0x00  ;s
db 0x0004,0x003f,0x0044,0x0040,0x0020,0x00  ;t
db 0x003c,0x0040,0x0040,0x0020,0x007c,0x00  ;u
db 0x001c,0x0020,0x0040,0x0020,0x001c,0x00     ;v
db 0x003c,0x0040,0x0030,0x0040,0x003c,0x00  ;w
db 0x0044,0x0028,0x0001,0x0028,0x0044,0x00  ;x
db 0x000c,0x0050,0x0050,0x0050,0x003c,0x00  ;y
db 0x0044,0x0064,0x0054,0x004c,0x0044,0x00  ;z
db 0x0000,0x0008,0x0036,0x0041,0x0000,0x00  ;{
db 0x0000,0x0000,0x007f,0x0000,0x0000,0x00  ;|
db 0x0000,0x0041,0x0036,0x0008,0x0000,0x00  ;}
db 0x0008,0x0008,0x002a,0x001c,0x0008,0x00  ;->
db 0x0008,0x001c,0x002a,0x0008,0x0008,0x00  ;<-


END
;******************** END OF PROGRAM *****************************************************
Mod edit: fix code tags - JohnInTX
 

Attachments

Last edited by a moderator:

jpanhalt

Joined Jan 18, 2008
11,087
You may want to add a routine to clear the DDRAM. With the ST7567 that is necessary. It comes up from power on reset with garbage, which stays until it is overwritten. I wrote mine as a separate utility.
 
Top