Difference between revisions of "PIC Motor Control and Serial Port Example"

From Mech
Jump to navigationJump to search
 
Line 9: Line 9:
*USART (Universal Synchronous Asynchronous Receiver/Transmitter)
*USART (Universal Synchronous Asynchronous Receiver/Transmitter)


Every 20 milli-seconds, the PIC will sample the encoder and run the feedback control loop. The output from the control loop is then sent to the motor to try to match the motor's speed with the target speed.
Every 20 milli-seconds, the PIC will sample the encoder and run the feedback control loop. The output from the control loop is then sent to the motor to try to match the motor's speed with the target speed. To set the target speed, commands are sent from a PC's serial port to the USART on the PIC. The PIC will also print the target speed and actual speed of the motor to the terminal window of the PC.

To set the target speed, commands are sent from a PC's serial port to the USART on the PIC. The PIC will also print the target speed and actual speed of the motor to the terminal window of the PC.


==Wiring Diagram==
==Wiring Diagram==

Revision as of 05:06, 31 August 2007

Introduction

In this application, we will use a PIC 18F4431 microcontroller to implement a closed-loop lead-lag compensator that controls the velocity of a motor with an encoder. This example will cover the use of:

  • interrupts
  • reading encoders
  • pulse-width modulation
  • USART (Universal Synchronous Asynchronous Receiver/Transmitter)

Every 20 milli-seconds, the PIC will sample the encoder and run the feedback control loop. The output from the control loop is then sent to the motor to try to match the motor's speed with the target speed. To set the target speed, commands are sent from a PC's serial port to the USART on the PIC. The PIC will also print the target speed and actual speed of the motor to the terminal window of the PC.

Wiring Diagram

Breadboard Layout

HyperTerminal