This section covers GLCD devices that use the PCD844 graphics controller.
The PCD8544 is a low power CMOS LCD controller/driver, designed to drive a graphic display of 48 rows and 84 columns. All necessary functions for the display are provided in a single chip, including on-chip generation of LCD supply and bias voltages, resulting in a minimum of external components and low power consumption. The PCD8544 interfaces to microcontrollers through a serial bus interface.
The GCBASIC constants shown below control the configuration of the PCD844 controller. GCBASIC supports SPI software connectivity only - this is shown in the tables below.
The PCD8544 is a monochrome device.
The PCD844can operate in two modes. Full GLCD mode and Text/JPG mode the full GLCD mode requires a minimum of 512 bytes. For microcontrollers with limited memory the text only can be selected by setting the correct constant.
To use the PCD844 driver simply include the following in your user code. This will initialise the driver.
#include <glcd.h> #define GLCD_TYPE GLCD_TYPE_PCD8544 ' Pin mappings for software SPI for Nokia 3310 Device #define GLCD_DO portc.5 'example port setting #define GLCD_SCK portc.3 'example port setting #define GLCD_DC portc.2 'example port setting #define GLCD_CS portc.1 'example port setting #define GLCD_RESET portc.0 'example port setting
The GCBASIC constants for the interface to the controller are shown in the table below.
Constants | Controls | Options |
---|---|---|
|
|
|
|
Specifies the output pin that is connected to Data/Command IO pin on the GLCD. |
Required |
|
Specifies the output pin that is connected to Chip Select (CS) on the GLCD. |
Required |
|
Specifies the output pin that is connected to Reset pin on the GLCD. |
Required |
|
Specifies the output pin that is connected to Data Out (GLCD in) pin on the GLCD. |
Required |
|
Specifies the output pin that is connected to Clock (CLK) pin on the GLCD. |
Required |
The GCBASIC constants for control display characteristics are shown in the table below.
Constants | Controls | Default |
---|---|---|
|
Specifies that the display controller will operate in text mode and BMP
draw mode only. |
Optional |
|
Specifies the clock delay, if required for slower microcontroller, |
Optional. Set to 0 as the default value |
|
Specifies the write delay, if required for slower microcontroller, |
Optional. Set to 0 as the default value |
|
The width parameter of the GLCD |
160 |
|
The height parameter of the GLCD |
128 |
|
Specifies the font width of the GCBASIC font set. |
6 |
The GCBASIC commands supported for this GLCD are shown in the table below. Always review the appropiate library for the latest full set of supported commands.
Command | Purpose | Example |
---|---|---|
|
Clear screen of GLCD |
|
|
Print string of characters on GLCD using GCB font set |
|
|
Print character on GLCD using GCB font set |
|
|
Print characters on GLCD using GCB font set |
|
|
Draw a box on the GLCD to a specific size |
|
|
Draw a box on the GLCD to a specific size that is filled with the foreground colour. |
|
|
Draw a line on the GLCD to a specific length that is filled with the specific attribute. |
|
|
Set a pixel on the GLCD at a specific position that is set with the specific attribute. |
|
|
Set a byte value to the controller, see the datasheet for usage. |
|
|
Read a byte value from the controller, see the datasheet for usage. |
|
*For a PCD8544 datasheet, please refer
here
This example shows how to drive a PCD8544 based Graphic LCD module with the built in commands of GCBASIC.
Example:
#chip 16lf1939,32 #option Explicit #config MCLRE_ON #include <glcd.h> #DEFINE GLCD_TYPE GLCD_TYPE_PCD8544 ' Pin mappings for software SPI for Nokia 3310 Device #define GLCD_DO portc.5 #define GLCD_SCK portc.3 #define GLCD_DC portc.2 #define GLCD_CS portc.1 #define GLCD_RESET portc.0 Dim outString as string Dim ccount, byteNumber as Byte Dim longNumber as Long Dim wordNumber as Word GLCDCLS DO forever for CCount = 31 to 127 GLCDPrint (0, 0, "PrintStr") GLCDDrawString (0, 9, "DrawStr") GLCDPrint ( 44 , 21, " ") GLCDPrint ( 44 , 29, " ") ' word value GLCDPrint ( 44 , 37, " ") ' Byte value outstring = hex( longNumber_U) GLCDPrint ( 44 , 21,outstring ) outstring = hex( longNumber_H) GLCDPrint ( 55 , 21, outstring) outstring = hex( longNumber) GLCDPrint ( 67 , 21, outstring ) GLCDPrint ( 44 , 29, mid( str(wordNumber),1, 6)) GLCDPrint ( 44 , 37, byteNumber) box 46,9,57,19 GLCDDrawChar(48, 9, CCount ) outString = str( CCount ) ' draw a box to overwrite existing strings FilledBox(58,9,GLCD_WIDTH-1,17,GLCDBackground ) GLCDDrawString(58, 9, outString ) box 0,0,GLCD_WIDTH-1, GLCD_HEIGHT-1 box GLCD_WIDTH-5, GLCD_HEIGHT-5,GLCD_WIDTH- 1, GLCD_HEIGHT-1 filledbox 2,30,6,38, wordNumber Circle( 25,30,8,1) ;center FilledCircle( 25,30,4,longNumber xor 1) ;center line 0, GLCD_HEIGHT-1 , GLCD_WIDTH/2, (GLCD_HEIGHT /2) +1 line GLCD_WIDTH/2, (GLCD_HEIGHT /2) +1 ,0, (GLCD_HEIGHT /2) +1 longNumber = longNumber + 7 wordNumber = wordNumber + 3 byteNumber++ NEXT LOOP end
For more help, see GLCDCLS, GLCDDrawChar, GLCDPrint, GLCDReadByte, GLCDWriteByte or Pset
Supported in <GLCD.H> and <glcd_PCD8544.h>