perçin
Üye
// irfan perçin
#fuses XT, noPROTECT, NOWDT
#include <math.h>
#use delay(clock=4000000)
int x=0, y=0,z=0,r=0;
const int digit[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; //CC DİSP
void main()
{
long adc,i;
setup_adc( ADC_CLOCK_INTERNAL );
setup_adc_ports( AN0 );
delay_ms(20);
set_adc_channel(0);
//--------------------------------
for(;
{
set_adc_channel(0);
adc = read_adc();
i =( adc*(499.0 / 255.0));
output_high(pin_c0);
output_b(digit[x]);
delay_ms(3);
output_low(pin_c0);
x=i%10;
//--------------------------------
output_high(pin_c1);
output_b(digit[y]);
delay_ms(3);
output_low(pin_c1);
y=(i/10)%10;
//--------------------------------
output_high(pin_c2);
output_b(digit[z]);
delay_ms(3);
output_low(pin_c2);
z=(i/100)%10;
//-------------------------------
output_high(pin_c3);
output_b(digit[r]);
delay_ms(3);
output_low(pin_c3);
r=(i/1000)%10;
}
}
#fuses XT, noPROTECT, NOWDT
#include <math.h>
#use delay(clock=4000000)
int x=0, y=0,z=0,r=0;
const int digit[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; //CC DİSP
void main()
{
long adc,i;
setup_adc( ADC_CLOCK_INTERNAL );
setup_adc_ports( AN0 );
delay_ms(20);
set_adc_channel(0);
//--------------------------------
for(;
{
set_adc_channel(0);
adc = read_adc();
i =( adc*(499.0 / 255.0));
output_high(pin_c0);
output_b(digit[x]);
delay_ms(3);
output_low(pin_c0);
x=i%10;
//--------------------------------
output_high(pin_c1);
output_b(digit[y]);
delay_ms(3);
output_low(pin_c1);
y=(i/10)%10;
//--------------------------------
output_high(pin_c2);
output_b(digit[z]);
delay_ms(3);
output_low(pin_c2);
z=(i/100)%10;
//-------------------------------
output_high(pin_c3);
output_b(digit[r]);
delay_ms(3);
output_low(pin_c3);
r=(i/1000)%10;
}
}