______________________________________________________________________ > < > Grh driver v1.03 < > for < > PICos18 v2.10 - PICos18 v3.00 - PICos v1.05 < > < > PICos - Real-time kernel for PIC family < > < > < > www.picos18.com www.pragmatec.net < >______________________________________________________________________< This file contains all necessary informations to use properly the PIC18 graphical LCD library for PICos. This driver lets you design a multi-task application using the same LCD interface without being disturb by any other task. Then every task of your application can print text, picture or widget without being necessarily synchronised to the others. ______________________________________________________________________ > < > I - Zip file content < >______________________________________________________________________< The drv_rs zip file contains : - grh_data.c : print data & text - grh_data.h : header file - grh_display.h : generic header - grh_fonts.c : font definitions - grh_fonts.h : header file - grh_images.c : manage pictures - ghr_images.h : header file - grh_ks108.c : ks108 driver - grh_ks108.h : header file - grh_player.c : set of logos - ghr_player.h : header file - grh_sed1520.c : sed1520 driver - grh_sed1520.h : header file - grh_sed1565.c : sed1565 driver - grh_sed1565.h : header file - grh_widget.c : manage widgets - ghr_widget.h : header file - drv_grh_lcd.txt : this file To use the PICos18 graphic LCD library, first unzip the file. Place the C and H file in your project directory. This driver is supposed to be use with PICos18 or PICos and has been tested with MPLAB 7.62 and C18 v3.12 and C30 v2.00. Do not use this driver at a frequency lower than 8 Mhz (use the PIC PLL to increase the internal freq). ______________________________________________________________________ > < > II - Hardware settings < >______________________________________________________________________< At first you have to choose what kind of controler you need with your graphical LCD. The two main controlers are the SED1520 and the KS108. Please have a look at the LCD datasheet to know which one you need. To connect your LCD properly to the PIC18 open the header file of the selected driver (grh_sed1520.c or grh_ks108.c) then modify the file if you need to choose different pin to driver the LCD. You have to identify the : - DATA port - RS pin - E1 pin (or C1 pin with a separated E pin) - E2 pin (or C2 pin with a separated E pin) - RW pin - RESET pin (eventualy) Furthermore depending of your target you have to modify the GrhInitLCD function. This one is designed for PIC18F452 (no digital inputs settings) but you can remove the comments to get the code compliant for a target like the PIC18F4620 (digital inputs settings on PORTA). >> To use the driver with the explorer16 board from Microchip & PIC24 : The board routing as a footprin for an OPTREX F-51320.This LCD has a SED1565 controller onboard. To use properly, you need to remove the LCD already solded. To complete the board, you need: - an OPTREX F-51320 ! - a FFC zif connector, pitch 0.5mm, 30 contacts at bottom - 4 tantalum caps 16v 4,7µF & 5 tatalum caps 16V 1µF In the sed1565.h header file, you will find definition of pins connected to you LCD. You have to identify the : - DATA port - A0 pin - CS pin - RD pin - WR pin - RESET pin You have to adjust this define regarding your own hardware. Furthermore do not forget to remove all the "rom" token in the library. ______________________________________________________________________ > < > III - TASCDESC settings (1) < >______________________________________________________________________< Update also the tascdesc.c file to increase at the maximum the stack of the application that need to driver the LCD : /********************************************************************** * ----------------------- TASK & STACK DEFINITION -------------------- **********************************************************************/ DeclareTask(Example); ... // PIcos18 version volatile unsigned char stack0[256]; // PIcos version //u_int __attribute__((__section__(".stack_tsk0"))) stack_task0[256]; ... ______________________________________________________________________ > < > IV - TASK Settings < >______________________________________________________________________< Open the C file of your task and add the generic GRH header file : #include "grh_display.h" Whatever you need to display (data, widget, picture, ...) the generic header will automaticaly include the necessary headers. ______________________________________________________________________ > < > V - Grh library usage < >______________________________________________________________________< Here is an example of how to use the Grh library. The LCD used is driven by a SED1520 controler, then the following files will be included in the MPLAB project (LCD resolution = 122 x 32): - grh_data.c - grh_fonts.c - grh_images.c - grh_sed1520.c - grh_widget.c The projet will display a battery in a large frame and the PICos18 name blinking in XOR_MODE : #include "grh_display.h" /************************************************************************ * Definition dedicated to the local functions. ************************************************************************/ Font_t Font_9x16; Image_t Batt; /******************************************************************** * -------------------------- USER TASK1 ---------------------------- ********************************************************************/ TASK(TASK1) { Font_9x16.f_ptr = &Arial_13[0][0]; Font_9x16.I_Font = 8; Font_9x16.K_Font = 2; Font_9x16.N_Font = 16; Batt.img = CarBattery; Batt.mode = WRITE_MODE; Batt.X = 9; Batt.Y = 5; Batt.length = 16; Batt.size = 2; SetRelAlarm(0, 100, 1000); GrhInitLCD(); GrhPrintImage(Batt); GrhPrintEmptyBox(WRITE_MODE, 0, 0, 122, 32); while (1) { WaitEvent(ALARM_EVENT); ClearEvent(ALARM_EVENT); if(GetResource(0) == E_OK) { GrhPrintROMString("PICos18", Font_9x16, STEP_2, XOR_MODE, 34, 10); ReleaseResource(0); } } } ______________________________________________________________________ > < > VI - Conclusion < >______________________________________________________________________< Of course you can do much more than this example is doing with the GRH library provided. Do not hesitate to add to this example some widgets or pictures that are defined in the grh_widget.h and grh_images.h files. Also you can create some new logo and picture to create your own design. Futur releases will include some picture management, like black & white BMP file management... Do not hesitate to check periodicaly the www.picos18.com web site in order to download the last versions of PIC18 drivers for PICos18. /* End of File : drv_lcd_grh.txt */