Created
March 25, 2019 18:57
-
-
Save HectorTorres/64f26d710dd27c6ff474b6370228d929 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include avr/io.h | |
#define F_CPU 1000000UL | |
#include delay.h | |
#include string.h | |
#define LCD_PINES PORTB //PUERTO DONDE SE CONECTA PINES D0 A D7 | |
#define RS_ON PORTC // SE MANDA UN 1 A PIN RS | |
#define RS_0FF PORTC //SEMANDA UN 0 A PIN RS | |
#define ENABLE_ON PORTC //SE MANDA UN 1 A PIN ENABLE | |
#define ENABLE_OFF PORTC //SEMANDA UN 0 A PIN ENABLE | |
void CARACTERES(char p[16]); | |
void INICIALIZAR(char k); | |
void ENVIAR_DATOS(char d); | |
int main(void) | |
{ | |
DDRB=0xFF; | |
DDRC = 0x03; | |
_delay_ms(200); //ESPERAR PARA CONFIGURACION | |
INICIALIZAR(0x38); //ESTABLECER CONFIGURACION PARA 8 BITS Y DOS LINEAS | |
INICIALIZAR(0x0C); //REGRESAR A PANTALLA | |
INICIALIZAR(0x01); //LIMPIAR LCD | |
INICIALIZAR(0x80); //MOVER CURSOR A LA LINEA 1 | |
_delay_ms(1000); //INICIALIZAR LCD | |
CARACTERES("HETPRO-STORE.COM"); | |
INICIALIZAR(0xC0); //MOVER A LINEA 2 | |
CARACTERES(" ELECTRONICA "); | |
while(1); | |
} | |
void INICIALIZAR(char k) | |
{ | |
RS_0FF; // | |
ENVIAR_DATOS(k); | |
} | |
void ENVIAR_DATOS(char d) | |
{ | |
LCD_PINES =d; | |
ENABLE_ON; | |
_delay_ms(20); | |
ENABLE_OFF; | |
_delay_ms(20); | |
} | |
void CARACTERES(char p[16]) | |
{ | |
int i; | |
RS_ON; // | |
for(i=0;i<p);i++) | |
{ | |
ENVIAR_DATOS(p[i]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment