be80be
Well-Known Member
Joerg Wunsch wrote some lcd code I hacked to work on a attiny2313 figured I'd post this someone may want use it.
I changed the code to just work with the LCD hd44780
The zip lcd2 has all the file to use wit AtmelStudio
I changed the code to just work with the LCD hd44780
Code:
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <joerg@FreeBSD.ORG> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return. Joerg Wunsch
* ----------------------------------------------------------------------------
*
* LCD demo
*
*
*/
#include "defines.h"
#include <ctype.h>
#include <stdint.h>
#include <stdio.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <util/delay.h>
#include "lcd.h"
//#include "uart.h"
/*
* Do all the startup-time peripheral initializations.
*/
static void
ioinit(void)
{
lcd_init();
}
//FILE uart_str = FDEV_SETUP_STREAM(uart_putchar, uart_getchar, _FDEV_SETUP_RW);
FILE lcd_str = FDEV_SETUP_STREAM(lcd_putchar, NULL, _FDEV_SETUP_WRITE);
int
main(void)
{
ioinit();
stderr = &lcd_str;
fprintf(stderr, "Hello world!\n"); //prints out what you put here
}
Attachments
Last edited: