BUFF VAR BYTE[4] is too small to hold a 4 digit null terminated string it must be digits + 1

ARRAYWRITE BUFF,[dec4 n] is not a null terminated string ARRAYWRITE BUFF,[dec4 n,0] is


SETFONT bignum should not be in the loop , you only need to set the font once unless you want to change to another font

rather than clearing the whole screen you can "FILLRECT" with the background colour for a restricted area to clr




Code:
     DEFINE OSC 64
    #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 "st7920b.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 
    
    '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
 
 
 main:   
    n= n+1
    colour=bgcolour
    fillrect 39,29,70,20 ; this is a guess about your font size
    ARRAYWRITE BUFF,[dec4 n,0]
    DMDSTR 40,30, Buff,1
    gosub show 
    pause 1000
    
 goto main