perçin
Üye
#include "C:\Documents and Settings\irfan perçin\Belgelerim\ccs_elektrik\16f676_3x7seg_cc_panelmetre.h"
//
//************************ (PANELMETRE) *****************************//
//
//
#fuses INTRC_IO, NOWDT,NOMCLR, PROTECT, BROWNOUT, PUT
#include <math.h>
#use delay(clock=4000000)
#use fast_io(a)
#use fast_io(c)
int x=0,y=0,z=0,r=0;
const int digit []={0x3f,0x06,0x1b,0x0f,0x26,0x2d,0x3d,0x07,0x3f,0x2f}; //cc
void main()
{
//long adc,i;
int16 adc,i;
setup_adc(ADC_CLOCK_INTERNAL );
setup_adc_ports(sAN0);
set_adc_channel(0);
set_tris_a(0x01);
set_tris_c(0x00);
for(;![Göz Kırp ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
{
set_adc_channel(0);
i=read_adc();
i =( i*(100.0 / 255.0));
if(i<=0)
{
i=0;
}
//--------------------------
output_high(pin_a1);
output_c(digit[x]);
if((x==0)||(x==1)||(x==7))
output_low(pin_a2);
else
output_high(pin_a2);
delay_ms(3);
output_low(pin_a1);
x=i%10;
//---------------------------
output_high(pin_a5);
output_c(digit[y]);
if((y==0)||(y==1)||(y==7))
output_low(pin_a2);
else
output_high(pin_a2);
delay_ms(3);
output_low(pin_a5);
y=(i/10)%10;
//---------------------------
output_high(pin_a4);
output_c(digit[z]);
if((z==0)||(z==1)||(z==7))
output_low(pin_a2);
else
output_high(pin_a2);
delay_ms(3);
output_low(pin_a4);
z=(i/100)%10;
}
}
//saygılar..
//
//************************ (PANELMETRE) *****************************//
//
//
#fuses INTRC_IO, NOWDT,NOMCLR, PROTECT, BROWNOUT, PUT
#include <math.h>
#use delay(clock=4000000)
#use fast_io(a)
#use fast_io(c)
int x=0,y=0,z=0,r=0;
const int digit []={0x3f,0x06,0x1b,0x0f,0x26,0x2d,0x3d,0x07,0x3f,0x2f}; //cc
void main()
{
//long adc,i;
int16 adc,i;
setup_adc(ADC_CLOCK_INTERNAL );
setup_adc_ports(sAN0);
set_adc_channel(0);
set_tris_a(0x01);
set_tris_c(0x00);
for(;
{
set_adc_channel(0);
i=read_adc();
i =( i*(100.0 / 255.0));
if(i<=0)
{
i=0;
}
//--------------------------
output_high(pin_a1);
output_c(digit[x]);
if((x==0)||(x==1)||(x==7))
output_low(pin_a2);
else
output_high(pin_a2);
delay_ms(3);
output_low(pin_a1);
x=i%10;
//---------------------------
output_high(pin_a5);
output_c(digit[y]);
if((y==0)||(y==1)||(y==7))
output_low(pin_a2);
else
output_high(pin_a2);
delay_ms(3);
output_low(pin_a5);
y=(i/10)%10;
//---------------------------
output_high(pin_a4);
output_c(digit[z]);
if((z==0)||(z==1)||(z==7))
output_low(pin_a2);
else
output_high(pin_a2);
delay_ms(3);
output_low(pin_a4);
z=(i/100)%10;
}
}
//saygılar..