Page 60
Epson Research and Development
Vancouver Design Center
S1D13503
Programming Notes and Examples
X18A-G-002-06
Issue Date: 01/01/30
7.2 Initialization Code
//-------------------------------------------------------------------------
//
// FUNCTION: Initialize()
//
// DESCRIPTION: Intialize S1D13503 registers.
//
// INPUTS: This function looks at the followingl global variables to
// determine the appropriate register settings:
// PanelX, PanelY, PanelType
//
// OUTPUTS: The following global variables are changed:
// PanelGrayLevel, BytesPerScanLine
//
//-------------------------------------------------------------------------
void Initialize(void)
{
static unsigned int val, val2;
static unsigned int x;
if (PanelD == PANEL_MONO)
PanelGrayLevel = 16;
else
PanelGrayLevel = 256;
//--------------------------------------
//
// Mode Register:
// Display = OFF
// Panel = SINGLE
// Mask XSCL = NOT MASKED
// LCDE = NOT ENABLED
// Gray Shade/Color = 16 Gray Shades (bit is ignored for 256 colors)
// LCD Data Width = 8 bit data transfer
// Memory Interface = 16 bits
// RAMS = Addressing for 8Kx8 SRAM
//
val = 0x0C;
if (Interface == 4)
val &= 0xfb; // Clear AUX[01] bit 2 so that Memory Interface = 4 bits
if (PanelType == TYPE_DUAL)
val |= 0x40; // Set panel type to DUAL
WriteRegister(1, val); // Write to Mode Register
//--------------------------------------
electronic components distributor