Download Lab #7: DC Motors - University of Wisconsin

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Embedded system wikipedia , lookup

Electronic engineering wikipedia , lookup

Alternating current wikipedia , lookup

Public address system wikipedia , lookup

Immunity-aware programming wikipedia , lookup

Transcript
Hybrid I/O – Pulses
CS 478: Microcontroller Systems
University of Wisconsin-Eau Claire
Dan Ernst
Digital or Analog?
+5 V
0V
It depends on how data is encoded.
CS 478: Microcontroller Systems
University of Wisconsin-Eau Claire
Dan Ernst
Analog Signals that Look Awfully Digital…
•
•
•
•
•
•
•
Pulse Generation
Pulse-Width Modulation (PWM)
Pulse-Width Measurement (PWM)
Event counting
Period Measurement
Input capture
Output compare
For a microcontroller – all involve creative use of clocks and counters
CS 478: Microcontroller Systems
University of Wisconsin-Eau Claire
Dan Ernst
Applications of These Signals
Applications:
• Pulse Generation (sensors, motors, general control)
• Pulse-Width Modulation (PWM) (DC Motors)
• Pulse-Width Measurement (PWM) (sensors)
• Event counting
• Period Measurement (frequency measurement/modulation)
• Input capture (pattern recognition)
• Output compare (timed patterns)
CS 478: Microcontroller Systems
University of Wisconsin-Eau Claire
Dan Ernst
Magnetic Fields
Direction of Field: North  South
CS 478: Microcontroller Systems
University of Wisconsin-Eau Claire
Dan Ernst
Right Hand Rule
Electric Currents  Magnetism!
CS 478: Microcontroller Systems
University of Wisconsin-Eau Claire
Dan Ernst
Right Hand Rule
Electric Currents  Magnetism!
CS 478: Microcontroller Systems
University of Wisconsin-Eau Claire
Dan Ernst
Electromagnet
North/South
Pole?
CS 478: Microcontroller Systems
University of Wisconsin-Eau Claire
Dan Ernst
Stepper Motor
CS 478: Microcontroller Systems
University of Wisconsin-Eau Claire
Dan Ernst
Stepper Motor
CS 478: Microcontroller Systems
University of Wisconsin-Eau Claire
Dan Ernst
Stepper Manipulation
• Controlling a stepper involves turning these electromagnets on and off
• This must be done in order to create rotation.
– i.e. can’t go from top one high to bottom one high
• Microcontroller will want to set up its outputs to go through these steps in
order by generating pulses on multiple pins
• Number of steps (resolution) can actually be doubled with creative pulsing
– i.e. top and right on give you a position going “NE”
CS 478: Microcontroller Systems
University of Wisconsin-Eau Claire
Dan Ernst
Force
Right Hand Rule # 2
Electric Currents & Magnetism  Force
CS 478: Microcontroller Systems
University of Wisconsin-Eau Claire
Dan Ernst
Force in a Conductor
CS 478: Microcontroller Systems
University of Wisconsin-Eau Claire
Dan Ernst
Force in a Conductor
CS 478: Microcontroller Systems
University of Wisconsin-Eau Claire
Dan Ernst
Diagram of a Simple DC Motor
CS 478: Microcontroller Systems
University of Wisconsin-Eau Claire
Dan Ernst
Commutator
CS 478: Microcontroller Systems
University of Wisconsin-Eau Claire
Dan Ernst
DC Motor Velocity
• The velocity of the motor is (roughly) proportional to the force exerted
• The power of the force acting on the motor is directly proportional to the
magnetic field that is causing the force
• The magnetic field intensity is directly proportional to the current that
creates it (from running through the wires)
• The current is directly proportional to the Voltage across the lines
(V = IR)
Therefore: The speed of the motor is directly proportional to the Voltage
CS 478: Microcontroller Systems
University of Wisconsin-Eau Claire
How do I output a voltage?!?
Dan Ernst
Pulse Width Modulation (PWM)
Time On
Time On
Total Cycle Time
Total Cycle Time
Duty Cycle =
Time On
Total Cycle Time
Time On
Total Cycle Time
Effective Voltage = Duty Cycle x Supply Voltage
CS 478: Microcontroller Systems
University of Wisconsin-Eau Claire
Dan Ernst
Single Pulse Applications
• Sensors:
– Ultrasonic range-finders require a pulse to start ranging, and report results based
on a pulse length
• Servo Motors:
– Pulse width describes position
CS 478: Microcontroller Systems
University of Wisconsin-Eau Claire
Dan Ernst
Generating Pulsed I/O on the MPC555
• “Obvious” answer is to use straight GPIO (digital I/O), like the port we
used in the QADC, then use the PIT to do timings
– While possible, to do a continuous pulse we have to interrupt the processor every
½ period!
– Timing is also slightly less accurate (going to an ISR takes time)
• The MPC555 has a “MIOS” unit (Modular Input/Output System)
– Combines counters and clocks to generate a wide range of pulse widths and
periods.
– Does so without the need for interrupts
CS 478: Microcontroller Systems
University of Wisconsin-Eau Claire
Dan Ernst
CS 478: Microcontroller Systems
University of Wisconsin-Eau Claire
Dan Ernst
MDASM Modes
•
•
•
•
•
•
Disable mode
Pulse width measurement
Period measurement
Input capture mode
Single pulse generation
Continuous pulse generation
CS 478: Microcontroller Systems
University of Wisconsin-Eau Claire
Dan Ernst