Demand Peripherals     Robotics and Automation Made Easy

DC2: Dual DC Motor Controller

The DC2 peripheral controls the speed and direction of two brushed DC motors using the D7HB H-Bridge card. The motor speed signals are pulse width modulated (PWM) signals with a programmable PWM frequency and a duty cycle between 0 and 100 percent.

 

Hardware:

The DC2 peripheral requires the D7HB dual H-Bridge card,

 

Resources:

Resources let you control each motor as well as set the PWM frequency. A watchdog timer can shutdown both motors if the host stops writing to the peripheral.

mode0, mode1 : mode of operation for the motor.
The mode is encoded as a single character with the codes assigned as follows:
     b -- brake (power on default)
     f -- forward
     r -- reverse
     c -- coast

power0, power1 : PWM 'ON' time as a percentage.
The speed resolution is 10 bits for PWM frequencies below 20 KHz. The speed resolution is 8 bits for a PWM frequency of 78 KHz. Reading this give the _current_ speed. Writing it sets the _target_ speed. Current speed is subject to the constraints of slow start and slow stop so the current speed and the target speed might not be the same. That is, when you read the speed you might not immediately get back what you wrote to it.

pwmfrequency : PWM frequency in Hertz.
The driver tries to assign a frequency as close as possible to the one specified. For example, a requested frequency of 12510 Hertz might result in an actual PWM frequency of 12500 Hertz. The PWM frequency is the same for both motors. The default PWM frequency is 20000 Hertz.

slow_start0, slow_start1 : Acceleration curve
The acceleration curve is a list of ten space separated integers representing the time (in milliseconds) between each 10 percent increase from 0 to 100 percent ON time. The following string shows how to specify a slow start that takes half a second to get to 50 percent power and three-quarters of a second to get from zero to full power:

    dpset dc2 slow_start0 100 100 100 100 100 50 50 50 50 50
The default value for slow_start is off to full power in zero milliseconds. That is, the default is to turn off slow start.

slow_stop0, slow_stop1 : Deceleration curve.
The deceleration curve is a list of ten space separated integers representing the time (in milliseconds) between each 10 percent decrease from 100 to 0 percent ON time. The following string shows a slow stop that takes half a second to get to 50% power and three-quarters of a second to get from full power to zero:

    dpset cd2 slow_stop0 100 100 100 100 100 50 50 50 50 50
The default value for slow_stop is full on to full off in zero milliseconds. That is, the default is to turn off slow stop.

watchdog : Timeout in milliseconds.
As a safety feature, the FPGA hardware can turn both motors off if there is no speed or mode update within the specified time. The time is specified in milliseconds and has a maximum value of 1500 milliseconds. The resolution of the watchdog timer is 100 milliseconds, and a value of zero turns off the timer. The default value is 300 milliseconds.

 

Examples:

Set the PWM frequency to 20KHz, put both motors into forward mode, set the watchdog timer to 500 ms, and set the PWM percentage to both motors to 65 percent.

     dpset dc2 PWM_Frequency 20000
     dpset dc2 watchdog 500
     dpset dc2 mode0 f
     dpset dc2 mode1 f
     dpset dc2 power0 65
     dpset dc2 power1 65

 

FPGA Defined Peripherals
User Interface
FPGA Configuration
FPGA Buttons & LEDs
Text LCD and Keypad
Quad WS2812 Interface
Quad Slide Pot
Tone Generator
IR Recv/Xmit
6 Digit LCD
RC Decoder
Keyfob RF Decoder
Rotary Encoder Interface
Quad Touch Interface
Motion Control
Dual DC Motor Controller
Dual Quadrature Decoder
Quad 13 Bit Servo
Bipolar Stepper Controller
Unipolar Stepper Controller
Simple Input / Output
Quad Binary Output
Quad Binary Input
Quad GPIO
Octal Input/Output
32 Channel Binary Output
32 Channel Binary Input
Sensors
Octal 12-bit ADC
Quad Ping))) Interface
Octal SRF04 Interface
Quad Event Counter
Instrumentation
Generic I2C
Generic SPI
Octal 8-Bit DAC
Quad Digital Potentiometer
Quad PWM Output
Quad PWM Input
4 Bit Pattern Generator
Real Time Clock
Dual Watchdog Timers
  

Interface Cards
User Interface
Audio Amplifier
IR Recv/xmit
Six Digit LCD Display
Keyfob RF Receiver
Rotary Encoder
Quad Switch Card
Text LCD / keypad
Quad Slide Pot
Quad Touch Interface
Motion Control
Dual 7-amp H-bridge
Quad Open Drain Driver
Quad 10 Amp Relay Card
Input / Output
Octal 8-Bit DAC
Quad Digital Potentiometer
Octal 12-bit ADC
9DOF IMU
Octal SRF04
Quad GPIO
Generic I2C
Generic SPI
USB 2.0 Hub
Real Time Clock
Slot Expander
Octal Input/Output
32 Channel Input
32 Channel Output
Accessories
Power Distribution Card
15 Amp Power Distribution
5 Volt Switching Regulator
ATX Power Break-Out Card
Disk Drive Power Break-Out
MP43 Aluminum Mounting Plate
WW2 Prototyping Card
WW1 Small Prototyping Card