Tek Buton ile keypad tuş takımı ccs compiler
#include <12f683.h>
#device ADC=8
#fuses NOWDT,INTRC_IO,NOMCLR,BROWNOUT
#use delay (clock=4000000)
#use rs232(baud=9600,parity=N,xmit=PIN_A1,rcv=PIN_A2,bits=8,stop=1)
#use fast_io(a)
unsigned long int okunan;
int voltaj;
void main ( )
{
set_tris_a(0x01);
output_a(0x01);
setup_adc(adc_clock_div_32);
setup_adc_ports(sAN0);
while(true)
{
set_adc_channel(0);
delay_us(20);
okunan = read_adc();
voltaj = (okunan * 0.00488)*100;
//printf("\f%d\n\n",voltaj);
if(voltaj==113)
printf("\f \n 0");
if(voltaj==103)
printf("\f \n 1");
if(voltaj==95)
printf("\f \n 2");
if(voltaj==88)
printf("\f \n 3");
if(voltaj==82)
printf("\f \n 4");
if(voltaj==78)
printf("\f \n 5");
if(voltaj==73)
printf("\f \n 6");
if(voltaj==69)
printf("\f \n 7");
if(voltaj==65)
printf("\f \n 8");
if(voltaj==62)
printf("\f \n 9");
delay_ms(400);
}
}
Hiç yorum yok:
Yorum Gönder
Her yorum bilgidir. Araştırmaya devam...