Challenge

Project 1 - Controlling a DC motor using PWM and monitoring its Running status

MAGNA

/*

* Project1.c

*

* Created: 19-09-2022 22:13:15

* Author : shobkc

*/

#include <avr/io.h>

#define F_CPU 16000000L

#include <util/delay.h>

char seg[10]={0X3F,0X06, 0X5B, 0X4F, 0X66, 0X6D, 0X7D, 0X07, 0X7F, 0X6F};

int main(void)

{

DDRC |= 0XFF; //Setting C as output

DDRB |= 0XFF; //Setting B as output

int i=0;

int j=0;

while (1)

{

PORTB = seg[i];

PORTC = seg[j];

for(i=0;i<10;i++)

{

PORTC = seg[i];

for(j=0;j<10;j++)

{

PORTB = seg[j];

_delay_ms(500);

}

}

}

}

OUTPUT:

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.