Digilent PmodHB5 Podręcznik referencyjny

Przeglądaj online lub pobierz pdf Podręcznik referencyjny dla Mikrokontrolery Digilent PmodHB5. Digilent PmodHB5 4 stron.

P
m
o
d
H
B
5
D
e
P
m
o
d
H
B
5
D
M
a
n
u
a
l
M
a
n
u
a
l
Revision: February 14, 2012
Introduction
The Digilent PmodHB5 2A H-Bridge Module (the HB5) is an ideal solution for robotics and other
applications where logic signals are used to drive small to medium-sized DC motors, such as the
Digilent motor-gearbox. The HB5 works with power supply voltages from 2.5V to 5V, but is commonly
operated at 3.3V because that is the supply voltage on most Digilent system boards. This document
describes the application that demonstrates the use of HB_MotorLib library functions. It also
demonstrates how to use CLPLib library functions.
Note: Project was created using MPLAB v8.83. To use this demo with the HB3 and have the proper
RPM calculation, the GND and VCC connections on the J5 header are actually switched. i.e. GND is
connected to VCC of the motor and VCC is connected to GND of motor.
Overview
Using the two buttons on Cerebot32Mx4 board, the user controls the duty applied to a motor and the
direction. The application reads motor data and outputs the RPM on the CLP. The main loop contains
a loop processing button actions and the display. Buttons are read and debounced at a rate of 100us
using timer 5. Using buttons, duty is raised and lowered (single button), or direction is changed
(double buttons). Pressing BTN2 will raise the duty cycle 1% while pressing BTN 1 will decrease the
duty cycle by 1%. If the user releases one button while the other is pressed, known as double buttons
action, the direction of the motor will change, but the duty cycle magnitude is maintained.
Note: The demo assumes that PmodCLP J1 is plugged into JA and J2 is plugged into JB, also, the
PmodHB5 is to be plugged into JH on the lower set of pins.
Library Operation
Library Interface
HB_MotorLib_Defs.h was edited with the following revisions:
-
Define the use of Pmod connector JH 7-12
o #define _MOTOR1
-
Define the fact that the real time clock is incremented from application ISR
o #define REALTIME_CALLEDBYUSER
-
Define the real time factor
o REAL_TIME_FACTOR 10000 // (= 1s/100 us)
The following library functions from HB_MotorLib_Defs.h were used:
Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners.
m
o
R
e
f
e
r
e
n
e
m
o
R
e
f
e
r
e
n
c
e
c
e
(509) 334 6306 Voice | (509) 334 6300 Fax
1300 NE Henley Court, Suite 3
Pullman, WA 99163
page 1 of 4
®