A course of six tutorials in the use of the ez_SIPO8_lib
library for managing and controlling single or multiple shift registers in a cascade, or multiple arrangements of shift registers concurrently.
Before We StartA word of caution:
These tutorials and the User Guide limits themselves to the use and implementation of the SIPO8 library capabilities, they do not cover considerations regarding the connection of SIPO outputs to components other than standard LEDs, e.g. relays or other components – care needs to be applied here in matching the particular SIPOs ICs used, the components they are to connect to and overall power requirements which may be beyond that of the connected microcontroller.
The internet provides a significant amount of material covering the above and the reader is recommended to do a little research around such issues before under taking anything but simple projects using LEDs.
Whilst the example sketches referenced within these tutorials are configured for Arduino microcontrollers, they should be equally applicable for ESP 32 boards also.
If you wish to explore the ez_SIPO8_lib
Library article on the Project Hub then follow this link.
This article introduces a series of six tutorials featuring the capabilities of the ez_SIPO8_lib
library for managing and controlling shift registers, or Serial-In/Parallel Out (SIPO) ICs. The concepts of the library's design and application differs from existing resources and methods in that it will provide for support for:
- many concurrent SIPO ICs, theoretically up to 255
- singly connected or multiply connected SIPO ICs in a cascaded form (i.e. daisy chained)
- SIPO cascades may include any number of serially connected SIPO ICs
- SIPOs (single or cascaded) may be defined into one or many discrete and separately addressable 'banks'
- banks may be of differing sizes (single SIPOs or cascaded)
- any number of differently sized banks may be defined and addressed and manipulated independently
- each bank is connected by its own 3-wire interface to the microcontroller
So, if you need to use one or many SIPO ICs then perhaps the ez_SIPO8_lib
may be of use to you? If you wish to access the original ez_SIPO8_lib
article then follow this link: ez_SIPO8_lib
article.
By following and working through the tutorials you will acquire a fuller understanding and appreciation of the library's potential.
Six tutorials are offered, each building on the next, these being:
Tutorial 1 - Absolute Addressing
Introduces absolute addressing of SIPO outputs, using a single SIPO IC, by considering it as a contiguous array of virtual and individually mapped SIPO ports.
Tutorial 2 - Relative Addressing
Introduces relative addressing of SIPO outputs, using a single SIPO IC. In this instance, addressing is relative as it is considered relative to the 'bank' in question rather than as a complete array.
Tutorial 3 - Using Timers
Covers the principles of using the SIPO8 library timer capabilities, again using a single SIPO IC. Timers are provided as a part of the library's resources as it is often helpful to apply timing intervals to the updating of outputs, eg flashing LEDs, switching on/off relays, etc. The library allows the designer to create any number of timers at library class instantiation, each addressable by its own unique timer id.
Tutorial 4 - Cascading SIPOs
This tutorial guides the reader through creating two SIPO ICs as a single bank as a cascade. The principles covered then allow SIPO banks of any size to be created through a straight forward extension of SIPO ICs but with very little change to the driving software sketch.
Tutorial 5 - Bank Interleaving
The tutorial looks at the feature of bank interleaving where it is possible to map any number of SIPO banks of the same size to the same 3-wire digital interface, bringing banks ‘into play’ as required. Note that this is contrary to the normal mode of connection, but does introduces new possibilities to the designer.
Tutorial 6 - Q & A
And finally, this tutorial provides answers to specific questions concerning “how do I..”, “how can I...”, etc.
Hopefully, by the end of the tutorials, you will have gained enough insight and practice to decide if the capabilities of the ez_SIPO8_lib
library will be helpful to you in your projects.
But, before we start, let's deal with a few things of concept, terminology and guidance that you will need along the way.
Origins - These tutorials are based on a previous article featuring the ez_SIPO8_lib
library which contains a comprehensive technical overview and details regarding all aspects of the library, including many examples and the tutorials. If you have not already seen this article and you feel that you want a detailed appreciation of the library then do have a look at it. It may be accessed by following this link: ez_SIPO8_lib
article. You will find in this article links to the full User Guide and a Crib Sheet, plus many more useful aids.
Terminology: 'SIPO IC' - throughout the tutorials, code and other documentation, the terms 'SIPO IC' or 'SIPO' are used rather than shift register, but the terms are synonymous.
Bit numbering - the library's addressing functions assume that bit numbering follows the traditional convention for binary notation. That is, the least significant bit occurs at the right hand side of bytes at bit 0.
Terminology: 'array' - the library refers to the entirety of connected SIPO ICs as an array, referencing being contiguous from port 0 of the first IC to the last port of the last IC, irrespective of how these are configured ('chopped up') into banks (see below). The array bit maps every output port of every connected and active SIPO IC.
Terminology: 'bank' - a bank refers to one or more cascaded SIPO ICs. For example, a bank may be created with just one SIPO IC or several that are cascaded together. Once a bank is software defined/created the array bit map representing the bank's output ports become active. Although it is generally the case that bank addressing is always relative to the SIPOs defined by a bank to note is that if only one bank of SIPO ICs is configured, irrespective of size, then absolute and relative addresses are aligned.
Concurrent & variable size banking - the design concept of the library allows banks of any size to be configured and operated concurrently and independently. Further, banks may also be of different size. For example, we may create a bank of one SIPO IC, plus a bank of three cascaded SIPO ICs, plus a bank of eight cascaded SIPO ICs, and so on. All banks may exist together and be addressed either by their respective bank ids (relative addressing) or as an entire and contiguous array (absolute addressing).
Let's look at another example, this time a diagrammatic example, of the flexibility of the ez_SIPO8_lib
library's capabilities, consider the following design diagram:
Here we have configured 11 x SIPO ICs as five banks on five 3WIs - see diagram. Note the absolute and relative address ranges. We could have arranged these 11 SIPO ICs in many ways; the arrangement should be chosen appropriate to design needs.
We have complete freedom to address this arrangement, either as a complete contiguous array of output ports (ranging from port 0 to port 87) or as individual banks of output ports (see table above for relative address ranges by bank id).
3-wire interface - every bank requires a 3-wire interface (3WI) for connection to the microcontroller (data, clock and latch pins). However, banks of the same size may share the same 3WI using a concept of 'interleaving' (see Tutorial 5).
Library files - you will need to download the library files to run the tutorials. Download the ez_SIPO8_lib
library files to your...Arduino/libraries/ directory.
There are three files to download, these being
ez_SIPO8_lib.h
,
ez_SIPO8_lib.cpp
and
keywords.txt
(these are included within this article, see Code section but can be downloaded also via the Arduino IDE Library Manager).
Library declaration and instantiation - The declaration of the library and its instantiation is largely the same for each tutorial sketch example, the difference simply lies in the number of SIPO ICs and timers called for by a tutorial. The following example is taken from Tutorial 1 -
library declaration:
#include <ez_SIPO8_lib>
instantiation of the library class:
...
#define max_SIPOs 1 // one 1 SIPO for this tutorial
#define max_timers 0 // no timers required
// initiate the class for max SIPOs/timers required
SIPO8 my_SIPOs(max_SIPOs, max_timers);
...
We instantiate the library class, giving it the name 'my_SIPOs
', for the defined number of SIPO ICs and timers we require. For this example we will be using just one SIPO IC and no timers (we will cover timers in Tutorial 3).
We use this same approach to declaration and instantiation in all of the tutorials, varying the parameters of the class inline with the requirements of the tutorial.
Quick Access ResourcesFollow the links below to access and download useful resources and examples:
ez_SIPO8_lib
User Guide
ez_SIPO8_lib
Crib Sheet
Read the full ez_SIPO8_lib
article
An example fun sketch - Rolling the Dice, Part 2
The Crib Sheet, in particular, is a very handy short-form User Guide and provides the top level of scope and specifications of the library's functions, reserved words and more.
I hope that you find the tutorials of interest and that you will explore more of the ez-SIPO8_lib
library's capabilities.
Enjoy!
Comments