Dim W As Word Dim W1 As Word ' в этой переменной будет число которое хотим отобразить Dim X As Integer Dim R As Integer Dim K As Byte Dim Nagr As Byte Dim P As Word Dim V As Word Dim N1 As Byte Dim N2 As Byte Dim N3 As Byte Dim N4 As Byte Dim M1 As Integer Dim M2 As Integer Dim M3 As Integer Dim M4 As Integer Config Adc = Single , Prescaler = Auto , Reference = Avcc Config Portd.1 = Output Config Portd.2 = Output Config Int1 = Falling On Int1 Knopka ' * * * настраиваем порты к которым цепляется индикатор на выход * * * Ddrb = &B11111111 Ddrc = &B11111111 '*** основной цыкл**** Enable Interrupts Enable Int1 Acp: R = 0 Start Adc W = Getadc(7) Stop Adc W = W / 4 Led: M1 = W M2 = M1 M3 = M1 M1 = M1 / 100 'обработка первого числа N1 = Abs(m1) M2 = M2 Mod 100 'обработка второго числа M2 = M2 / 10 N2 = Abs(m2) M3 = M3 Mod 10 ' обработка третьего числа N3 = Abs(m3) '* * * подпрограма обработки индикации * * * Do Incr R If R = 20 Then Goto Acp End If Portd.1 = 1 Portc = &B00000100 'зажигаем первое число Select Case N1 Case 0 : Portb = &B11000000 Case 1 : Portb = &B11111001 Case 2 : Portb = &B10100100 Case 3 : Portb = &B10110000 Case 4 : Portb = &B10011001 Case 5 : Portb = &B10010010 Case 6 : Portb = &B10000010 Case 7 : Portb = &B11111000 Case 8 : Portb = &B10000000 Case 9 : Portb = &B10010000 End Select Waitms 5 Portc = &B00001000 'зажигаем второе число Select Case N2 Case 0 : Portb = &B11000000 Case 1 : Portb = &B11111001 Case 2 : Portb = &B10100100 Case 3 : Portb = &B10110000 Case 4 : Portb = &B10011001 Case 5 : Portb = &B10010010 Case 6 : Portb = &B10000010 Case 7 : Portb = &B11111000 Case 8 : Portb = &B10000000 Case 9 : Portb = &B10010000 End Select Waitms 5 Portc = &B00010000 'зажигаем третье число Select Case N3 Case 0 : Portb = &B11000000 Case 1 : Portb = &B11111001 Case 2 : Portb = &B10100100 Case 3 : Portb = &B10110000 Case 4 : Portb = &B10011001 Case 5 : Portb = &B10010010 Case 6 : Portb = &B10000010 Case 7 : Portb = &B11111000 Case 8 : Portb = &B10000000 Case 9 : Portb = &B10010000 End Select Waitms 5 Loop '************************************************************************** Knopka: Incr K Print K Select Case K Case 1 : Gosub Nagrevanie Case 2 : Gosub Acp End Select '*****************************************************************************8 Nagrevanie: R = 0 Portd.1 = 0 Start Adc W1 = Getadc(6) Stop Adc W1 = W1 / 2.2 If W1 < W Then Portd.2 = 1 End If If W1 >= W Then Portd.2 = 0 End If M1 = W1 M2 = M1 M3 = M1 M1 = M1 / 100 'обработка первого числа N1 = Abs(m1) M2 = M2 Mod 100 'обработка второго числа M2 = M2 / 10 N2 = Abs(m2) M3 = M3 Mod 10 ' обработка третьего числа N3 = Abs(m3) '* * * подпрограма обработки индикации * * * Do Incr R If R = 80 Then Goto Nagrevanie End If Portc = &B00000100 'зажигаем первое число Select Case N1 Case 0 : Portb = &B11000000 Case 1 : Portb = &B11111001 Case 2 : Portb = &B10100100 Case 3 : Portb = &B10110000 Case 4 : Portb = &B10011001 Case 5 : Portb = &B10010010 Case 6 : Portb = &B10000010 Case 7 : Portb = &B11111000 Case 8 : Portb = &B10000000 Case 9 : Portb = &B10010000 End Select Waitms 5 Portc = &B00001000 'зажигаем второе число Select Case N2 Case 0 : Portb = &B11000000 Case 1 : Portb = &B11111001 Case 2 : Portb = &B10100100 Case 3 : Portb = &B10110000 Case 4 : Portb = &B10011001 Case 5 : Portb = &B10010010 Case 6 : Portb = &B10000010 Case 7 : Portb = &B11111000 Case 8 : Portb = &B10000000 Case 9 : Portb = &B10010000 End Select Waitms 5 Portc = &B00010000 'зажигаем третье число Select Case N3 Case 0 : Portb = &B11000000 Case 1 : Portb = &B11111001 Case 2 : Portb = &B10100100 Case 3 : Portb = &B10110000 Case 4 : Portb = &B10011001 Case 5 : Portb = &B10010010 Case 6 : Portb = &B10000010 Case 7 : Portb = &B11111000 Case 8 : Portb = &B10000000 Case 9 : Portb = &B10010000 End Select Waitms 5 Loop Gifr = 128 Return End