lunes, 12 de marzo de 2018

/*
LCD MikroC PIC18F2550
*/


unsigned int i = 0;
unsigned int temp_res=0;
unsigned int temp_average=0;
float temperature = 0;

// LCD module connections
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RC0_bit;
sbit LCD_D5 at RC1_bit;
sbit LCD_D6 at RC2_bit;
sbit LCD_D7 at RC6_bit;
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISC0_bit;
sbit LCD_D5_Direction at TRISC1_bit;
sbit LCD_D6_Direction at TRISC2_bit;
sbit LCD_D7_Direction at TRISC6_bit;
// End LCD module connections
char txt1[] = "STARTING";
char txt2[10];
char txt3[15];



void main() {
 PORTC = 0;
 LATC = 0;
 TRISC = 0x00;
 PORTA = 0;
 CMCON = 0;
 TRISA  = 0xFF;
 ADCON1 = 0x0E;  //  entradas digitales // 0xE
 PORTB = 0;
 TRISB = 0xCF;

Lcd_Init();                        // Initialize LCD
Lcd_Cmd(_LCD_CLEAR);               // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF);          // Cursor off
Lcd_Out(1,1,txt1);                 // Write text in first row
Delay_ms(300);
Lcd_Cmd(_LCD_CLEAR);               // Clear display
Lcd_Out(1,1,"DR:");                // Write text in first row
Lcd_Out(2,1,"CARLOS HERNANDEZ");   // Write text in first row
Delay_ms(2000);
Lcd_Cmd(_LCD_CLEAR);

  while(1) {   
        //adc_temperature();
        i++;
        IntToStr(i, txt2);
        Lcd_Out(2,0,txt2);
        delay_ms(500);
        if(i==100){
        i=0;
        }
  }
}


No hay comentarios.:

Publicar un comentario

BTFSS INSTRUCTION  IN ASSEMBLER FOR PIC18F In this sample, we show that how to use a switch input to make an action. Remember that I...