'**************************************************************** '* Name : st7920.pbpmod * '* Author : richard * '* Notice : Copyright (c) 2021 caveat emptor * '* : All Rights Reserved * '* Date : 23/10/2021 * '* Version : 1.0 * '* Notes : R/W NOT USED, HAS FRAME BUFFER INSTEAD * '* : LEVERAGES PBP LCD ROUTINES * '**************************************************************** 'SCREEN MAP 128X64 'ROW COLUMNS [WORDS] ' 0 | 0 1... 6 7 ' . | ' . | ' . | ' 30| ' 31| 0 1... 6 7 ' 0 | 8 9...14 15 ' . | ' . | ' 30| ' 31| 8 9...14 15 ' usual LCD defines are used eg ' DEFINE LCD_BITS 4 'defines the number of data interface lines (4 or 8) ' DEFINE LCD_DREG PORTB 'defines the port where data lines are connected to ' DEFINE LCD_DBIT 0 'defines the position of data lines for 4-bit interface (0 or 4) ' DEFINE LCD_RSREG PORTB 'defines the port where RS line is connected to ' DEFINE LCD_RSBIT 6 'defines the pin where RS line is connected to ' DEFINE LCD_EREG PORTB 'defines the port where E line is connected to ' DEFINE LCD_EBIT 4 'defines the pin where E line is connected ' DEFINE LCD_COMMANDUS 1000 'defines the delay after LCDOUT statement ' DEFINE LCD_DATAUS 40 'delay in micro seconds ' DEFINE LCD_RWREG PORTB ' LCD read/write port ' DEFINE LCD_RWBIT 5 ' LCD read/write pin bit ''END of LCD DEFINES ' Set Graphic RAM Address ' 0 0 1 0 AC5 AC4 AC3 AC2 AC1 AC0 'RS RW DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 ' 0 0 1 0 0 0 AC3 AC2 AC1 AC0 'RS RW DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 st7920_page var byte st7920_gli var byte st7920_inx var word st7920_tmx var word st7920_lfx var word goto overst7920 st7920_init: lcdout $FE,$24 'In same instruction cannot alter DL, RE and G at once. Make sure that change DL or G first and then RE. lcdout $FE,$26 bgcolour=0 colour=1 return setxy: ASM MOVLW 128 BANKSEL _st7920_gli IORWF _st7920_gli,W BANKSEL R3 MOVWF R3 bcf LCD_RSREG ,LCD_RSBIT MOVE?CT 1,FLAGS ,0 L?CALL lcdsend MOVLW 128 BANKSEL _st7920_page IORWF _st7920_page,W BANKSEL R3 MOVWF R3 MOVE?CT 1,FLAGS ,0 L?CALL lcdsend BANKSEL 0 ENDASM return senddat16: asm MOVE?BB _st7920_tmx ,R3 bsf LCD_RSREG ,LCD_RSBIT MOVE?CT 1,FLAGS ,0 L?CALL lcdsend bsf LCD_RSREG ,LCD_RSBIT MOVE?BB _st7920_tmx+1 ,R3 MOVE?CT 1,FLAGS ,0 L?CALL lcdsend BANKSEL 0 ENDASM return show: 'SEE MAP for st7920_GLi = 0 to 31 st7920_page = 0 gosub setxy st7920_inx=st7920_gli*16 for st7920_page = 0 TO 7 ;IS WORDS 0-17 IN TOP HALF st7920_tmx.lowbyte =fbr[st7920_inx] REV 8 st7920_inx = st7920_inx +1 st7920_tmx.highbyte =fbr[st7920_inx] REV 8 st7920_inx = st7920_inx +1 gosub senddat16 next st7920_inx=st7920_gli*16+512 for st7920_page = 0 TO 7 ;IS WORDS 8-15 IN BOTTOM HALF st7920_tmx.lowbyte =fbr[st7920_inx] REV 8 st7920_inx = st7920_inx +1 st7920_tmx.highbyte =fbr[st7920_inx] REV 8 st7920_inx = st7920_inx +1 gosub senddat16 next next return overst7920: