Arduino powered 7seg led display with Port Manipulation




Time for something a little more advanced. Direct Port Manipulation. Normally when using Arduino software, the actual logic behind changing the values in pins is abstracted away with digitalRead and digitalWrite. Now, for most people that’s just fine. But it has some limitations. For one, it is a little slower than might be practical for some situations and it can only change one pin at a time. But what if you wanted to change ALL the pins at the same time? Annoying with digitalWrite, but super easy with Port Manipulation.
Arduino led display




What we’re using today to demonstrate this is a 7 segmented display. There are seven separate segments, each with a single LED that is individually operated. When combinations are set, you get a number. Using digitalWrite, you would have to write out that command seven times for just one number and there are ten possible numbers for each digit! You can see how this can get really complicated for doing something as simple as counting up.

It’s easy to setup, but takes some planning in the code.

Just another one of the many things that I made at TechShop today.

http://techshop.ws

Step 1: Materials

Arduino Uno

2 digit 7 segmented display (common anode)

14 660ohm resistors

breadboard

wire

usb cable

Step 2: Circuit

This is the way a 2 digit common anode display would be attached.  Common anode means that all the led’s share a common power supply. So in order so turn one on, the pin will be set to LOW.

KEEP TRACK OF WHAT WIRES GO TO WHAT LED! You’re going to use that information to build the port mapping later.

A potentiometer is added just in case you want to get fancy and have the pot control the number instead of just counting up. This is not too much more difficult, so go ahead and try it.

Schematic Arduino led display

Step 3: Port Manipulation Mapping

This is the pin mapping for the arduino uno. Notice that each port there is a designation right next to the pin that looks like “PX#”. This is the pin number for that letter bank. There are multiple banks in this chip. The ones we care about are bank B and D. They are the ones to be manipulated. Write down the pin and corresponding port bank id for all the leds. The next part will be to combine them.

Major Components in Project

Arduino Uno

2 digit 7 segmented display

 

For more detail: Arduino powered 7seg led display with Port Manipulation




This Post / Project can also be found using search terms:

  • LED numbers display controller
Clip to Evernote

Leave a Comment

(Spamcheck Enabled)

Read previous post:
Arduino controlled animatronic wooden head (reading lamp) usnig arduino

This head is a reading lamp which can be adjusted for direction of lighting, and dimmed as required. This Instructable...

Close
Scroll to top