'{$STAMP BS2}
'{$PBASIC 2.5}
main:
seconds1 VAR Byte
seconds2 VAR Byte
counter VAR Byte
seconds1=0
seconds2=0
OUTL = %00000000 ' OUTH initialized to low.
DIRL = %11111111 ' Set P0-P15 to all output-low.
OUTH = %00000000 ' OUTH initialized to low.
DIRH = %11111111 ' Set P0-P15 to all output-low.
DO
FOR seconds2=0 TO 5 STEP 1
FOR seconds1=0 TO 9 STEP 1
LOOKUP seconds1, [ %11100111, %10000100, %11010011,
%11010110, %10110100, %01110110,
%01110111, %11000100, %11110111, %11110110 ], OUTH
LOOKUP seconds2, [ %11100111, %10000100, %11010011,
%11010110, %10110100, %01110110,
%01110111, %11000100, %11110111, %11110110 ], OUTL
PAUSE 60000 ' for minuts 60000 for seconds 1000 for hours 1200000
NEXT
seconds1=0
NEXT
seconds2=0
LOOP
END
GOSUB ledones
GOSUB ledtens
ledtens:
DEBUG "led 1 from 0 to 9!"
' Digit:
' BAFG.CDE
OUTL = %11100111 ' 0
PAUSE 1000
OUTL = %10000100 ' 1
PAUSE 1000
OUTL = %11010011 ' 2
PAUSE 1000
OUTL = %11010110 ' 3
PAUSE 1000
OUTL = %10110100 ' 4
PAUSE 1000
OUTL = %01110110 ' 5
PAUSE 1000
OUTL = %01110111 ' 6
PAUSE 1000
OUTL = %11000100 ' 7
PAUSE 1000
OUTL = %11110111 ' 8
PAUSE 1000
OUTL = %11110110 ' 9
PAUSE 1000
DIRL = %00000000 ' I/O pins to input,
' segments off.
RETURN
ledones:
DEBUG "led 2 from 0 to 9!"
OUTH = %00000000 ' OUTH initialized to low.
DIRH = %11111111 ' Set P0-P15 to all output-low.
' Digit:
' BAFG.CDE
OUTH = %11100111 ' 0
PAUSE 1000
OUTH = %10000100 ' 1
PAUSE 1000
OUTH = %11010011 ' 2
PAUSE 1000
OUTH = %11010110 ' 3
PAUSE 1000
OUTH = %10110100 ' 4
PAUSE 1000
OUTH = %01110110 ' 5
PAUSE 1000
OUTH = %01110111 ' 6
PAUSE 1000
OUTH = %11000100 ' 7
PAUSE 1000
OUTH = %11110111 ' 8
PAUSE 1000
OUTH = %11110110 ' 9
PAUSE 1000
DIRH = %00000000 ' I/O pins to input,
' segments off.
RETURN
END