# Multiplexed Seven Segment Displays - Part II

Posted on Feb 4, 2014

A small project that will make you expert in using these displays in your own projects. We will make a system that can display any number between 0-9999 using four of these displays. We will design a function Print() that we can use on latter projects to easily write integers onto displays. Once we have successfully tested this function we can add to to any project

without any problem. This concept of code reuse will make bigger project both easy to make and far less painful. In this sample project we will test our function by using it in a loop to print all numbers from 0-9999. /* Program to demonstrate the use of Seven Segment Displays In Multiplexed Mode. _ Author: Avinash Gupta Date: 11 Oct 08 Updated: Web: */ #include #include #include #define SEVEN_SEGMENT_PORT PORTD #define SEVEN_SEGMENT_DDR DDRD volatile uint8_t digits[3]; void SevenSegment(uint8_t n, uint8_t dp) { /* This function writes a digits given by n to the display the decimal point is displayed if dp=1 Note: n must be less than 9 */ if(n<10) { switch (n) { case 0: //. gfedcba SEVEN_SEGMENT_PORT=0b00111111; break; case 1: //. gfedcba SEVEN_SEGMENT_PORT=0b00000110; break; case 2: //. gfedcba SEVEN_SEGMENT_PORT=0b01011011; break; case 3: //. gfedcba SEVEN_SEGMENT_PORT=0b01001111; break; case 4: //. gfedcba SEVEN_SEGMENT_PORT=0b01100110; break; case 5: //. gfedcba SEVEN_SEGMENT_PORT=0b01101101; break; case 6: //. gfedcba SEVEN_SEGMENT_PORT=0b01111101; break; case 7: //. gfedcba SEVEN_SEGMENT_PORT=0b00000111; break; case 8: //. gfedcba SEVEN_SEGMENT_PORT=0b01111111; break; case 9: //. gfedcba SEVEN_SEGMENT_PORT=0b01101111; break; } if(dp) { //if decimal point should be displayed //make 7th bit high SEVEN_SEGMENT_PORT|=0b10000000; } } else { //This symbol on display...

Leave Comment

characters left:

• ## New Circuits

.

Popular Circuits

One Direction Motion Sensor
Arduino LED blinking with variable speed
LM56 diagram of Circuit of the Thermostat project
Simple portable Audio power amplifier circuit using LM386 IC
Stability Analysis In Multiple Loop Systems
Single-phase double-winding motor driving

Top