martes, 27 de diciembre de 2016

PROGRAMACIÓN DE PIC 16F77A



HOLA SALUDOS A TODOS LOS  QUE TENGAN QUE VISITAR MI BLOGGER. LES DEJARE UNOS  AVANSES SOBRE LA PROGRAMACIÓN DEL PIC 16F77A QUE ES MUY CONOCIDO Y ADECUADO.





PARA  HACER QUE TE APAREZCA O TE ESCRIBA UNA PALABRA EN  LCD FILA 1



sbit LCD_RS at RB0_bit;
sbit LCD_EN at RB1_bit;
sbit LCD_D4 at RB2_bit;
sbit LCD_D5 at RB3_bit;
sbit LCD_D6 at RB4_bit;
sbit LCD_D7 at RB5_bit;

sbit LCD_RS_direction at TRISB0_bit;
sbit LCD_EN_direction at TRISB1_bit;
sbit LCD_D4_direction at TRISB2_bit;
sbit LCD_D5_direction at TRISB3_bit;
sbit LCD_D6_direction at TRISB4_bit;
sbit LCD_D7_direction at TRISB5_bit;


void main() {

   LCD_Init();
   LCD_Cmd(_LCD_CURSOR_OFF);
   LCD_chr_Cp('h');
   delay_ms(400);
   LCD_chr_Cp('o');
   delay_ms(400);
   LCD_chr_Cp('l');
   delay_ms(400);
   LCD_chr_Cp('a');
   delay_ms(400);
}



PARA  HACER  QUE TE INACIALIZE EN LAS DOS FILAS LOS COMANDOS INDICADOS  FILA 1 Y 2


sbit LCD_RS at RB0_bit;
sbit LCD_EN at RB1_bit;
sbit LCD_D4 at RB2_bit;
sbit LCD_D5 at RB3_bit;
sbit LCD_D6 at RB4_bit;
sbit LCD_D7 at RB5_bit;

sbit LCD_RS_direction at TRISB0_bit;
sbit LCD_EN_direction at TRISB1_bit;
sbit LCD_D4_direction at TRISB2_bit;
sbit LCD_D5_direction at TRISB3_bit;
sbit LCD_D6_direction at TRISB4_bit;
sbit LCD_D7_direction at TRISB5_bit;

void main() {
  LCD_Init();
   LCD_Cmd(_LCD_CURSOR_OFF);
   LCD_chr(1,3,'h');
   delay_ms(400);
   LCD_chr(1,4,'o');
   delay_ms(400);
   LCD_chr(1,5,'l');
   delay_ms(400);
   LCD_chr(1,6,'a');
   delay_ms(400);
  
   LCD_chr(2,3,'m');
   delay_ms(400);
   LCD_chr(2,4,'u');
   delay_ms(400);
   LCD_chr(2,5,'n');
   delay_ms(400);
   LCD_chr(2,6,'d');
   delay_ms(400);
   LCD_chr(2,7,'o');
   delay_ms(400);
}



DE LA FORMA MAS RÁPIDA Y SEGURA PARA HACER QUE  UNA PALABRA SE SALGA MAS RÁPIDO  SIN ESTAR ESCRIBIENDO UNA TRAS LA OTRA SIN UTILIZAR “CP” EN ESE CASO YA LO  BORRAMOS


sbit LCD_RS at RB0_bit;
sbit LCD_EN at RB1_bit;
sbit LCD_D4 at RB2_bit;
sbit LCD_D5 at RB3_bit;
sbit LCD_D6 at RB4_bit;
sbit LCD_D7 at RB5_bit;

sbit LCD_RS_direction at TRISB0_bit;
sbit LCD_EN_direction at TRISB1_bit;
sbit LCD_D4_direction at TRISB2_bit;
sbit LCD_D5_direction at TRISB3_bit;
sbit LCD_D6_direction at TRISB4_bit;
sbit LCD_D7_direction at TRISB5_bit;


void main() {

   LCD_Init();
   LCD_Cmd(_LCD_CURSOR_OFF);
   while (1){
    LCD_Out(1,4,"hola mundo");
    delay_ms(100);
   
     LCD_Out(2,1,"bienvenidos IDAT");
     delay_ms(100); 
   }
}




PARA REPRESENTAR LA TEMPERATURA

sbit LCD_RS at RB0_bit;
sbit LCD_EN at RB1_bit;
sbit LCD_D4 at RB2_bit;
sbit LCD_D5 at RB3_bit;
sbit LCD_D6 at RB4_bit;
sbit LCD_D7 at RB5_bit;

sbit LCD_RS_direction at TRISB0_bit;
sbit LCD_EN_direction at TRISB1_bit;
sbit LCD_D4_direction at TRISB2_bit;
sbit LCD_D5_direction at TRISB3_bit;
sbit LCD_D6_direction at TRISB4_bit;
sbit LCD_D7_direction at TRISB5_bit;


void main() {
   int temp =25;
   float Text [10];
   LCD_Init();
   LCD_Cmd(_LCD_CURSOR_OFF);
   while (1){
    LCD_Out(1,4,"TEMPERATURA");
    IntToStr(temp,Text);
    LCD_Out(2,5,Text);
    delay_ms(100);
}
}






















AUTOR: JHANCARLOS RAMOS COTRINA



No hay comentarios.:

Publicar un comentario