-Example AVR Projects

Simplified AVR LCD routines

Controlling numeric LCD isn't so tricky as it may look like. O course you can find numbers of LCD libraries. One of more universal you can find in AVRLIB library for WinAVR AVR GCC compiler. Main disadvantage of such universal libraries that they compile all functions even if you don't want them. This way huge libraries occupy more program memory than you would like to. One way is to write simple routines specified only to your design.

My simple LCD library include only 8 bit mode. Each pin, connected to LCD, can be configured separately. For instance:

AVR LCD menu routine

Lets have some practice and write simple AVR LCD menu routine. For this we need to write LCD control library. I decided not to use one from AVRLIB. LCD controlling isn't difficult just a few lines of code unless you want to make it more universal.

I want to demonstrate how LCD menu control may look. Of course this isn't the best practice as it uses pretty simple logic, but may do the job.

To make it interesting I am going to have 4 buttons: 2 for menu scrolling up and down and two for changing submenu parameters. As output I am going to use three LED diodes that will light according to parameters selected in menu. Button states are going to be read using timer0 overflow interrupts. Code is written for WinAVR compiler.

Servo motor control using AVR

Servo motors are so called “closed feedback” systems. This means that motor comes with control circuit, which senses if motor mechanism is in desired location and if not it continuously corrects an error until motor reaches proper point.

Servo motors are widely used in robotics, remote controlled planes, vehicles. So they come in many shapes and sizes, but they operate in almost the same way. Usually Servo motors are controlled by computer, microcontroller or even simple timer circuit. Of course you may find more advanced servos – R/C so called radio controlled. But again, they are same servos just it takes signals from receiver.

How Servo Motor Control Works

Usually servo motors are put in plastic box, but inside there is a whole system: motor itself, gears and motor driving and control circuit.

4x4 keypad example using AVR-GCC C language

This is as simple routine how to read 4x4 keypad keys using AVR-GCC language. The keypad is connected to AVR microcontroller 8 bit port. In this example it is B port. You can change ports depending on your needs – this is only an example ant it is not the only way to this.



Subscribe to RSS - -Example AVR Projects