Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
C Programming for microcontrollers (Joe Pardue, 2005).pdf
Скачиваний:
277
Добавлен:
12.08.2013
Размер:
4.55 Mб
Скачать

Chapter 11 The Butterfly LCD

Chapter 11 The Butterfly LCD

I read a book (I think it was David Brin’s ‘Practice Effect’) where some primitive people found a digital watch with an LCD display. They were amazed that whoever made the thing was able to train all the little black bugs to run around and align themselves in such peculiar patterns. And that’s the extent of the detail I’ll give on the underlying technology of LCDs. We’ll concentrate instead on using C to train the little black bugs to do our tricks. If you must know the magic, then Atmel has an application note: AVR065: LCD Driver for the STK502 and AVR Butterfly available from their website that will get you deep into the gory details. And the Atmega169 data book has a nice chapter ‘LCD Controller’ that is a sure cure for insomnia.

To keep our ignorance even more intact we will begin by using software based on the LCD-Test software available on http://www.siwawi.arubi.unikl.de/avr_projects/#bf_app noting that the main.c file begins with the confidence building:

// mt - used for debugging only - may not work

However, with a few changes and some shoehorning it all into a demonstrator module, it works just fine. We use these functions without attempting to understand them. Another way to say this is that we will enhance our productivity by reusing existing code and conform to object oriented principles by not allowing ourselves to mess with perfectly good software.

Functions at our disposal in LCD_functions module:

void LCD_putc(uint8_t digit, char character); o Writes a character to the LCD digit

void LCD_puts(char *pStr, char scrollmode); o Writes a string to the LCD

o *pStr is a pointer to the string o scrollmode is not used

void LCD_puts_f(const char *pFlashStr, char scrollmode); o Writes to the LCD a string stored in flash

o *pFlashStr is a pointer to the flash string

261