DogFlu66
Member
I leave the function to generate giant characters on a 128x64 GLCD.
Video:
Code:
'Giant characters function for GLCD 128x64.
'***********************************************************
'Pic18F46k22, OshonSoft Pic18 Basic Compiler v8.42
'By COS, 02/2023
'***********************************************************
#define CONFIG1L = 0x00
#define CONFIG1H = 0x28
#define CONFIG2L = 0x1e
#define CONFIG2H = 0x28
#define CONFIG3L = 0x00
#define CONFIG3H = 0x3f
#define CONFIG4L = 0x80
#define CONFIG4H = 0x00
#define CONFIG5L = 0x0f
#define CONFIG5H = 0xc0
#define CONFIG6L = 0x0f
#define CONFIG6H = 0xe0
#define CONFIG7L = 0x0f
#define CONFIG7H = 0x40
'***********************************************************
#define CLOCK_FREQUENCY = 64 'Clock 64Mhz
Define STRING_MAX_LENGTH = 30
Define SIMULATION_WAITMS_VALUE = 1
'***********************************************************
Include "_FuncionesPic18F46K22.bas"
Include "_FuncionGlcdBigFont.bas"
'***********************************************************
MAIN:
'Clock internal 64Mhz.
Call _setup_oscillator(_osc_16mhz_hf)
Call _setup_oscillator_mode(_primary_clock)
Call _set_pll4(_pll_on)
Call _interrupts_mode(_disable_priority)
'*********************************************************
'PCB configuration
AllDigital
TRISA = 0x00
TRISB = 0x00
TRISC = 0x00
TRISD = 0x00
TRISE = 0x00
'Configure puerto GLCD
Define GLCD_DREG = PORTD
Define GLCD_RSREG = PORTB
Define GLCD_RSBIT = 4
Define GLCD_EREG = PORTB
Define GLCD_EBIT = 5
Define GLCD_RWREG = PORTB
Define GLCD_RWBIT = 3
Define GLCD_CS1REG = PORTB
Define GLCD_CS1BIT = 1
Define GLCD_CS2REG = PORTB
Define GLCD_CS2BIT = 2
ConfigPin RB0 = Output
Symbol GLCD_RESET = RB0
GLCD_RESET = 0
WaitMs 10
GLCD_RESET = 1
GLcdinit 'Initialize Glcd
'*********************************************************
'Assign names to the Leds
Symbol Ledgreen = LATC.0
Symbol LedOrange = LATC.1
Symbol LedRed = LATC.2
Symbol backlight = LATE.2
'**********************************************************
Dim _High As Byte
Dim _Width As Byte
Dim x As Byte
Dim y As Byte
Dim number As Word
Dim _String As String
Ledgreen = 0
LedOrange = 1
LedRed = 0
_String = "THE END"
number = 0
_High = 4
_Width = 2
WaitMs 3000 'Delay in mSec.
x = _glcdwritebig("Number:", 7 * 2, 0, 2, 1) 'Write text
While True
Call _glcdwritebig(#number, 0, x, _High, _Width) 'Write text (number)
number++ 'Increase number
If number > 15 Then 'If finish counting Stop
Call _glcdwritebig(_String, 56, 40, 1, 1)
While True 'Infinite loop
Wend
Endif
WaitMs 500 'Delay in mSec.
Wend
End
Video:
Attachments
Last edited: