< back to home

Output devices

Goals

LCD module

This week I tried to connect an LCD display to my board: the ability to have an immediate textual feedback from my boards seems quite appealing to me.
I took the example board avaible on the archive and made some minor changes:

  • I removed the voltage regulator because I planned to power my board from USB (via my fabISP or using the VCC and GND headers on my hello board
  • I then added 2 headers for VCC and GND, because I was afraid that my previous decision was a big mistake
  • Added a power led
  • Added a (yet) useless button (the plan was to make it interact with the LCD)

In order to get the wiring for the lcd headers right I had to check the datasheet: the answers I was looking for were provided by this two drawings:


This is the board I ended with:



I stuffed it and loaded the C code from the archive onto it, in order to check my handywork

            
sgrc@t420:~/fabacademy2017/doc/week10/code/lcd-board01$ ls
hello.LCD.44.c  Makefile
sgrc@t420:~/fabacademy2017/doc/week10/code/lcd-board01$ lsusb
Bus 002 Device 005: ID 17ef:1003 Lenovo Integrated Smart Card Reader
Bus 002 Device 004: ID 0bdb:1911 Ericsson Business Mobile Networks BV 
Bus 002 Device 003: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 005: ID 04f2:b221 Chicony Electronics Co., Ltd integrated camera
Bus 001 Device 004: ID 0a5c:217f Broadcom Corp. BCM2045B (BDC-2.1)
Bus 001 Device 003: ID 147e:2016 Upek Biometric Touchchip/Touchstrip Fingerprint Sensor
Bus 001 Device 022: ID 1781:0c9f Multiple Vendors USBtiny
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
sgrc@t420:~/fabacademy2017/doc/week10/code/lcd-board01$ avrdude -p t44 -c usbtiny

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9207 (probably t44)

avrdude: safemode: Fuses OK (E:FF, H:DF, L:62)

avrdude done.  Thank you.

sgrc@t420:~/fabacademy2017/doc/week10/code/lcd-board01$ make
avr-gcc -mmcu=attiny44 -Wall -Os -DF_CPU=20000000 -I./ -o hello.LCD.44.out hello.LCD.44.c
avr-objcopy -O ihex hello.LCD.44.out hello.LCD.44.c.hex;\
avr-size --mcu=attiny44 --format=avr hello.LCD.44.out
AVR Memory Usage
----------------
Device: attiny44

Program:     468 bytes (11.4% Full)
(.text + .data + .bootloader)

Data:          2 bytes (0.8% Full)
(.data + .bss + .noinit)


sgrc@t420:~/fabacademy2017/doc/week10/code/lcd-board01$ make program-usbtiny-fuses 
avr-objcopy -O ihex hello.LCD.44.out hello.LCD.44.c.hex;\
avr-size --mcu=attiny44 --format=avr hello.LCD.44.out
AVR Memory Usage
----------------
Device: attiny44

Program:     468 bytes (11.4% Full)
(.text + .data + .bootloader)

Data:          2 bytes (0.8% Full)
(.data + .bss + .noinit)


avrdude -p t44 -P usb -c usbtiny -U lfuse:w:0x5E:m

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9207 (probably t44)
avrdude: reading input file "0x5E"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0x5E:
avrdude: load data lfuse data from input file 0x5E:
avrdude: input file 0x5E contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified

avrdude: safemode: Fuses OK (E:FF, H:DF, L:5E)

avrdude done.  Thank you.

sgrc@t420:~/fabacademy2017/doc/week10/code/lcd-board01$ make program-usbtiny
program-usbtiny        program-usbtiny-fuses  
sgrc@t420:~/fabacademy2017/doc/week10/code/lcd-board01$ make program-usbtiny
avr-objcopy -O ihex hello.LCD.44.out hello.LCD.44.c.hex;\
avr-size --mcu=attiny44 --format=avr hello.LCD.44.out
AVR Memory Usage
----------------
Device: attiny44

Program:     468 bytes (11.4% Full)
(.text + .data + .bootloader)

Data:          2 bytes (0.8% Full)
(.data + .bss + .noinit)


avrdude -p t44 -P usb -c usbtiny -U flash:w:hello.LCD.44.c.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9207 (probably t44)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "hello.LCD.44.c.hex"
avrdude: input file hello.LCD.44.c.hex auto detected as Intel Hex
avrdude: writing flash (468 bytes):

Writing | ################################################## | 100% 0.55s

avrdude: 468 bytes of flash written
avrdude: verifying flash memory against hello.LCD.44.c.hex:
avrdude: load data flash data from input file hello.LCD.44.c.hex:
avrdude: input file hello.LCD.44.c.hex auto detected as Intel Hex
avrdude: input file hello.LCD.44.c.hex contains 468 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 1.01s

avrdude: verifying ...
avrdude: 468 bytes of flash verified

avrdude: safemode: Fuses OK (E:FF, H:DF, L:5E)

avrdude done.  Thank you.
            
          

And the default hello word text appeared on my board

Writing my own code

Yet to be done. I originally planned to skip arduino sketches altogether and write my own C code, but I'm afraid that is a long term

Links

  • Week 10 files - archive containing all the working files (.sch and .brd)