Step 3Using the LCD Add-on
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
#define LCD_PORT PORTB
#define LCD_DATA0_PIN 4 #define LCD_DATA1_PIN 5 #define LCD_DATA2_PIN 6 #define LCD_DATA3_PIN 7
#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/fleuryI 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 Step | Download PDFView All Steps | Next Step » |
4
comments
|
Add Comment
|
![]() |
Add Comment
|














































