Page 10
Epson Research and Development
Vancouver Design Center
S1D13704
Programming Notes and Examples
X26A-G-002-03
Issue Date: 01/02/12
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);
}
*