Stefan Heinzmann's circuit requires only a 74HC164 8 bit shift register and a 10K trimpot to adjust the LCD's contrast.
The AVR's hardware requirements are 3 port pins:
PORTB bit 5 (LCDE) is connected to the E Clock (E) pin on the LCD module.
PORTB bit 6 (LCDDat) is connected to the register select (RS) pin on the LCD module and to the two data inputs (A and B) of
the 74HC164 shift register.
PORTB bit 7 (LCDClk) is connected to the CLK input of the 74HC164 shift register.
Any other three output port bits could be used.
It's a very simple circuit but adding a 0.1µf capacitor between the +5V and ground of the 74HC164 would be a good idea.
If you can't see any characters displayed on the LCD (and you've checked that the hardware and software are working) turn the LCD Contrast pot until you can see the characters.
Showing posts with label AVR. Show all posts
Showing posts with label AVR. Show all posts
1/24/2013
11/28/2012
Blinking LED using AVR ATmega16
Blinking a LED using 555 timer ic is simple, you can do the similar job using AVR atmega16. This is a simple program, perhaps simplest, and an introduction to ATmega16. To make a led blink you have to set (logic 1) and reset (logic 0) a pin of the controller continuously.
there's a code for blinking a LED connected to any pin of portA of the controller.
#include<avr/io.h>
#include<util/delay.h>
int main(void)
{
DDRA=0xFF; // set portA as out put
while(1) // run forever
{
PORTA=0xFF; //All the pins of portA is set
_delay_ms(1000); //wait for 1sec
PORTA=0x00; //all the pins of portA is reset
_delay_ms(1000); // wait for 1 sec
}
return(0);
}
DDR is data direct resister, DDR determines whether a particular pin of a port will work as an input or as an output, writing logic 1 to DDR makes the pin behave as output pin, writing logic 1 to DDR makes the pin behave as input pin. As we I wrote DDRA=0xFF, it will make all pins of portA work as output pin. Suppose you need only PA2 ( pin3 of portA ) as output pin, you need to write 1 to Bit 0 of data direction resister for portA (DDRA). You can write like this
DDRA=0x01;
or
DDRA|=(1<<PA2);
or
DDRA|=_BV(2);
Subscribe to:
Posts (Atom)