0
I wanted to write a few words on a 2x16 LCD Display, I already have the code I’m going to expose here, but I don’t know why this gives me a mistake:
HD44780 ERROR: Neither 'Set DDRAM ADDRESS' nor 'Set CGRAM ADDRESS' Instruction was issued prior to the write Instruction.
I’ve been in other projects, and I don’t know what it means or what I might be wrong with. Here is my code:
#include "sdcc_reg420.h"
#define LCD_PORT P1
#define En P3_5
#define RS P3_1
#define RW P3_0
void LCD_comando(unsigned char comando);
void LCD_init (void);
void LCD_date(char letra);
//void inicio ();
void LCD_init (void) //inicialização do LCD
{
LCD_comando(0b00111000); //duas linhas e caracteres 5x7
LCD_comando(0b00001111); //cursor ON,DisplayON, Piscar ON
LCD_comando(0b00000001); //Limpar o LCD
LCD_comando(0b00000110); //modo de entrada de dados: em incremento e Shift total off
LCD_comando(0b10000000); //modo de entrada de dados: endreço inicial da memoria DDRAM
}
void LCD_comando(unsigned char comando)
{
LCD_PORT=comando;
RS=0;
RW=0;
En=0;
En=1;
}
void LCD_date(char letra)
{
LCD_PORT=letra;
RS=1;
RW=0;
//En=0;
En=1;
}
void main (void)
{
LCD_date(' ');
LCD_date(' ');
LCD_date('B');
LCD_date('O');
LCD_date('M');
LCD_date('B');
LCD_date('A');
LCD_date('S');
LCD_date('T');
LCD_date('I');
LCD_date('C');
LCD_date('O');
LCD_date(' ');
LCD_date(' ');
LCD_date(' ');
LCD_date(0);
LCD_comando(0b11000000);
LCD_date(' ');
LCD_date(' ');
LCD_date('A');
LCD_date('N');
LCD_date('A');
LCD_date(' ');
LCD_date('C');
LCD_date(' ');
LCD_date('M');
LCD_date('A');
LCD_date(' ');
LCD_date(' ');
}
The IDE I’m using is MCU 8051, I’d appreciate your help.
Here’s the new code:
– Ana Costa
Enter this room: http://chat.stackexchange.com/rooms/19749/discussa-mutley-e-ana-costa
– mutlei
Could you tell me which compiler you are using? If you are using avr-gcc, I think I can help you.
– Avelino