ICS4U-E Tasks


Project 3.5. TWAIN (Task Without An Interesting Name). For your first (only?) AVR Assembly project on your DDBv7 you are asked to manipulate the position of a single LED on an ACES display device through the use of an analog input device. To provide a better fit for your software skill set I'm giving you a choice between one of two options. Please choose the one that is better suited to your abilities. You'll get more out of the exercise this way.

INPUT. Your trusty blue 10 kΩ trim pot can be inserted as an appliance into any number of positions within the DDBV7's female headers. Alternatively, a Thumb Joystick offers two perpendicularly arranged potentiometers that can support X-Y positioning. An RSGC ACES Thumb Joystick breakout board enables the use of the joystick as a DDBv7 appliance.

OUTPUT. An ideal location on the DDBv7 for your familiar RSGC ACES Morland Bargraph (T. Morland ACES '18, Queen's 22) has been provided offering 1-Dimensional access (X) to 8 LEDs through the support of a '595 shift register. The RSGC ACES MatrixMadeEZ (H. Reed, ACES '19, Queen's '23) offers 2-Dimensional access (X-Y) to 64 LEDs through the support of a '595 shift register and TPIC595 (Power) shift register. To achieve 'appliance' status for the Matrix Made EZ a Universal Shield V1 is required. See Mr. D for this.

TWAIN: Basic (1D) TWAIN: Advanced (2D)


  1. Decide how ambitious you are before commiting to either the Basic or Advanced TWAIN project. See Mr. D. for a Universal Shield V1 if it's the latter.
  2. Code an AVR Assembly Language project that invokes the ATtiny84's ADC (and ADC Ready interrupt) to obtain the input status, before mapping and shifting out the data to your display device to light a single LED.
  3. Comment your code thoroughly.
  4. Submit your Report by the deadline.
  5. Ten years ago I posted a video outlining a similar concept I'm asking you to achieve in the Advanced project.

Project 3.4. Pin Change Interrupt

  1. Create the project CombinationSafe. (or MyLocker?)
  2. Continue to develop your Mega328P.h library of useful assets.
  3. You are to duplicate much of the functionality of the Goldman-Atkinson Clue Capturer prototype. A bicolor LED indicator replaces the servo with green indicating a correctly-entered combination. If so, hold the green for three seconds before returning to red and starting again.
  4. Your code will hold the secret 3-digit combination, monitor the A, B, and SW signals through Pin Change and External Interrupt handling, and update the 7-segment display digit appropriately with rollover (clockwise rotation adds 1; counterclockwise rotation subtracts 1).
  5. A SWitch press on the rotary encoder extends the three-digit combination sequence by the active digit.
  6. An ACES Debouncer V2 button press resets the combination sequence.
  7. Register level code ALL THE WAY! (pinMode, digitalRead, digitalWrite, attachInterrupt, etc.)
  8. Submit your DER and attach the two code files, by the deadline: Wednesday February 2.



Project 3.3. Keypad Matrix Echo. For your first ATtiny84 project of ICS4U you are to maximize your mid-level coding skills in the development of a prototype that echoes button presses on your 12-key telephone keypad onto your small Adafruit 861 8x8 matrix. Each of you has been assigned a 4x3 subset of your matrix as shown below that represents the 1:1 Key→LED mapping. For example, should your user press the '0' key, the LED indicated will light up for 300 ms, only.

Your ATtiny84 has just enough GPIO pins (10) to pull this task off as I describe it below (7 input; 3 output). Furthermore, the code is surprisingly short if done skilfully.

(Basic) Task.

  1. Assemble a breadboard layout similar to the one shown below.

  2. Ground the Common pin of your keypad so your code can recognize presses through the use of internal pullup resistors set on each input pin.
  3. The 8 output pins of you 74HC595 are more than enough to map to the 4 rows and 3 columns of your matrix
  4. Code the most efficient solution you can think of to light the respective LEDs for 300 ms.
  5. You should be using your newly-minted library and since other projects will draw on its resources you could consider adding an Appendix to your DER at the end, that includes this library.

Optional (Advanced) Task.

Some of you may wish to consider going beyond the basic task.

Rather than 1:1 Key→LED mapping, a 1:4 Key→LED mapping could be achieved. What is compelling about this implementation is that it requires a skill you already possess: PoV!

You have the time; consider it if you are inspired.

Project 3.5 Binary Challenge

With efficient register level shiftout functions seamlessly accessible to your future projects, it is an opportune time to examine a similar optimization for input. This project exploits single statement input of the full byte-state of an 8-position rocker switch. For confirmation you will echo the input on your 8-LED Morland Bargraph V4.

The ability to read the state of 8 switches with a single statement provides the ACES Binary Challenge and other applications with increased efficiency. In the partially wired prototype below it is easy to imagine that continuous echoing of the state of the rocker switches on your MBV4 can be achieved with just two lines of caller code.


If you have the motivation, curiosity, and time this week you are encouraged to consider developing an emulation of the ACES' Binary (Unsigned) Challenge in which random unsigned byte values (in decimal) are presented on either an LCD, OLED, or multiple 7-Segment displays, for example (the Serial Monitor is likely not an option in this project as we need all 8 bits of PORTD for input). You are awarded credit for providing the correct response, in binary. The points are 30 (if you answer in less then 10 s), 20 (if you answer in less than 20s) , and 10 if you eventually enter the correct value at any time before the 5 minute time limit expures.
  1. Create the Arduino Nano project, BinaryChallenge.
  2. Reading the rocker switch with a single port read.
  3. Your MBV4 continuously echoes the input. Employ your personal ICS4U23.h library for this support.
  4. The output device of your choosing displays the random unsigned byte to be entered.
  5. Your accumulated Score is displayed on the output device for an instant after each successful entry.
  6. A TimerOne Interrupt will be initialized at the start of the game used to time and terminate the game after 5 minutes.
  7. Submit your DER by the deadline under the Subject Line: Binary Challenge. Be sure to include your ICS4U23.h library code as well if you have made any updates. Otherwise, simply include a bookmark (internal hyperlink) directly to it in Project 3.4.

Project 3.4 Register Level Shiftout

With your register level shiftout (outshift) of a single byte (uint8_t) finalized in class it is time to pair up (yes, a group project) to implement OVERLOADED register level outshift functions that will accomplish the same for uinti16_t, and uint32_t integers. Our recently developed ACES Morland Bargraph V4 is an ideal vehicle to test and display the results as it breaks out the 595's Carryout pin to enable chaining. The graphic below suggests a prototype wiring strategy. Click to enlarge.

ACES' Optimization considerations include an efficient means to reuse code such as your effective register level outshift() function. The natural question that arises is, "How best to make use of previously developed stable coding assets in future projects?". We could certainly 'copy and paste' the code into every new project but that has drawbacks. For example, what if we want to modify the code at a later date? We'd have to hunt down every previous copy of the asset and edit and test. Surely a better solution would be to maintain ONE version of the asset and place it in a location that is accessible from every new project we create. This project will achieve that by introducing you to the concept of a personal code library.


  1. Feel free to collaborate with the ACE you normally sit with in class while developing this exercise.
  2. I will distribute four MBV4's to each pair on Monday (February 6).
  3. Between the two of you, wire up a common ATtiny85-based prototype similar to the partially wired one shown above.
  4. Develop the OPTIMIZED RegisterLevelShiftOut sketch that will echo 8, 16, and 32-bit integers across the display. For example, the image above presents the 32-bit value, 0x1234ABCD, under an LSBFIRST shift order. Continuing from our efforts in class, your sketch requires implementation of interdependent (low coupled) functions below,
    void outshift(volatile uint8_t *port, uint8_t dat, uint8_t clk, uint8_t dir, uint8_t valu){
    void outshift(volatile uint8_t *port, uint8_t dat, uint8_t clk, uint8_t dir, uint16_t valu){
    void outshift(volatile uint8_t *port, uint8_t dat, uint8_t clk, uint8_t dir, uint32_t valu){
  5. Now, THINK! Your code may work but are there any further efficiencies and optimizations still to be realized?
    1. Create a new folder called ICS4U23 within the \libraries folder of your Arduino sketch folder
    2. Once ALL of your overloaded outshift() functions are fully operational within your ICS4U23.h file, move this file to the folder created in the previous step (..\libraries\ICS4U23)
    3. Delete the local ICS4U23.h file from the current RegisterLevelShiftOut project folder
    4. In your primary source file, replace the double quotes in #include "ICS4U23.h" with angle brackets as in, #include <ICS4U23.h>
    5. Test and confirm
    6. In your DER, add a second table within your Code Section (both with appropriate subheadings) that presents your fully commented RLShiftout.ino and ICS4U23.h library source files
  7. Develop a compelling 32-LED animation using your outshift functions for your video. See our NCC page for inspiration if necessary...
  8. Your DER can contain common elements shared with your partner (including the video if you like) but the text body of your Report should be written independently.
  9. As an aside, turning to ChatGPT and entering the request, "Write a register level shiftout function on the ATtiny85 in Arduino C", yielded the following on 2023 02 03 (not exactly what we're looking for but they're getting there. Better get used to keeping your skill sets one step ahead of AI :)
    void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val) {
      uint8_t i;
      for (i = 0; i < 8; i++)  {
        if (bitOrder == LSBFIRST)
          digitalWrite(dataPin, !!(val & (1 << i)));
          digitalWrite(dataPin, !!(val & (1 << (7 - i))));
        digitalWrite(clockPin, HIGH);
        digitalWrite(clockPin, LOW);

Project 3.3 Gate-Level Minimization


Project 3.2. CHUMP. See here.

Project 3.1. SMT: PB Machine. One of the greatest challenges (and I believe, privilege) for ACES is to influence the direction of our program. Through your imagination and skill you are expected to contribute to the enhancement of our mutual creativity, tool set, and assets.

P. Bagga (ACES '17, UofT '22) fulfilled this opportunity/commitment when he decided he could improve on the DC Breakout Board ACES were using by adding a simple Resistor/LED power indicator using small 1206 size SMT components. Click on the image to the right of the (affectionately called) PB Machine for a more thorough explanation of its design. Apart from its functionality, this PCB offers a perfect introduction for Sr. ACES to practice the hand-soldering of SMT 1206 parts.

G. Benson (ACES '19, Calgary '24) also met this challenge with the enhancement of the indispensable PB Machine (P. Bagga, ACES '17). In the Fall of 2019 and 2020, Sr. ACES had the opportunity to solder up their own GB machine and put it to good use in the pursuit of their own prototypes. In the 2021/2022 year ACES benefit from JLCPCB's relatively inexpensive SMT Assembly Service requiinrg only additional THT soldering. Your experience with electric circuits has been largely limited to components that use through-hole technology (THT). To round out your proficiency with all components, your next few projects will require the use of devices that use surface-mount technology (SMT). As the graphic reveals, the smallest size that is reasonable for hand-soldering techniques is the 1206 family, so this is what we carry in the DES inventory. Update: By the Spring of 2021, ACES had shifted their skill set to the SMT Design and (reasonably-priced) Assembly of PCBs to JLCPCB. Increasing dependency on outsourcing may not be the wisest decision in the long run but, in the short run, it remains an option. You will be provided with a newly designed and fully assembled SMTV1 GB Machine to serve for both function and inspiration.

GB Machine (click image to enlarge)
1206 LED Package


  1. Grab your camera and obtain media documentation of the next step.
  2. With the PB Machine PCB and components you were provided with, solder the 1206 SMT LED and 10kΩ 1206 chip resistor to the PCB using the technique of your choice.
  3. Develop a simple circuit that confirms the illumination of your enhanced PB Machine
  4. Add your first ICS4U project report to your DER and submit by Saturday September 16.