You guys always make me hungry. I LOVE spaghetti.
Just not in my code.
Completely untested ...Code:Main: FOR Value = 0 TO 999 GOSUB SetDisp PAUSE 500 NEXT Value GOTO Main '---[Set 7-seg patterns to WORD value]-------------------------------------- SetDisp: FOR Idx = 2 to 0 STEP -1 Temp = Value DIG Idx LookUp Temp,[132,175,193,137,170,152,144,143,128,136,210,251],Temp SEGDEF(Idx) = Temp NEXT Idx RETURN '---[TMR1 - interrupt handler]---------------------------------------------- DISP: T1CON.0 = 0 ; stop timer TMR1H = %11111100 TMR1L = %00011111 T1CON.0 = 1 ; restart timer PORTE = %111 ; turn off all digits to prevent ghosting PORTC = SEGDEF(digitloop) ; put segment pattern to pin PORTE = ~(DCD digitloop) ; turn on the digit digitloop = digitloop + 1 ; prepare for next digit IF digitloop = 3 then digitloop = 0 @ INT_RETURN





Bookmarks