$regfile = "m32def.dat" $crystal = 8000000 Config Timer0 = Timer , Prescale = 1024 Enable Interrupts Enable Timer0 On Timer0 7seg Start Timer0 Timer0 = 204 '150hz timer freq Config Porta = Output Config Portc = Output Dim A As Byte Dim Sel_7seg As Byte Dim Sadgan As Byte Dim Dahgan As Byte Dim Yekan As Byte Dim Flag As Byte Dim Tmp As Byte Do Incr A Sadgan = A / 100 'calculating sadgan Tmp = A Mod 100 Dahgan = Tmp / 10 'calculating dadgan Yekan = Tmp Mod 10 'calculating yekan Waitms 100 Loop End 'end program 7seg: Timer0 = 204 Incr Sel_7seg Select Case Sel_7seg Case 1 : If Sadgan <> 0 Then Portc.5 = 1 : Portc.6 = 0 : Portc.7 = 0 'select sadgan 7seg Flag = Sadgan 'load value of sadgan to flag reg End If Case 2 : If Dahgan <> 0 Or Sadgan > 0 Then Portc.5 = 0 : Portc.6 = 1 : Portc.7 = 0 'select dahgan 7seg Flag = Dahgan 'load value of sadgan to flag reg End If Case 3 : Portc.5 = 0 : Portc.6 = 0 : Portc.7 = 1 'select yekan 7seg Flag = Yekan 'load value of sadgan to flag reg Sel_7seg = 0 End Select Porta.2 = Flag.0 : Porta.3 = Flag.1 : Porta.4 = Flag.2 : Porta.5 = Flag.3 'send the value of the flag to 7447 Return