AVR ASM LCD Test

Don't let that title scare you :)

I've had my Arduino for quite a while now, and haven't really done anything interesting with it besides simple input/output tests. That changed a few days ago when I received my new HD44780 compatible LCD display. It's a 16x2 character display with 5x8 dots per character. I really wanted to have one of these since it makes it so much easier and cooler to show output from an Arduino.

So after I connected my LCD, I toyed around with it and quickly found out that in the Arduino IDE there's a built-in library for handling HD44780 compatible LCD's. This made it really easy to communicate with it, but also really boring, and it wasn't much of a challenge. That's why I recently started looking into the AVR (The micro controller on the Arduino) assembly language, and the workings of the processor. This was really interesting because I now know so much more about the AVR micro controllers, and programming such a piece of hardware in direct machine code is just awesome.

I read some tutorials and the data sheet of the processor, and I was quickly able to light a led at the push of a button, and do other simple things. But of course, this wasn't enough, I wanted to try to communicate with the LCD directly using assembly, and be able to write text to it. This was a hard task since debugging on this thing is near impossible, but in the end it worked out. :)

Here's my code. All it does is display a short string on the display and loop infinitely.

If you want to use it, please do. It's under public domain so do with it whatever you want.

LCD Test.

I've also used this display for another project: communicating between a TI-84+ calculator and an arduino using only assembly on both sides (Z80 and AVR assembly respectively).

I'm not using UART to communicate here, which would have made it easier on the AVR side. I'm using my own 'protocol' (if you can call it that), I'm just sending the bytes bit by bit through the ring, while the tip indicates the status.

For those wondering, the baudrate is currently around 56. I could use shorter delays on the Z80 side, but that would be more complicated code, and this was only a test. The implementation is far from optimal.

A video for that can be seen below:

The source code of the calculator side can be found here. I've sadly lost the AVR assembly code for the arduino side of the project, but it's relatively simple so that'll be left as an exercise to the reader. The hard part is writing to the display, not the communication, and you can find my sample code for that above.