Display$Temp:PROCEDURE PUB;
Temp = Temperature / 16;
Disp$Buf(0) = Char$Img(Temp MOD 10);
Disp$Buf(1) = Char$Img((Temp / 10) MOD 10);
END Display$Temp;
System$Clock:PROCEDURE USING 1;
MSecond$Cnt = MSecond$Cnt + 1;
IF MSecond$Cnt MOD 4 = 0 THEN
DO;
LED1 = 1;
LED2 = 1;
P1 = Disp$Buf(Disp$Buf$Ptr);
IF Disp$Buf$Ptr = 0 THEN
LED1 = 0;
ELSE IF Disp$Buf$Ptr = 1 THEN
LED2 = 0;
Disp$Buf$Ptr = Disp$Buf$Ptr + 1;
IF Disp$Buf$Ptr >= 2 THEN
Disp$Buf$Ptr = 0;
END;
IF MSecond$Cnt < 1000 THEN
RETURN;
MSecond$Cnt = 0;
Second = Second + 1;
IF FanOutDelay > 0 THEN
FanOutDelay = FanOutDelay - 1;
dat = 0;
DO i = 1 TO 8;
j = EXPAND(tmrbit);
dat = SHL(j,7) OR SHR(dat,1);
END;
RETURN (dat);
END tmrbyte;
/* 写一个字节 */
tmwbyte:PROCEDURE(dat) PUB;
DCL dat BYTE;
DCL testb BIT;
DCL (i,j) BYTE;
DO j = 1 TO 8;
testb = BOOLEAN(dat AND 1);
dat = SHR(dat,1);
IF testb = 1 THEN
DO;
TMDAT = 0; /* 写1 */
i = i + 1;
i = i + 1;
TMDAT = 1;
i = 10;
DO WHILE (i > 0);
i = i - 1;
END;
END;
ELSE
DO;
TMDAT = 0; /* 写0 */
i = 10;
DO WHILE (i > 0);
i = i - 1;
END;
TMDAT = 1;
i = i + 1;
i = i + 1;
END;
END;
END tmwbyte;