InterpretImageSample:
PUBLIC
PROCEDURE
RETURNS [LSEPDiagnostics.ImageFault] =
BEGIN
HighOrLow: TYPE = {H, L};
LSorVCorVD: TYPE = {LS, VC, VD};
checkIt:
PROCEDURE [max: SampleIndex, mask: LSorVCorVD, HorL: HighOrLow]
RETURNS [state:
BOOLEAN] =
BEGIN
isItThere:
PROCEDURE [mask: LSorVCorVD, HorL: HighOrLow]
RETURNS [set:
BOOLEAN] =
BEGIN
maskValue: CARDINAL;
valueToTest: CARDINAL;
SELECT mask
FROM
LS => {maskValue ← 100000B};
VC => {maskValue ← 40000B};
VD => {maskValue ← 20000B};
ENDCASE => NULL;
PAY ATTENTION: I invert the incomming bits because a 1 in the eStatus Reg. is really a logic zero!
valueToTest ← LOOPHOLE[Basics.BITAND[Basics.BITNOT[LOOPHOLE[sample[arrayIndex]]], maskValue]];
IF (HorL = L) --If L we are testing for no bits.-- THEN maskValue ← 0;
IF (valueToTest = maskValue) THEN set ← TRUE ELSE set ← FALSE;
END; --isItThere
state ← FALSE;
UNTIL (arrayIndex = max)
OR (state =
TRUE)
DO
state ← isItThere[mask, HorL]; arrayIndex ← arrayIndex + 1; ENDLOOP;
END; --checkIt
arrayIndex: SampleIndex;
beforePrinting: SampleIndex ← 4;
duringPrinting: SampleIndex ← 251;
afterPrinting: SampleIndex ← 255;
see if Video Data is stuck before printing.
arrayIndex ← 0; --NOTICE this is in the sample of 4 before printing.
isVDlow ← checkIt[beforePrinting, VD, L];
IF (isVDlow = FALSE) THEN RETURN[fault1];
arrayIndex ← beforePrinting; --see if Line Sync made any transitions.
FOR i:
CARDINAL
IN [0..5)
DO
--This loop is here to remove noise that we have seen!
isLShigh ← checkIt[duringPrinting, LS, H]; ENDLOOP;
isLShigh ← FALSE;
isLShigh ← checkIt[duringPrinting, LS, H]; --Now make the check!
IF (isLShigh = TRUE) THEN isLSlowAgain ← checkIt[duringPrinting, LS, L];
arrayIndex ← beforePrinting; --see if Video Clock made any transitions.
FOR i:
CARDINAL
IN [0..5)
DO
--This loop is here to remove noise that we have seen!
isVChigh ← checkIt[duringPrinting, VC, H]; ENDLOOP;
isVChigh ← FALSE;
isVChigh ← checkIt[duringPrinting, VC, H]; --Now make the check!
IF (isVChigh = TRUE) THEN isVClowAgain ← checkIt[duringPrinting, VC, L];
see if Video Data made any transitions.
arrayIndex ← beforePrinting;
isVDhigh ← checkIt[duringPrinting, VD, H];
IF isVDhigh THEN isVDlowAgain ← checkIt[duringPrinting, VD, L];
IF isLSlowAgain
THEN
IF
NOT isVClowAgain
THEN
IF isVChigh AND (NOT isVClowAgain) THEN RETURN[fault7] --stuck low
ELSE RETURN[fault8] --stuck high
ELSE
IF (NOT isVDlowAgain) OR (NOT isVDhigh) THEN RETURN[fault2] --no transitions
ELSE RETURN[noFault] --Everything is WORKING!
ELSE
IF
NOT isLShigh
THEN
IF isVClowAgain THEN RETURN[fault5] --VC is OK but LS is stuck high
ELSE RETURN[fault6] --no transitions
ELSE
IF isVClowAgain THEN RETURN[fault3] --VC is OK but LS is stuck low
ELSE RETURN[fault4]; --no transitions
END; --InterpretImageSample