3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

How to use the Dragon Rider 500 with your AVR Dragon

Step 3Using the LCD Add-on

Using the LCD Add-on
Here's a simple way to use the LCD Add-on. This will write "Dragon Rider" to the LCD screen.

Hardware:

  • ATtiny2313
  • R/W Jumper: R/W should be connected to "BIT1" on the Dragon Rider Board (See explaination in the Assembly Instructable)
  • J23: This jumper must be installed for ISP programming but then removed for the LCD to function properly.
  • Connect LCD to PORT B using ribbon cable (J31 to J2)

Software

I am using Peter Fleury's LCD library to drive the LCD in 4-bit mode. Check out Peter's Homepage to download the library.

You will need to make sure that lcd.c is compiled with your code and that you make the following changes to lcd.h:
  • We are using the internal RC oscillator so XTAL needs to be set for 1MHz:
  •   #define XTAL 1000000
  • Port settings need to be adjusted to PORTB:
  •   #define LCD_PORT         PORTB
  • Pinout for 4 data lines needs to be adapted:
  •   #define LCD_DATA0_PIN    4  #define LCD_DATA1_PIN    5  #define LCD_DATA2_PIN    6  #define LCD_DATA3_PIN    7
  • Pinout for RS, RW, and E needs to be adapted:
  •   #define LCD_RS_PIN      3  #define LCD_RW_PIN      1  #define LCD_E_PIN       2

The main program is very simple thanks to the work Peter Fleury did in his LCD library.

CODE:
#include <avr/io.h>#include "lcd.h"int main(void){  lcd_init(LCD_DISP_ON);  //Initialize LCD with the cursor off  lcd_clrscr();           //Clear the LCD screen  lcd_gotoxy(5,0);        //Move cursor to this location  lcd_puts("Dragon");     //Put this string on the LCD  lcd_gotoxy(6,1);        //Move cursor to this location  lcd_puts("Rider");      //Put this string on the LCD  for (;;)  {    // Do nothing forever (Message already displayed on LCD)  }}

Code Attached

The code attached includes Peter Fleury's LCD library (lcd.c and lcd.h) with his permission. Thank you Peter! The only alteration I have made to it is to set the proper pins in the Defines. Please visit his site to download the package: http://www.jump.to/fleury

I have also included a makefile that I use written by Eric B. Weddington and, Jorg Wunsch. I sent a PM to Jorg over at avrfreaks.net but never received a response from him. There are a few changes in the makefile to tailor to using Linux and the Dragon. Thank you to you both, please set me know your preferences on me sharing your work.
« Previous StepDownload PDFView All StepsNext Step »
4 comments
Dec 10, 2008. 4:59 PMMaarek says:
What changes would you make if you wanted to use the LCD through PortD on the 2313? PortD has a range of 0-6 and not 0-7. Maybe it is not possible with the dragon rider seeing as Pin 8 on J31 is DB7 on the LCD but there is no Pin 7 on PortD. I'm not quite sure what goes to Pin 8 on J4.
Dec 11, 2008. 7:37 AMMaarek says:
Ah, yes. I will give that a shot. I'm just trying to get it to work off port D before I throw it all on a breadboard and start playing with my new 4x20 HD44780 display. I wonder why he shifted it up a pin, keeping pin 1 free on the header j31?

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
41
Followers
6
Author:barney_1