bigdogguru
Administrator
- Joined
- Mar 12, 2010
- Messages
- 9,821
- Helped
- 2,350
- Reputation
- 4,694
- Reaction score
- 2,272
- Trophy points
- 1,413
- Location
- Southwest, USA
- Activity points
- 62,383
Now it's blank. This is my modified code.
//Program to Display string on LCD using AVR Microcontroller (ATmega16)
/*
LCD DATA port----PORT B
signal port------PORT D
rs-------PD0
rw-------PD1
en-------PD2
*/
#include<avr/io.h>
#include<util/delay.h>
#define LCD_DATA PORTB //LCD data port
#define ctrl PORTD
#define en PD2 // enable signal
#define rw PD1 // read/write signal
#define rs PD0 // register select signal
void LCD_cmd(unsigned char cmd);
void init_LCD(void);
void LCD_write(unsigned char data);
int main()
{
DDRB=0xff;
DDRD=0x07;
_delay_ms(20);
init_LCD(); // initialization of LCD
_delay_ms(50); // delay of 50 mili seconds
LCD_write_string("Welcome"); // function to print string on LCD
while(1); <-- Insert while loop to prevent program from exiting
}
...
...
That is actually good news, it indicates you were at least partial successful in initializing the LCD. Now as ckshivaram mentioned you need to replace the "return 0;" with a "while(1);" statement.
You never want to allow the program to exit from execution on a device without an OS. What will take control of the execution of processes if it did?
BigDog