$crystal = 8000000 Const Dispsize = 12 Dim A(1) As Byte 'no range checking, so A(2) to A(13) refer to the data structure. Dim Disp0c As Byte 'control - decimal pos bits 0,1 brightness bits 2-7 Dim Disp0v As Integer 'value -999 to 999 Dim Disp1c As Byte Dim Disp1v As Integer Dim Disp2c As Byte Dim Disp2v As Integer Dim Disp3c As Byte Dim Disp3v As Integer Dim Dispsum As Byte Dim B(14) As Byte 'copy of structure plus leading size and trailing checksum bytes Dim T10khz As Byte Dim T100hz As Byte Dim State As Byte Dim Waitcount As Byte Dim Curbyte As Byte Dim Curbit As Byte Dim Csum As Byte Dim I As Byte Config Portb = Output Config Portc = Output Config Portd = Output Config Timer0 = Timer , Prescale = 8 Enable Timer0 On Timer0 Tick1mhz Set Tifr.1 T10khz = 0 T100hz = 0 State = 0 Waitcount = 1 Disp0c = &H40 Disp0v = 99 Disp1c = &H81 Disp1v = -88 Disp2c = &HC2 Disp2v = 999 Disp3c = &HFF Disp3v = 123 Enable Interrupts Start Timer0 Loop: Goto Loop End 'end program' Tick1mhz: Load Timer0 , 100 'load timer0 with 256-100 Incr T10khz If T10khz = 100 Then T10khz = 0 Incr T100hz If T100hz = 100 Then T100hz = 0 End If I = T10khz Mod 4 If I = 0 Then '2.5kHz clock Decr Waitcount If Waitcount = 0 Then Select Case State Case 0: 'idle Set Portc.0 State = 1 Waitcount = 4 B(1) = Dispsize Csum = &H55 + Dispsize For I = 2 To 13 B(i) = A(i) Csum = Csum + A(i) Next I B(14) = 0 - Csum Curbyte = 1 Curbit = 8 Case 1: If Portc.0 = 1 Then Reset Portc.0 Else Set Portc.0 End If If Curbit = 0 Then Incr Curbyte Curbit = 8 End If If Curbyte = 15 Then State = 0 Waitcount = 10 Else I = B(curbyte) If I.7 = 1 Then Waitcount = 2 Else Waitcount = 1 End If Shift B(curbyte) , Left Decr Curbit End If End Select End If End If Return