A
A
h>
#define F_CPU 16000000UL
#include <util/delay.h>
int main(void) {
// Set Port B and Port C as output for the 7-segment displays
DDRD = 0xFF; // Port D
DDRB = 0xFF; // Port B
DDRC = 0xFF; // Port C
while (1) {
for (int i = 0; i < 100; i++) {
int tens = i / 10; // Extract tens digit
int ones = i % 10; // Extract ones digit
return 0;
}
#include <avr/io.h>
#define F_CPU 16000000UL
#include <util/delay.h>
// Define the pin you want to use for the LED in Port C
#define LED_PIN PC0
int main(void) {
// Set Port B and Port C as output for the 7-segment displays
DDRD = 0xFF; // Port D
DDRB = 0xFF; // Port B
DDRC |= (1 << LED_PIN); // Set LED_PIN as an output in Port C
while (1) {
for (int i = 0; i < 100; i++) {
int tens = i / 10; // Extract tens digit
int ones = i % 10; // Extract ones digit
PORTC &= ~(1 << LED_PIN); // Set the specific bit (LED_PIN) to 0
_delay_ms(10);
PORTC |= (1 << LED_PIN); // Set the specific bit (LED_PIN) to 1
_delay_ms(10);
PORTC &= ~(1 << LED_PIN); // Set the specific bit (LED_PIN) to 0
_delay_ms(10);
PORTC |= (1 << LED_PIN); // Set the specific bit (LED_PIN) to 1
_delay_ms(10);
PORTC &= ~(1 << LED_PIN); // Set the specific bit (LED_PIN) to 0
_delay_ms(10);
PORTC |= (1 << LED_PIN); // Set the specific bit (LED_PIN) to 1
_delay_ms(100);
PORTC &= ~(1 << LED_PIN); // Set the specific bit (LED_PIN) to 0
_delay_ms(10);
PORTC |= (1 << LED_PIN); // Set the specific bit (LED_PIN) to 1
_delay_ms(10);
PORTC &= ~(1 << LED_PIN); // Set the specific bit (LED_PIN) to 0
_delay_ms(10);
PORTC |= (1 << LED_PIN); // Set the specific bit (LED_PIN) to 1
return 0;
}