Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 1

5.

TEMPORZADORES
// Modulo de conexion del LCD al PIC
sbit LCD_RS at RB5_bit;
sbit LCD_EN at RB4_bit;
sbit LCD_D4 at RB3_bit;
sbit LCD_D5 at RB2_bit;
sbit LCD_D6 at RB1_bit;
sbit LCD_D7 at RB0_bit;
sbit LCD_RS_Direction at TRISB5_bit;
sbit LCD_EN_Direction at TRISB4_bit;
sbit LCD_D4_Direction at TRISB3_bit;
sbit LCD_D5_Direction at TRISB2_bit;
sbit LCD_D6_Direction at TRISB1_bit;
sbit LCD_D7_Direction at TRISB0_bit;
// Fin Modulo de conexion del LCD al PIC
void main(void)
{
int cont0, cont1;
char txtcont[20],txtmsg[20];
//===Configuracion del PIC18F4550 como Digital=========
ADCON1 |= 0x0F; // Configacion de puertos como Digital
CMCON |= 7; // Comparadores Desabilitados
//===Configuracion del PIC18F4550 como Digital========
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
TMR0ON;
TMR1ON;
T1CON=0b00000111;
TMR0L=0;
TMR1L=0;
while(1)
{
IntToStr(TMR0L,txtcont);
StrCpy(txtmsg,"TMR0: ");
StrCat(txtmsg,txtcont);
Lcd_Out(1,1,txtmsg);

IntToStr(TMR1L,txtcont);
StrCpy(txtmsg,"TMR1: ");
StrCat(txtmsg,txtcont);
Lcd_Out(2,1,txtmsg);
}
}

You might also like