Comparador Analógico(Microcontroladores)
publicado em 25 Aug 2010 15:23 por Munif Gebara Junior
int tabela[]={0b01111110,0b00001100,0b10110110,0b10011110,0b11001100,
0b11011010,0b11111000,0b00001110,0b11111110,0b11001110,
0b11101110,0b11111000,0b01110010,0b10111100,0b11110010,
0b11100010};
int baixa(int n)
{
return 5*10*n/24;
}
main(){
// 76543210
int i;
int vrbaixa=0b10100000;
CMCON=0b00101010;
TRISA=0b00111111;
TRISB=0b00000001;
PORTB=tabela[3];
Delay_ms(300);
PORTB=tabela[2];
Delay_ms(300);
PORTB=tabela[1];
Delay_ms(300);
for(;;)
{
for (i=0;i<16;i++)
{
VRCON=vrbaixa|i;
if (CMCON.F7==0){
PORTB=tabela[baixa(i)/10];
Delay_ms(300);
PORTB=tabela[baixa(i)%10];
Delay_ms(300);
PORTB=0;
Delay_ms(100);
break;
}
}
}
}
comparador.zip (Arquivo do Artigo Comparador Analógico) tamanho:33762 bytes Upload em 25/08/2010 15:24
carro.zip (Exemplo Tanque e Velocimetro) tamanho:22258 bytes Upload em 25/08/2010 16:39