User manual

Table Of Contents
530
mikoC PRO for PIC32
MikroElektronika
#dene FILL_DEMO // Uncomment to demonstrate ll routines
#dene PARTIAL_IMAGE_DEMO // Uncomment to demonstrate partial image routine
char txt1[] = “ EINSTEIN WOULD HAVE LIKED mE”;
char txt[] = “ GLCD LIBRARY DEMO, WELCOME !”;
char txt2[] = “Partial image demo!”;
unsigned char panel; // Current panel
unsigned int i; // General purpose register
unsigned char curs; // Cursor visibility
unsigned int cposx, cposy; // Cursor x-y position
CHECON = 0x32;
AD1PCFG = 0xFFFF; // initialize AN pins as digital
TRISB8_bit = 1; // Set RB8 as input
TRISB9_bit = 1; // Set RB9 as input
TRISB10_bit = 1; // Set RB10 as input
TRISB11_bit = 1; // Set RB11 as input
TRISB12_bit = 1; // Set RB12 as input
TRISB13_bit = 1; // Set RB13 as input
// If Port Expander Library uses SPI1 module
// Initialize SPI module used with PortExpander
SPI2_Init_Advanced(_SPI_MASTER,_SPI_8_BIT, 4, _SPI_SS_DISABLE,_SPI_DATA_SAMPLE_MIDDLE,_
SPI_CLK_IDLE_LOW,_SPI_ACTIVE_2_IDLE);
/*
* init display for 240 pixel width and 128 pixel height
* 8 bits character width
* data bus on MCP23S17 portB
* control bus on MCP23S17 portA
* bit 2 is !WR
* bit 1 is !RD
* bit 0 is !CD
* bit 4 is RST
* chip enable, reverse on, 8x8 font internaly set in library
*/
SPI_T6963C_Cong(240, 128, 8, 0, 2, 1, 0, 4);
Delay_ms(1000);
/*
* Enable both graphics and text display at the same time
*/
SPI_T6963C_graphics(1);
SPI_T6963C_text(1);
panel = 0;
i = 0;
curs = 0;
cposx = cposy = 0;