User`s manual

ROBOT . HEAD to TOE
Product User’s Manual – SD02B
Created by Cytron Technologies Sdn. Bhd. – All Rights Reserved
14
5.4 Connecting to Microcontroller through UART
A new feature for SD02B is the UART interface for easier communication between a host
(user’s circuit or PC) and SD02B. By using the UART control, user can on/off, run/brake and
change motor rotation direction in a simple commands. Beside that user can request for
encoder value, tracks the encoder value and brakes the motor at desired steps count,
accelerate the motor from a specified initial speed to a final speed at desired acceleration rate.
Here is an example connection of SD02B to Microchip PIC16F877A through UART.
5.4.1 Connecting SD02B to Microcontroller
For microcontroller to interface with SD02B, only 3 connections are needed. They are TTL
UART (Universal Asynchronous Receiver and Transmitter) transmit (TX) and receive (RX)
pins, together with the system ground (Gnd).
C1
25V 100uF
C2
25V 10uF
VCC
12V IN
1
GND
2
OUT
3
U?
LM7805
X
FAN & HEAT SINK
SD02B
!X
Y
!Y
Reset
Power
Te s t
!X
Vmotor
GND
!Y
DIR
Y
X
GND
Signal
Vin
EN
PU LS E
GND
Stepper
12V
UART
NC
Gnd
TX
RX
TX_1
RX_1
MCLR/Vp p
1
RA0/AN0
2
RA1/AN1
3
RA2/AN2
4
RA3/AN3
5
RA4
6
RA5/AN4
7
Vss
12
OSC1
13
OSC2
14
RC0
15
RC1
16
RC2
17
RC3
18
RC4
23
RC5
24
RC6/T X
25
RC7/RX
26
Vss
31
RB0
33
RB1
34
RB2
35
RB3
36
RB4
37
RB5
38
RB6
39
RB7
40
RE0/ AN5
8
RE1/ AN6
9
RE2/ AN7
10
RD1
20
Vdd
11
RD0
19
RD2
21
RD3
22
RD4
27
RD5
28
RD6
29
RD7
30
Vdd
32
U1
PIC16F877A
5V
5V
104
C7
C CAP
1 2
Y1
XTAL
33pF
C5
Ca p
33pF
C6
Ca p
4K7
R?
5V
CCP 1
RX_1
TX_1