{"id":4006,"date":"2019-11-29T19:49:13","date_gmt":"2019-11-29T17:49:13","guid":{"rendered":"https:\/\/deepbluembedded.com\/?p=4006"},"modified":"2023-08-17T23:52:17","modified_gmt":"2023-08-17T20:52:17","slug":"multiplexing-7-segment-displays-3-digit-7-segment-interfacing-with-pic-microcontrollers","status":"publish","type":"post","link":"https:\/\/deepbluembedded.com\/multiplexing-7-segment-displays-3-digit-7-segment-interfacing-with-pic-microcontrollers\/","title":{"rendered":"Multiplexing 7-Segment Displays 3 Digit 7-Segment Interfacing With PIC Microcontrollers"},"content":{"rendered":"\n\n\n\n\n
\"Previous<\/a><\/td>\nPrevious Tutorial<\/strong><\/a><\/td>\nTutorial 33<\/span><\/strong><\/span><\/td>\nNext Tutorial<\/strong><\/td>\n\"Next<\/td>\n<\/tr>\n
<\/td>\nMultiplexing 7-Segment Displays | Multi-Digit 7-Segments Interfacing<\/strong><\/span><\/td>\n<\/td>\n<\/tr>\n
<\/td>\nIntroductory Level<\/strong><\/span><\/td>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"Multi-Digit<\/p>\n

In this tutorial, we’ll be discussing how to interface multiple digits 7-Segments display with pic microcontrollers, or any other MCUs, generally speaking. I’ll briefly introduce the phenomenon called “persistence of vision” and how we can use it in embedded systems to trick the human eye by multiplexing displays in order to reduce the pin-count required to drive these output 7-segment display units.<\/span><\/p>\n

By the end of this tutorial, you should be able to implement your own multi-digit 7-segments display controller. And you’ll create a couple of simple projects to test things out. First of which is a 3-Digit counter and the other is a 3-Digit ADC result display. Without further ado, let’s get right into it!<\/span><\/p>\n

[toc]<\/p>\n


\n

\u00a0 \u00a0Required Components For This Tutorial\u00a0 \u00a0<\/span><\/strong><\/span><\/h3>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Qty.<\/strong><\/span><\/td>\nComponent Name<\/strong><\/span><\/td>\nBuy<\/strong> On Amazon.com<\/span><\/td>\n<\/tr>\n
1<\/td>\nPIC18F2550<\/span><\/td>\nAdd<\/a><\/td>\n<\/tr>\n
1<\/td>\nBreadBoard<\/span><\/td>\nAdd<\/a><\/td>\n<\/tr>\n
1<\/td>\nMulti-Digit 7-Segment Display<\/span><\/td>\nAdd<\/a><\/td>\n<\/tr>\n
1<\/td>\nPotentiometers<\/span><\/td>\nAdd<\/a><\/td>\n<\/tr>\n
<\/td>\nResistors Kit<\/span><\/td>\nAdd<\/a>\u00a0 \u00a0 Add<\/a><\/td>\n<\/tr>\n
1<\/td>\nCapacitors Kit<\/span><\/td>\nAdd<\/a>\u00a0 \u00a0 Add<\/a><\/td>\n<\/tr>\n
1<\/td>\nJumper Wires Pack<\/span><\/td>\nAdd<\/a>\u00a0 \u00a0 Add<\/a><\/td>\n<\/tr>\n
1<\/td>\nLM7805 Voltage Regulator (5v)<\/span><\/td>\nAdd<\/a><\/td>\n<\/tr>\n
1<\/td>\nCrystal Oscillator<\/span><\/td>\nAdd<\/a><\/td>\n<\/tr>\n
1<\/td>\nPICkit2 or 3 Programmer<\/span><\/td>\nAdd<\/a><\/td>\n<\/tr>\n
2<\/td>\n9v Battery or DC Power Supply<\/span><\/td>\nAdd<\/a>\u00a0 \u00a0 Add<\/a>\u00a0 \u00a0 Add<\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

My DSO Siglent-SDS1104 (on Amazon.com)<\/a><\/p>\n

My Function Generator Fy-6900 (on Amazon.com)<\/a><\/p>\n

*Affiliate Links Disclosure: links will make me a small commission at no additional cost to you*<\/p>\n

The Prototyping Board Setup<\/a><\/strong><\/p>\n

\"Prototyping<\/a><\/p>\n


\n

\u00a0 \u00a0PIC Micro 7-Segments Display Interfacing\u00a0 \u00a0<\/span><\/strong><\/span><\/h3>\n

In a previous tutorial (7-Segments display interfacing)<\/a>, I’ve demonstrated how to interface a single 7-Segment display unit to display a single-digit number. However, in many situations, it won’t be enough and you’ll need to add more digits and of course, you can’t reserve 7 io pins for each one of them!<\/span><\/p>\n

Moreover, adding many 7-segments comes at a cost indeed. And at some point, you’ll find out that an LCD module would have given you more display digits at the same, or less cost. And it’ll be your decision to chose one over the other.<\/span><\/p>\n

The LCD display will give you more digits with less price per digit. But, it’ll be smaller and harder to see. A user can see clearly the LCD display from a distance no more than 1 meter.<\/span><\/p>\n

On the other hand, the 7-segments display units are larger in size and could be easily seen by users from a greater distance. That’s the trade-off you’ll have to decide on, depending on your project case.<\/span><\/p>\n

You can use the following online tool to generate the code for any 7-segment display pattern or number you need to display in your project, it\u2019s a very handy tool.<\/span><\/p>\n

7-Segment Display Code Generator Online Tool<\/a><\/strong><\/p>\n


\n

\u00a0 \u00a0Persistence of Vision – POV\u00a0 \u00a0<\/span><\/strong><\/span><\/h3>\n

Persistence of vision<\/b> (POV) refers to the optical illusion that occurs when visual perception of an object does not cease for some time after the rays of light proceeding from it have ceased to enter the eye. The human eye receives the light rays and sends the signals to the brain where perception occurs. The image you see inside your brain takes some time to fade away after it actually disappears in front of your eyes.<\/span><\/p>\n

Therefore, the eye could be easily tricked by changing a scene fast enough so that the brain perceives an object in two places at the same time. A very clear example of this is the fan blades. While a fan is spinning the blades will seemingly appear to be in multiples positions at the same time due to the POV.<\/span><\/p>\n

\u00a0In the animation below, the magician is holding a circular card. On the front face, there is a bird & on the backside, there is an empty cage. But as he spins the card fast enough, your eye will be tricked and your brain will perceive a bird in cage image, which doesn’t actually exist.<\/span><\/p>\n