Author: John Leung
Company: TechToys Company
Web: www.TechToys.com.hk
Date: 21st Feb 2008


/*
******************************************************************************
* Date: 21st Feb 2008
*
* This project modified from the original Microchip Graphics Primitive Layer
* Demo. Instead of using PMP module, octal latch device 74HC573 is
* used to 'convert' 8-bit data to 16-bit data. Discrete I/O method has been
* used for this project therefore we need to use ILI9320P_LE.c and 
* ILI9320P_LE.h files in which all control lines such as RD, WR, RS etc 
* declared individually. Pins definition summarized as follows:
*
* Use discrete I/O for interface
* Function		mcu pins		LCD pins
* ==========	========		========
* DATA LINES	PMD[7:0]		DB[15:8] and Q[7:0] of 74HC573 wired to DB[7:0]
* LE			RG15			LE of 74HC573, this latches lower byte to LCD
* RESET			RA7				/RESET
* CHIP SELECT	RD12			/CS
* COMMAND/DATA	RF5/PMA8		RS 
* WR STROBE		RD4/PMPWR		/WR
* RD STROBE		RD5/PMPRD		/RD
* Backlight		OC2/RD1			EN
*
* Remarks: JP2 should be CLOSED for we are using 74HC573 to convert 8-bit to 16-bit
*
* Modification in only two marcos and one function are required:
* 1. SetIndex(index) under ILI9320P_LE.h
* 2. WriteData(byte1, byte0) under ILI9320P_LE.h 
* 3. ResetDevice(void) under ILI9320P_LE.c
* 
* These are the only changes required to make this project work with
* discrete I/O method instead of PMP.
* Since the octal latch is an one-way device, no reading from LCD possible
* therefore the function WORD GetPixel(SHORT x, SHORT y) also removed from
* the file ILI9320P_LE.c (this function is not needed anyway). 
* 
* The hardware platform was PIC24-Eval-B2 Rev A with TY320T-240320-BO Rev 2C;
* so we may use pwm for backlight control or simply keep OC2/RD1 pin low to keep 
* LCD backlight ON during demonstration. The latter method has been used in this
* demo. Thus one may see we need to put extra code 
*
* 	LED_TRIS_BIT = 0;
*	LED_LAT_BIT	 = 0;
*
* at ResetDevice(void) to keep EN pin low to turn MOSFET ON for LED backlight.
******************************************************************************
*/