Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help writing a program that creates a BCD 00 - 99 up counter on two seven segment displays. I'm using a 4 digit

I need help writing a program that creates a BCD 00 - 99 up counter on two seven segment displays. I'm using a 4 digit 7 segement display and have made all of the connections but I'm having trouble coding the multiplexing part. I'm only using 2 of the segments with the common cathode pins being 8 and 9 on the display being connected to pins a PD5 and PD4 on the arduino I just can't find examples that are writing the code like I am without using pinmode and digitalwrite functions, I'd rather it be formatted similar to what I've already coded. This is the code I already have. It counts up from 0 to 9 when the common pins are grounded, but the displays are doing the same thing.

#include #define F_CPU 16000000 #include //below is an array consisting of the numbers 0,1,2,3,4,5,6,7,8,9, int display[10] = {0b00111111, 0b00000110, 0b01011011, 0b01001111, 0b01100110, 0b01101101, 0b01111100, 0b00000111,0b01111111, 0b01100111}; void setup(); int main() {setup(); while(1)

{

for (int dig0 = 0; dig0 < 10; dig0++) { PORTB = display[dig0]; // send a byte to portb to display numbers PORTD = PORTB; // bit PB6 copied to PD6 _delay_ms(500); } // Wait for 0.5 sec before updating the display

} //end while loop

} //end main

//* void setup() { DDRB = 0b00111111; // portB pins are set as output DDRD = 0b01110000; // pins D6,D5,D4 are set as output }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Application Development And Design

Authors: Michael V. Mannino

1st Edition

0072463678, 978-0072463675

More Books

Students also viewed these Databases questions

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago