In this article will propose to explore the power of the Arduino board with experiments, including circuitry and software, moving further to a high-level activity than just a simple demonstration. With a little effort and few of components Arduino is the ideal tool to solve a lot of problems whereas other alternative solutions may be more expansive.
One of the limitations of the small 8 bit microcontrollers like the Atmel ATMega family adopted by the Arduino Uno board, is the reduced number of I/O ports. Among the main advantages of these microcontrollers, they are cheap, robust, and simple to program. Therefore, also Arduino Uno or one of its clones are cheap as well.
Microcontrollers in industrial applications are frequently used to manage almost simple circuits dedicated to a single task. Arduino Uno board has the sufficient number of pins to manage an alphanumeric LCD. In a complex industrial machine architecture that is more than sufficient.
Table of Contents
Shift Register
The shift register is an easy-to-manage component. As a matter of fact there are two types of shift registers, shift-in and shift-out parallel registers.
Shift-in means that all the 8 bits (corresponding to 8 pins) can be set together and serially read from the input data pin Shift-out is the opposite, it can send 8 bits serially to the output data pin shifted to the parallel 8-bits of the output pins Regardless of the type of shift-register, just there are three pins are used in Arduino Uno board. One pin is used for the serial data and the other two act like a clock to notify to the shift-register when a bit is ready to be shifted (shift-out) or the microcontroller is ready to acquire a new bit for reading.
Another important aspect is the name of the component, register. In the assembler language a register is usually a place where a series of bits are stored for special purpose. In fact, the shift-registers not only are able to shift in one direction a certain number of bits but the bit status of every pin is persistent until another byte has not been completely sent or received. At this point, the LCD device will be connected with the 8-bits of the shift register.
Wiring Diagram
Here is quick wiring diagram.
Source Code
Here is source code (sketch) for this project.
/*
Program LCD SPI
Arduino Uno 74HC595 shift Register
Loki Lang
*/
#include <SPI.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(10);
void setup()
{
lcd.begin(16, 2);
lcd.print("Hello world!");
delay(1000);
lcd.clear();
}
void loop()
{
lcd.setCursor(0, 0);
lcd.print("Arduino SPI");
lcd.setCursor(0, 1);
lcd.print("74HC595");
}
Program LCD SPI
Arduino Uno 74HC595 shift Register
Loki Lang
*/
#include <SPI.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(10);
void setup()
{
lcd.begin(16, 2);
lcd.print("Hello world!");
delay(1000);
lcd.clear();
}
void loop()
{
lcd.setCursor(0, 0);
lcd.print("Arduino SPI");
lcd.setCursor(0, 1);
lcd.print("74HC595");
}
Library which is used in this project, can be downloaded here.