Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am using proteus software and I have the following source code: i need it to power two dc motors to run clockwise or counter

I am using proteus software and I have the following source code: i need it to power two dc motors to run clockwise or counter clockwise using 4 buttons. Right now the code is running only first motor when pressing each button and not the second motor. I am not sure what I am missing. Please see the code:

#include #include #include #include #include //#ifndef F_CPU //# define F_CPU 8000000UL // clock speed is 8MHz //#endif

int main() { //char button; DDRB = 0xff; //make port B outputs DDRD = 0x00; //make port D inputs PORTD = 0XFF;

// Write your code here while(1) { // button = PIND; if (PIND == 0xFE) { PORTB = 0X05; } else if (PIND==0XFD) { PORTB=0X06; } else if(PIND == 0xFB) { PORTB = 0X05; } else if(PIND==0XF7){ PORTB=0X06;} else { PORTB = 0X00; } }return 0; }

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

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions

Question

=+ How about one you felt had acted in a hypocritical way?

Answered: 1 week ago

Question

=+ what roles should government play in them ?

Answered: 1 week ago

Question

=+ Why do we have markets and, according to economists,

Answered: 1 week ago