' 7-Segment LED Example
Sub main()
Dim count As uByte
count=0
' Setup Hardware.
PORTB=0: TRISB=0
' Endless loop
While 1
For count=0 To 9 ' Count 0 to 9 forever
display(count)
Delays(1)
Next
End While
End Sub
' Drive the 7 segment display
Sub display(count As uByte)
Select Case count
Case 0: PORTB=0b00111111
Case 1: PORTB=0b00000110
Case 2: PORTB=0b01011011
Case 3: PORTB=0b01001111
Case 4: PORTB=0b01100110
Case 5: PORTB=0b01101101
Case 6: PORTB=0b01111101
Case 7: PORTB=0b00000111
Case 8: PORTB=0b01111111
Case 9: PORTB=0b01100111
Case 10: PORTB=0b00000000 '(blank)
End Select
End Sub