English
Language : 

SED1374 Datasheet, PDF (106/420 Pages) Epson Company – SED1374 Embedded Memory Color LCD Controller
Page 10
Epson Research and Development
Vancouver Design Center
This routine first performs a formula rearrangement so that HNDP or VNDP can be solved
for. Start with VNDP set to a small value. Loop increasing VNDP and solving the equation
for HNDP until satisfactory HNDP and VNDP values are found. If no satisfactory values
are found then divide CLKI and repeat the process. If a satisfactory frame rate still can’t be
reached - return an error.
In C the code looks like the following snip:
for (int loop = 0; loop < 2; loop++)
{
for (VNDP = 2; VNDP < 0x3F; VNDP += 3)
{
// Solve for HNDP
HNDP = (PCLK / (FrameRate * (VDP + VNDP))) - HDP;
if ((HNDP >= 32) && (HNDP <= 280))
{
// Solve for VNDP.
VNDP = (PCLK / (FrameRate * (HDP + HNDP))) - VDP;
// If we have satisfied VNDP then we're done.
if ((VNDP >= 0) && (VNDP <= 0x3F))
goto DoneCalc;
}
}
// Divide ClkI and try again.
// (Reg[02] allows us to dived CLKI by 2)
PCLK /= 2;
}
// If we still can't hit the frame rate - throw an error.
if ((VNDP < 0) || (VNDP > 0x3F) || (HNDP < 32) || (HNDP > 280))
{
sprintf("ERROR: Unable to set the desired frame rate.\n");
exit(1);
}
SED1374
X26A-G-002-02
Programming Notes and Examples
Issue Date: 99/04/27