ECET 365 Week 1 Complete DeVry

admin   November 15, 2018   Comments Off on ECET 365 Week 1 Complete DeVry

ECET 365 Week 1 Complete DeVry

Just Click on Below Link To Download This Course:


ECET 365 Week 1 Complete DeVry

ECET 365 Week 1 Motor Control DeVry

ECET 365 Week 1 Discussions


What are the advantages of using PWM to run a motor slowly compared to using a low DC voltage?


How does an H-bridge control the current going to the motor?


Complete the following Homework in your text: Pages 454–455, Problems 8.9, 8.10, D8.13, D8.14, D8.15. Please write all of your answers in Word.

Don’t forget to submit your assignment.



Review the Course Project Overview under the Introduction & Resources area for an overall description of the Course Project, grading rubric, and deliverables.

In addition to doing Lab 1, it is highly recommended to read the Construction Notes for the Robotic Car, found in the Files section of the Course Menu.


ECET 365 Week 1 Lab

Lab 1: Programming for Stepper Motors, DC Motors, and Servos Using an H-bridge


  1. Develop software routines that control Stepper Motors, small permanent magnet DC motors, and Servos.
  2. Understand how an H-bridge can be used to control DC motors and Stepper Motors.

Parts List

  1. Smart Car Kit or Other Provided Kit (e.g. robotics kit, supplementary parts kit)
  2. Freescale Tower Kit with S12G128 CPU board or Other Provided CPU Board
  3. PC with IDE software (e.g. CodeWarrior Development Studio V5.1)


  1. DC motors are used in the Smart Car Kit. Also used are a servo and H-Bridge. Stepper motors may be used in the Robotics Kit. The Supplementary Parts Kit may have a stepper motor.
  2. This lab explores the techniques used to interface to these devices and also how to program and control them.



Answer all questions in Week 1 Lab Cover Sheet here (Links to an external site.)Links to an external site..

Submit your Week 1 Lab Assignment.

You can also download the cover sheet for Week 1 Lab in the Files section of the Course Menu.

Required Software

CodeWarrior Development Studio for S12(x) V5.1

Access the software at (Links to an external site.)Links to an external site..

Lab Steps

STEP 1: Procedures

  1. Determine if your motor is a DC motor or a stepper motor. (Hint: DC motors are powered with two wires. Stepper motors may have four or more wires. DC motors will begin running when DC voltage is applied. Stepper motors will not run unless several pulse trains are applied. Go to the appropriate procedures below.
  2. Procedures for DC Motors
    1. Develop an interface from the CPU board to the motor.
      1. Choose a Port on the CPU board. Only one bit is required. If an H-bridge is available, connect the appropriate bit from the chosen Port to the appropriate input to the H-bridge. The double H-bridges that come with the Smart Car Kit require 4 input bits. Consult the Week 2 Lecture for ways to operate the H-bridge.
      2. If you don’t have an H-bridge, you may have to use a transistor, relay, or optical isolator to build an interface between the Port and the device. Your reading assignment in the suggested reference textbook offers many suggestions. Also, see the Week 2 Lecture.
    2. Controlling speed with program loop
      1. Start by turning the motor on by sending the appropriate byte to the Port, using a short C program.
      2. Send the appropriate byte to the Port to turn the motor off.
      3. You can now turn the motor on or off by changing the byte value in the program, recompiling, and loading the program into the CPU board.
      4. Now, however, we want to control the speed of the motor by changing the width of the bit at Port C. Do this by adding a delay program that keeps the pulse on for a 50% duty cycle. Let the period of the pulse be 200 microseconds, giving a frequency of 5 kHz. Use an endless loop in the program.
      5. Experiment with pulse widths of 25% and 75%. Note that the speed varies with the pulse width.
    3. Controlling speed with PWM registers
      1. See Week 2 Lecture for example of PWM programs that produce a pulse train with 50% duty cycle and pulse frequency of 7.7 kHz. This pulse train provided a medium speed for the Smart Car. Note that the pin PWM0 (Channel 0) is located on the Axiom S12G128 CPU board primary side pin A40.
      2. The PWMDTY0 command controls the width of the pulse.
      3. Notice that the sequence of PMW commands keeps the signal going to the PMW0 pin automatically, while the rest of the program can be doing something else. The PMW pin is connected to one H-bridge digital input.
    1. Using the H-bridge
      1. You might need to use the H-bridge to control the battery voltage to the motors. If you have a two-motor system, each motor is connected to one of the rear wheels. An H-Bridge can be used to feed the digital PWM pulse inputs to an output that is connected to the higher voltage motor system. For example, a 12-volt supply may be used by the motor, while the rest of the electronic modules might use 3.3V or 5V.
      2. In a simple Smart Car with one motor, the operator only needs one digital input that the CPU board can turn on and off. The other inputs can be hardwired to 5V or ground as appropriate.
    1. Download the Week 1 Lab Cover Sheet here and answer the questions for Step 1: Procedure.

STEP 2: Stepper Motor Procedures

Examine the “Using H-Bridge to Drive Stepper Motor” in website below: (Links to an external site.)Links to an external site.

  1. Use an ohmmeter to measure the resistance of leads. This should identify the COM leads A through D winding leads.
  2. The common wires are connected to the positive side of the power supply. In many motors, +5V is sufficient. DO NOT USE +5V POWER FROM DRAGON12 PLUS BOARD. Make sure to use an external power supply.

After making sure that Activity 1 works, write and run the following:

Connect a switch to PORTH and use it for clockwise or counter clockwise. Use PORTH1=0 for CW and PORTH=1 for CCW.

Use two more bits of PTH (such as PORTH7 and PORTH6) DIP switches to choose the degree of rotation as shown below:

0 0 90 degrees
0 1 180
1 0 270
1 1 360


STEP 3: Procedures for Interfacing to the Servo

  1. Refer to the Smart Car Instruction Manual in the Files section of the Course Menu section of the course shell.
  2. Produce a logic pulse train with a period of about 20 milliseconds. A signal generator may be suitable. You can also write a loop program.
  3. The width of the pulse determines the position of the servo. A 0.5-millisecond pulse rotates the servo fully clockwise (about 45 degrees from the center of movement.  A 1.5-millisecond pulse rotates the servo to the opposite end of rotation. A 1.0 millisecond pulse puts the servo at the center of rotation. DO NOT SEND PULSES WIDER THAN 2 MILLISECONDS.
  4. Write a small C program that controls the Servo by providing a pulse train with controlled pulse widths. This routine will later be used to control the steering (using the servo) with an input number derived from the linear video array. See the Program Listing in Appendix A of the Smart Car Construction Manual.
  5. Complete questions for Step 3 in the Week 1 Lab Cover Sheet.


ECET 365 Week 1 Quiz


Welcome to Week 1 Quiz.

  • This quiz covers CO 3 and Chapter 8.
  • This quiz is worth 20 total points, which include the following questions:
    • 3 multiple-choice questions at 5 points each; and
    • 1 short-answer question at 5 points each.
  • You have 60 minutes to finish the quiz.
  • Here is a reminder to SAVE frequently, because when the time limit is reached you will be exited from the exam.
  • This quiz contains one page.

By submitting this work, I am attesting that it abides by the Student Honor Code.


Download File Now