1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

AtmelStudio and LCD hd44780

Discussion in 'AVR' started by be80be, Aug 5, 2017.

  1. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,829
    Likes:
    138
    Location:
    morristown,tn
    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
    Code (text):

    /*
     * ----------------------------------------------------------------------------
     * "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

     
    }

     
    The zip lcd2 has all the file to use wit AtmelStudio
     

    Attached Files:

    Last edited: Aug 5, 2017

Share This Page