Code:
'****************************************************************
'* Name : UNTITLED.BAS *
'* Author : richard *
'* Notice : Copyright (c) 2022 caveat emptor *
'* : All Rights Reserved *
'* Date : 11/10/2022 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************************************
#CONFIG
CONFIG FOSC = INTIO67
CONFIG PLLCFG = ON
CONFIG PRICLKEN = ON
CONFIG FCMEN = OFF
CONFIG IESO = OFF
CONFIG PWRTEN = ON
CONFIG BOREN = SBORDIS
CONFIG BORV = 190
CONFIG WDTEN = OFF
CONFIG WDTPS = 32768
CONFIG CCP2MX = PORTC1
CONFIG PBADEN = OFF
CONFIG CCP3MX = PORTB5
CONFIG T3CMX = PORTC0
CONFIG HFOFST = ON
CONFIG P2BMX = PORTB5
CONFIG MCLRE = EXTMCLR
CONFIG STVREN = ON
CONFIG LVP = OFF
CONFIG XINST = OFF
CONFIG DEBUG = OFF
CONFIG CP0 = OFF
CONFIG CP1 = OFF
CONFIG CP2 = OFF
CONFIG CP3 = OFF
CONFIG CPB = OFF
CONFIG CPD = OFF
CONFIG WRT0 = OFF
CONFIG WRT1 = OFF
CONFIG WRT2 = OFF
CONFIG WRT3 = OFF
CONFIG WRTC = OFF
CONFIG WRTB = OFF
CONFIG WRTD = OFF
CONFIG EBTR0 = OFF
CONFIG EBTR1 = OFF
CONFIG EBTR2 = OFF
CONFIG EBTR3 = OFF
CONFIG EBTRB = OFF
#ENDCONFIG
DEFINE OSC 64
DEFINE DEBUG_REG PORTB
DEFINE DEBUG_BIT 7
DEFINE DEBUG_BAUD 9600
DEFINE DEBUG_MODE 0
LATB.7=1
#DEFINE colours 1 ;1 mono 2 rg or 3 rgb
width con 128 ;
height con 64 ;
'use serial i/f
#define stserial 1
include "grx.pbpMOD"
include "st7920.pbpmod"
include "font.bas"
include "bignum.bas"
include "bigchr.bas"
BUFF VAR BYTE[32]
OSCCON=$70
OSCTUNE.6=1
while ! osccon2.7 :WEND ;wait for pll
ANSELB=0
ANSELC=0
ANSELA=0
' serial spi pins used
' e is sck latc.3
' rw is sdo latc.5
' rs is cs latc.1
'trisc = %11010101 ;cs,sck,sdo are output
trisc = %11010101 ;cs,sck,sdo are output
TRISB = %11111111
TRISA = %11111111
n var word
gosub st7920_init 'graphic mode
OSCCON=$70
OSCTUNE.6=1
while ! osccon2.7 :WEND ;wait for pll
ANSELB=0
ANSELC=0
ANSELA=0
Pause 500 ' LCD initialize time
lcdout $FE,1
gosub st7920_init 'graphic mode
gosub grf_clr
n=0
SETFONT bignum
bgcolour=0
main:
n= n+1
colour=1
fillrect 39,29,46,16 ; this is a guess about your font size
ARRAYWRITE BUFF,[dec4 n,0]
DMDSTR 40,30, Buff,0
colour=0
fillrect 39,9,46,16 ; this is a guess about your font size
DMDSTR 40,10, Buff,1
gosub show
pause 1000
goto main
Bookmarks