هذا كود تم تجربتة وهو يعمل وانا اعتقد انة بسيط
كود:
program temp
const NO_Segment as word[10] = (1,79,18,6,76,36, 32, 15,0,4)
'const NO_Segment as word[10] = (121,36,48,25,18,2,120,0,16,64)
dim input_ADC0 , i as word
dim LED1 , LED2 , LED3 , LED4 as word
'ADCON1=0X06
ADCON1 = $80
TRISB = 0
TRISC = 0
TRISE = 0
TRISD = 0
PORTA = 255
input_ADC0 = 0
main:
input_ADC0 = Adc_Read(0)
input_ADC0 = (input_ADC0*10)/2
LED1 = (input_ADC0 div 1) mod 10
LED2 = (input_ADC0 div 10) mod 10
LED3 = (input_ADC0 div 100) mod 10
' LED4 = (input_ADC0 div 1000) mod 10
for i =1 to 100
PORTC = 1
PORTE.0 = 1
PORTB = NO_Segment[LED1]
gosub Delay
PORTC = 2
PORTE.0 = 0
PORTB = NO_Segment[LED2]
gosub Delay
PORTC = 4
PORTE.0 = 1
PORTB = NO_Segment[LED3]
gosub Delay
PORTC = 8
PORTE.0 = 1
' PORTB = NO_Segment[LED4]
PORTB = 98
gosub Delay
next i
goto main
Delay:
Delay_ms(1)
return
end.
هذا ملف البيسك والبروتس
DOWNLOAD - __________ __________.rar
.