Download Manual - Mosaico
Transcript
limpa_lcd();
// limpa lcd
comando_lcd(0x0c);
// display sem cursor
comando_lcd(0x06);
// desloca cursor para a direita
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
Função para escrever uma frase no LCD
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void escreve_frase(const rom char *frase)
{
do
{
escreve_lcd(*frase);
}while(*++frase);
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
Tela Principal
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void tela_principal(void)
{
comando_lcd(0x80);
// posiciona o cursor na linha 0, coluna 0
escreve_frase("A/D por RC (RA5)");
comando_lcd(0xC0);
// posiciona o cursor na linha 1, coluna 0
escreve_frase("T.CARGA:
x50us");
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
Função Principal
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void main()
{
PORTA =
PORTB =
PORTC =
PORTD =
PORTE =
LATA
LATB
LATC
LATD
LATE
TRISA
TRISB
TRISC
TRISD
TRISE
=
=
=
=
=
0x00;
0x00;
0x00;
0x00;
0x00;
0x00;
0x00;
0x00;
0x00;
0x00;
=
=
=
=
=
0b11101111;
0b00001111;
0b11111111;
0b00000000;
0b00000100;
ADCON1 = 0b00001111;
//Limpa
//Limpa
//Limpa
//Limpa
//Limpa
PORTA
PORTB
PORTC
PORTD
PORTE
//Limpa
//Limpa
//Limpa
//Limpa
//Limpa
PORTA
PORTB
PORTC
PORTD
PORTE
//CONFIG
//CONFIG
//CONFIG
//CONFIG
//CONFIG
DIREÇÃO
DIREÇÃO
DIREÇÃO
DIREÇÃO
DIREÇÃO
DOS
DOS
DOS
DOS
DOS
PINOS
PINOS
PINOS
PINOS
PINOS
PORTA0
PORTB
PORTC
PORTD
PORTE
//DESLIGA CONVERSORES A/D
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
Inicialização do Sistema
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
inicializa_lcd();
tela_principal();
// configura o lcd
// imprime a tela principal no LCD
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
McMaster
162
Rev 6