Question

plz write a program in atmel studiu for atmega8 microcontroller running at 7 MHz to drive...

plz write a program in atmel studiu for atmega8 microcontroller running at 7 MHz to drive a dc motor that have 70% duty cycle . i just want to know how to program a dc mortor

sorry i mean 8MHz .

Homework Answers

Answer #1

Answer:- The time period of the wave is 1/8 micro-s. For 70% DC-

ON time = 0.7*T = 0.7/8 us = 0.0875 us.
OFF time = 0.3*T = 0.3/8 us = 0.0375 us.

We never program a dc motor. We program the controller which controls the dc motor. The code is written below-

#define F_CPU 8000000UL
#include <avr/io.h>
#include <util/delay.h>

int main(void)
{
DDRB |= (1 << PB2); /* DC motor on pin PB2 */
  
while(1)
{
PORTB |= (1 << PB2); /* high pulse on pin PB2 */
_delay_us(0.0875); /* 0.0875 us delay */
PORTB &= ~(1 << PB2); /* low pulse on pin PB2 */
_delay_us(0.0375); /* 0.0375 us delay */

}
}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a C++ program that processes orders for our company Widgets and More. Your program will...
Write a C++ program that processes orders for our company Widgets and More. Your program will read the product code and quantity for all the products in an order from a file, order.txt. You will be given a sample order.txt with the starter code. There are two items on each line of the file the first is a letter that represents the product and the second is an integer representing the number bought. Based on the product and quantity, you...
Scenario 7 ?My husband and I have talked over the matter in great detail,? Marge Gower...
Scenario 7 ?My husband and I have talked over the matter in great detail,? Marge Gower said. ?We don?t care about the sex of the child, but we know exactly the kinds of features we want.? ?Mrs. Gower,? Dr. Louise Singh said, ?you?ve got to understand that we?re not running a mail-order-catalog business for babies.? ?I?m not trying to order a baby. I just want to tell you what I?m looking for in a sperm donor. I want somebody who...
I'm working on the below problem: For this question, you are to write a program that...
I'm working on the below problem: For this question, you are to write a program that reads the data in the file state_satscores_2004.txt. Each line of this file has name of a state, mean Verbal SAT score, and mean Math SAT score. After reading the data, a. Print the state with the highest mean Verbal SAT score b. Print each state that has a mean Math SAT score greater than 500 Submit the code and the output from your program....
1. Running On Carla Gomez is the owner of Running On—a retail store that sells shoes...
1. Running On Carla Gomez is the owner of Running On—a retail store that sells shoes and accessories to runners. Carla is trying to decide what she should do with her retail business and how committed she should be to her current target market. Carla started Running On retail store in 1994 when she was only 24 years old. At that time, she was a nationally ranked runner and felt that the growing interest in jogging offered real potential for...
Write a Python 3 program called “parse.py” using the template for a Python program that we...
Write a Python 3 program called “parse.py” using the template for a Python program that we covered in this module. Note: Use this mod7.txt input file. Name your output file “output.txt”. Build your program using a main function and at least one other function. Give your input and output file names as command line arguments. Your program will read the input file, and will output the following information to the output file as well as printing it to the screen:...
C++. Write a program that draws a rocket shape on the screen based on user input...
C++. Write a program that draws a rocket shape on the screen based on user input of three values, height, width and stages. The type of box generated (i.e.. a hollow or filled-in) is based on a check for odd or even values input by the user for the box height (or number of rows). Here is the general specification given user input for the height of the box..... Draw a hollow box for each stage if the value for...
Strings The example program below, with a few notes following, shows how strings work in C++....
Strings The example program below, with a few notes following, shows how strings work in C++. Example 1: #include <iostream> using namespace std; int main() { string s="eggplant"; string t="okra"; cout<<s[2]<<endl; cout<< s.length()<<endl; ​//prints 8 cout<<s.substr(1,4)<<endl; ​//prints ggpl...kind of like a slice, but the second num is the length of the piece cout<<s+t<<endl; //concatenates: prints eggplantokra cout<<s+"a"<<endl; cout<<s.append("a")<<endl; ​//prints eggplanta: see Note 1 below //cout<<s.append(t[1])<<endl; ​//an error; see Note 1 cout<<s.append(t.substr(1,1))<<endl; ​//prints eggplantak; see Note 1 cout<<s.find("gg")<<endl; if (s.find("gg")!=-1) cout<<"found...
A new family has just been referred to your program. Before you meet, you review what...
A new family has just been referred to your program. Before you meet, you review what you know about the family. Soha arrived 10 months ago with her children, sponsored by other family members. Her husband has found work in another city, but Soha and the children are living with their relatives and usually see the father only on weekends. They are a visible minority in a predominantly white neighborhood. Soha and the children have a room in the basement....
1. Suppose that the time it takes you to drive to work is a normally distributed...
1. Suppose that the time it takes you to drive to work is a normally distributed random variable with a mean of 20 minutes and a standard deviation of 4 minutes. a. the probability that a randomly selected trip to work will take more than 30 minutes equals: (5 pts) b. the expected value of the time it takes you to get to work is: (4 pts) c. If you start work at 8am, what time should you leave your...
please write the code in java so it can run on jGRASP import java.util.Scanner; 2 import...
please write the code in java so it can run on jGRASP import java.util.Scanner; 2 import java.io.*; //This imports input and output (io) classes that we use 3 //to read and write to files. The * is the wildcard that will 4 //make all of the io classes available if I need them 5 //It saves me from having to import each io class separately. 6 /** 7 This program reads numbers from a file, calculates the 8 mean (average)...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT