Control stepping motor via USB interface
This is an example that demonstration how to control some devices via USB interface.The PC software program with delphi.
Feature :
- CPU PIC18F4550 with full speed USB interface at 48MHz.
- USB 2.0 compliance
- Use on-chip USB driver
- Control 1 stepping motor.
- MPLAB C18 for firmware at USB devices side.
- Delphi 6 for PC Host software.
USB devices side
Figure 1. is the schematic for this example.PIC18F4550 is the main devices that communicate with PC and control stepping motor. The power supply came from +5V Vbus for circuit except +Vmotor which must use external power supply that depend on stepping motor requires. If you add more components into circuit that drawn total current more than 250mA you should be use +5V external power supply instead Vbus.Becuase Vbus can supplies current not more than 250mA and don't forgot to disconnect Vbus out of circuit.
Don't connect +Vmotor to Vbus.
In this example I drive the stepping motor with 1-phase drive method(A-C-B-D).You may be change for your appropriate application.
Figure 1. Schematic for this example
Firmware
The firmware for this example program with MPLAB C18 with USB driver from Microchip. If you need to change or add new command please look at file user.c and use.h in user folder.
PC software side
This example program with delphi 6 which modified from C++ wrote by Microchip staff. I have modified the original source code for 3 command for this example : turn left,turn right,Stop motor and connect.For detail of C++ example see in PICDEM™ FS USB User’s Guide and relate files.
The USB driver which use for this project is the Microchip General Purpose USB Windows driver which programming with C/C++ .If you need to program your own USB driver look at this website which have more interest USB driver programming information(www.jungo.com). But, programming USB driver is so hard works.Also,you need to know how dose the OS work.
source code
MPLAB C18 source code
ServoCenter full package, USB version
No comments:
Post a Comment