Question
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
{
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started