# AVR_ATMEGA_1602LCD

A small library/program for using the 1602 LCD display in 4 bit mode.

## Hardware:

- LCD 1602 ADM1602K-NSW-FBS-3.3v or ADM1602K-NSW-FBS-5.0v
- AVR Micro-controller

## Supported Controllers:

List of supported controllers:
___
- ATMega48 
- ATMega88 
- ATMega168 
- ATMega328

___

## Usage:

```C
#include "AVR_ATMEGA_1602LCD.h"

void do_stuff() {
    PORTD = 0x00;
    DDRD = 0xff;
    init_lcd();
    
    return_home_lcd();
    set_entry_mode_increment_lcd();
   
    //Refernce the datasheet for charecter codes. 
    write_lcd_address(0x7f);    //Right pointing arrow 
    
    //wait a bit.
    _delay_ms(1000);

    //clear it up
    clear_lcd();
    return_home_lcd();

    //Do more stuff...
}
```
![Alt text](1602_LCD.jpg "1602 LCD DEMO")
## RoadMap:

4. ADD function to print strings
5. ADD function to display bit images
6. ADD function to act as a loading screen.
7. ADD animations
8. ADD PWM control for contrast
9. ADD PWM control for backlight


## ISSUES:

Currently during powerloss events and initialization, long wire runs or 
residual charge can cause the LCD to maintain memory for a short duration.

In 4bit mode it's possible to end up with a invalid "nibble" in the LCD memory
in this case the system should power cycle the LCD unit assuming it's 
controlled by the microcontroller.


