User manual

Basys MX3™ Board Reference Manual
Copyright Digilent, Inc. All rights reserved.
Other product and company names mentioned may be trademarks of their respective owners.
Page 36 of 56
All servos come with three wires: power, ground, and control. Pulses are sent via the control wire and a pulse-
width modulation signal controls the direction and degree of rotation. Usually servos are designed with limited
rotation angles like 60º, 90°, 180°, and so on.
Using the control signals exposed by the two servo connectors, called S0_PWM and S1_PWM, the PIC32 can
command the servos attached to the two connectors. Since the control should use the PWM functionality, these
pins need to be mapped over output compare modules OC5 and OC4.
Each servo motor connector exposes the barrel voltage (5V) together with the GND. This means using the servo
headers requires that an external power supply is connected to the barrel power connector.
15.1 Connectivity
Table 15.1 below shows the content of the two servo headers, providing details on S0_PWM and S1_PWM signals.
Connector
Label on the
Servo
Connector
Signal Name
PIC32 pin
Description
SERVO 0
PWM
S0_PWM
AN8/RPB8/CTED10/RB8
The control signal for servo 0
VBAR
VBAR
The power VBAR (5V) and GND
provided from the external power
supply (using the barrel connector), to
be used for servo 0
GND
GND
SERVO 1
PWM
S1_PWM
RPA15/RA15
The control signal for servo 1
VBAR
VBAR
The power VBAR (5V) and GND
provided from the external power
supply (using the barrel connector), to
be used for servo 1
GND
GND
Table 15.1. Servo header connectivity.
The S0_PWM and S1_PWM pins will be used as digital output pins:
The corresponding TRIS bit must be set to 0:
TRISBbits.TRISB8 = 0;
TRISAbits.TRISA15 = 0;
The ANSEL bit corresponding to S0_PWM should be set to 0:
ANSELBbits.ANSB8 = 0;
15.2 Functionality
Servo motor driver functionality is implemented in the SRV library of the Basys MX3 library pack. Implementation
features include:
RB8 is mapped to OC5
RPB8R = 0x0B; // 1011 = OC5
RA15 is mapped to OC4
RPA15R = 0x0B;// 1011 = OC4
OC5 and OC4 are properly configured, together with associated Timer 3