Sei sulla pagina 1di 58

MSP430 Teaching Materials

UBI

Chapter 15
Advanced Laboratories
RoboSapien powered by MSP430

Texas Instruments Incorporated


University of Beira Interior (PT)

Pedro Dinis Gaspar, António Espírito Santo, Bruno Ribeiro, Humberto Santos
University of Beira Interior, Electromechanical Engineering Department
www.msp430.ubi.pt
Copyright 2009 Texas Instruments
>> Contents All Rights Reserved
1
www.msp430.ubi.pt
Contents
UBI
 RoboSapien powered by MSP430

 What is RoboSapien?

 How RoboSapien works?


 Analysis of the dynamics and kinematics of the robot
 Analysis of all sensors, actuators and signal conditioning

 MSP430 integration (PCB board and electronics)

 MSP430 C code programming

 Tests and development of new functionality

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
2
www.msp430.ubi.pt
RoboSapien powered by MSP430 (1/2)
UBI

Robotics is being increasingly used as a vehicle for


motivating students to learn:
 Embedded systems;
 Artificial intelligence;
 Computer science;
 And even general science and engineering.

Typically, laboratory classes for courses using robotics


involve the construction and programming of simple
robots, typically composed of:
 Microcontroller;
 Sensors;
 Remote communication devices;
 DC or stepper motors;
mounted in all types of robot bodies.

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
3
www.msp430.ubi.pt
RoboSapien powered by MSP430 (2/2)
UBI
The robotics topics involve both in mechanical and
electronic engineering. Projects involve both hardware
and software development, tailored to a specific
application.

This advanced laboratory takes a multidisciplinary


approach and integrates together topics from different
knowledge areas:
 Control systems, for the different control approaches;

 Embedded systems based on the MSP430;

 Instrumentation and measurements for the sensor signal


conditioning and data acquisition;

 C/C++ programming.

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
4
www.msp430.ubi.pt
What is RoboSapien? (1/7)
UBI

The RoboSapien is a humanoid robot designed by Mark W.


Tilden, marketed by WowWee (www.wowwee.com/) for
the toy market;

The RoboSapien measures approximately 34 cm in height


and its weight is about 2.1 kg, including four mono (D)
type batteries located in its feet;

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
5
www.msp430.ubi.pt
What is RoboSapien? (2/7)
UBI

Is preprogrammed for different motions and is controlled


by an infra-red (IR) remote controller:
 Users can string together movement commands to form
either macros or mini-programs (sets of instructions);
 Send a set of instructions to the RS by IR, and save it in on-
board memory for later execution;
 Sensor-keyed instruction set, performing a specific set of
actions in conjunction with a specific sensor system.

RoboSapien is capable of:


 Walking motion;
 Grasping objects with either of its hands;
 Throwing grasped objects with mild force.

It has a small loudspeaker unit, which can emit several


different sounds.
Copyright 2009 Texas Instruments
>> Contents All Rights Reserved
6
www.msp430.ubi.pt
What is RoboSapien? (3/7)
UBI

Some words of the Robot Tech Support, from WowWee


Ltd.:
“The RoboSapien is designed for modification. Here is the short
hint list for the budding RS hacker.

First off, we must warn you that completely replacing the


RS brain should only be attempted by those with a lot of
time, electronic skills, and programming ego.

You don’t have to though — if you carefully remove the


connectors and lift the RS motherboard, on the back you will
find all inputs and outputs labeled, and right next to gold pads
convenient for soldering wires…”

in http://www.robosapien1.com/resources/official-mod-guide/
Copyright 2009 Texas Instruments
>> Contents All Rights Reserved
7
www.msp430.ubi.pt
What is RoboSapien? (4/7)
UBI

This biomorphic robot was designed to be easily modified


or hacked, the electronics inside the RS being easily
accessed and clearly labelled;

A growing community has devoted themselves to modify


and add new functionalities to the robot:
 http://www.robocommunity.com/

Some features have been added in order to provide new


features to the RS:

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
8
www.msp430.ubi.pt
What is RoboSapien? (5/7)
UBI

Microbi’s Robosapien mods:


 http://www.angelfire.com/droid/rsv2/
 Active modifications: hand-beams, hand-LEDs,
heartbeat, voice off, tunnel-beam, blue eyes.

Robosapien RF Sound Mod:


 (http://home.comcast.net/~robosapien/rfmod.htm)

Robosapien Camera Mod:


 (http://home.comcast.net/~jsamans/robo/robocam.htm)
 Active modifications: wireless camera,
wireless radio, frequency audio and
pc control.

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
9
www.msp430.ubi.pt
What is RoboSapien? (6/7)
UBI

RoboSapienPets RoboSapien page:


 http://www.aibohack.com/robosap/
 Active mods: SuperSapien microcontroller mod,
color and motion tracking CMUCam

Mark C’s Robosapien Hacking Site:


 http://homepages.strath.ac.uk/~lau01246/robot/myhackrs.shtml
 Active mods: microcontrollers (PicMicro
controllers, and Palm Pilot controllers for
the Robosapien)

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
10
www.msp430.ubi.pt
What is RoboSapien? (7/7)
UBI

Robocup German Open 2005 tournament:


 2 teams of 3 RSs each played the 1st soccer match for humanoid
robots worldwide;
 Head replaced by a PDA, allowing a display of its environment
using the camera;
 Information sent to a PC though the IR of the PDA.

(Sven Behnke, Jurgen Muller, and Michael Schreib, „Playing Soccer with RoboSapien”, Proceedings of The 9th RoboCup International
Symposium, Osaka, Japan, July 2005)

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
11
www.msp430.ubi.pt
How RoboSapien works? (1/4)
Step 1: Analysis of the robot kinematics and dynamics
UBI

 The first task consists in the analysis of the robot


dynamics and kinematics (evaluation of the robot
movements and its characteristics).

 This task requires testing the RS movements.

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
12
www.msp430.ubi.pt
How RoboSapien works? (2/4)
Step 1: Analysis of the robot kinematics and dynamics
UBI

 A. Analysis of the RS movements:

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
13
www.msp430.ubi.pt
How RoboSapien works? (3/4)
Step 1: Analysis of the robot dynamics and kinematics
UBI

 A. Analysis of the RS movements:

 Dynamic walking pattern:


• (1) The trunk motor tilts the upper body to the right.
The centre of mass shifts over to the right foot. The left
foot lifts from the ground;

• (2) The hip motors move in opposite directions, resulting


in a forward motion of the robot. As the upper body
swings back, the left foot regains contact with the
ground;

• (3) Similar to (1). The trunk motor tilts the body to left;

• (4) Similar to (2). Hip motors move in other direction.

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
14
www.msp430.ubi.pt
How RoboSapien works? (4/4)
Step 1: Analysis of the robot dynamics and kinematics
UBI

 B. Analysis of RS’s remote control commands:


 The RS’s remote control unit has 21 different buttons;

 With the help of two shift buttons, 67 different robot-


executable commands are available.

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
15
www.msp430.ubi.pt
How RoboSapien works? (1/21)
Step 2: Actuators, sensors and signal conditioning analysis
UBI

 The next task requires a dismantling procedure to allow


detailed analysis of the:
 Actuators (motors);
 Regulation electronics;
 Sensors and respective signal conditioning;
 PCB included with the original robot.

 A procedure for dismantling the RS in order to give it


additional features is detailed in:
http://personal.strath.ac.uk/mark.craig/robot/robos.shtml

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
16
www.msp430.ubi.pt
How RoboSapien works? (2/21)
Step 2: Actuators, sensors and signal conditioning analysis
UBI

RS’s PCB (Controller U2 and Motor Driver U3) is easily


accessed and clearly labelled:
 M:Motors;
 P: Input or output port;
 VDD: Raw battery voltage (fluctuates wildly);
 Vcc: Regulated voltage (Vcc = 3.6 V);
 Gnd: Universal ground.

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
17
www.msp430.ubi.pt
How RoboSapien works? (3/21)
Step 2: Actuators, sensors and signal conditioning analysis
UBI
Tasks:
 List and investigate the functions of:
• All the components and devices included on the PCB;
• Actuators, sensors and output devices;

 Determine the mechanical and/or electrical characteristics of:


• Controller U2;
• Motor driver U3;
• Power switch;
• Motors: shoulder (2); elbow (2); hip (2) and trunk (1);
• Foot touch sensors (4);
• Finger touch sensors (2);
• End course position switches (shoulders and elbows);
• Sound sensor;
• Eight LEDs (fingers (2) and eyes (6));
• IR receiver and external IR remote control.
Copyright 2009 Texas Instruments
>> Contents All Rights Reserved
18
www.msp430.ubi.pt
How RoboSapien works? (4/21)
Step 2: Actuators, sensors and signal conditioning analysis
UBI
A. Motor controller (U2) connections:
 Details of the connections to the motors of the U2 controller.

 Shoulder motors:

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
19
www.msp430.ubi.pt
How RoboSapien works? (5/21)
Step 2: Actuators, sensors and signal conditioning analysis
UBI
A. Motor controller (U2) connections:
 Details of the connections to the motors of the U2 controller.

 Elbow motors:

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
20
www.msp430.ubi.pt
How RoboSapien works? (6/21)
Step 2: Actuators, sensors and signal conditioning analysis
UBI
A. Motor controller (U2) connections:
 Details of the connections to the motors of the U2 controller.

 Hip and trunk motors:

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
21
www.msp430.ubi.pt
How RoboSapien works? (7/21)
Step 2: Actuators, sensors and signal conditioning analysis
UBI
B. Position switches and touch sensor connections:
 Details of the connections to the switches of the U2 controller.

 Shoulder position switches:

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
22
www.msp430.ubi.pt
How RoboSapien works? (8/21)
Step 2: Actuators, sensors and signal conditioning analysis
UBI
B. Position switches and touch sensor connections:
 Details of the connections to the switches of the U2 controller.

 Elbow position switches:

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
23
www.msp430.ubi.pt
How RoboSapien works? (9/21)
Step 2: Actuators, sensors and signal conditioning analysis
UBI
B. Position switches and touch sensor connections:
 Details of the connections to the switches of the U2 controller.

 Finger touch sensors:

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
24
www.msp430.ubi.pt
How RoboSapien works? (10/21)
Step 2: Actuators, sensors and signal conditioning analysis
UBI
B. Position switches and touch sensor connections:
 Details of the connections to the switches of the U2 controller.

 Feet touch sensors:

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
25
www.msp430.ubi.pt
How RoboSapien works? (11/21)
Step 2: Actuators, sensors and signal conditioning analysis
UBI
C. LEDs connections:
 Details of the connections to the LED of the U2 controller.

 Finger LED connections:

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
26
www.msp430.ubi.pt
How RoboSapien works? (12/21)
Step 2: Actuators, sensors and signal conditioning analysis
UBI
C. LEDs connections:
 Details of the connections to the LED of the U2 controller.

 Eye LED connections:

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
27
www.msp430.ubi.pt
How RoboSapien works? (13/21)
Step 2: Actuators, sensors and signal conditioning analysis
UBI
D. Command and power connections:
 Details of the command and power connections.

 Command and power connections:

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
28
www.msp430.ubi.pt
How RoboSapien works? (14/21)
Step 2: Actuators, sensors and signal conditioning analysis
UBI
E. Acquisition and analysis of digital port signals:

 Continue with the analysis of the digital signals acquired from


the ports on the PCB;

 Evaluate the original microcontroller control output ports when


the robot performs a specific command function;

 Define the time sequence of the active/inactive motor in each


specific movement;

 Procedure:
• List the active/inactive time of each motor:
o Single movement (single motor);

o Combined movements (more than one motor).

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
29
www.msp430.ubi.pt
How RoboSapien works? (15/21)
Step 2: Actuators, sensors and signal conditioning analysis
UBI
E. Acquisition and analysis of digital port signals:
 Task:
 Use an oscilloscope to acquire the signals used for single
movements;
 If available, use a logic analyzer to acquire the signals used
for the combined movements signals;
 Connect probes to the output port pins.

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
30
www.msp430.ubi.pt
How RoboSapien works? (16/21)
Step 2: Actuators, sensors and signal conditioning analysis
UBI
E. Acquisition and analysis of digital port signals:

 Single motor signal analysis:


• Compare the output signal from the original
microcontroller and the signal that the motor receives.

• Examples:

(a) Output signal vs. motor input signal. (b) Left elbow movement from the inside
to outside and vice-versa.
Copyright 2009 Texas Instruments
>> Contents All Rights Reserved
31
www.msp430.ubi.pt
How RoboSapien works? (18/21)
Step 2: Actuators, sensors and signal conditioning analysis
UBI
E. Acquisition and analysis of digital port signals:

 Analysis of signals for combined actions:


• Connect probes to the original microcontroller ports to
measure the digital signals with a logic analyzer.

• Example: combined movement: “Oops”.

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
32
www.msp430.ubi.pt
How RoboSapien works? (19/21)
Step 2: Actuators, sensors and signal conditioning analysis
UBI
F. Analysis of the eyes pattern:

 Evaluate the eye pattern (6 LEDs – P2.0 to P2.5) depending


on the command that is executed:
Commands Eye pattern Commands Eye pattern
Awake Angry

Down right Startled

Down left Sleep

Look up Off

Confused Wink

Look down Program mode

Up right Program right reflex

Up left Program left reflex

Listen Program sonix reflex

Listen

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
33
www.msp430.ubi.pt
How RoboSapien works? (20/21)
Step 2: Actuators, sensors and signal conditioning analysis
UBI

G. Analysis of the IR commands:


 Using a logic analyser, determine the IR command digital
value (port IR-OUT) for each movement command of the
remote controller.

 Serial communication specifications:


• Direct serial input to the IR-OUT pin (active low signals,
1200 bps);

• Timing based on 1/1200 second clock (~ 0.833 msec)


Signal is normally high (idle, no IR);

• Data bits: for each of the 8 data bits, space encoded


signal depending on the bit values (Sends the most
significant data bit first). (Carrier is 39.2 kHz);
Copyright 2009 Texas Instruments
>> Contents All Rights Reserved
34
www.msp430.ubi.pt
How RoboSapien works? (21/21)
Step 2: Actuators, sensors and signal conditioning analysis
UBI

G. Analysis of the IR commands:

 Serial communication specifications:


• Preamble: signal goes low for 8/1200 sec;
• data bit = 0: signal goes high for 1/1200 sec, and low for
1/1200 sec;
• data bit = 1: signal goes high for 4/1200 sec, and low for
1/1200 sec;

• Example: Command “Wake Up”: 0xB1.

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
35
www.msp430.ubi.pt
MSP430 Integration (1/9)
UBI

Development of a PCB to facilitate connections to the


MSP430;

Microcontroller: MSP430F149;

Resources:
 Motors: P6.0 – P6.7 , P2.0 – P2.5;
 LEDs: P4.0 – P4.7;
 IR: P1.1;
 Switches: P1.2 – P1.3;

This task requires the fabrication


and assembly of the components
and devices on the proposed PCB.
Copyright 2009 Texas Instruments
>> Contents All Rights Reserved
36
www.msp430.ubi.pt
MSP430 Integration (2/9)
UBI +3.3

New PCB schematics: TDI


P1
TDO/TDI
1 2
R1
47K C15 +3.3
3 4 +3.3
TMS
5 6 10nF R2
TCK
7 8 330R
9 10
RST/NMI P5
11 12
P14
13 14 4
P13
DS1 3
Header 7X2 P12
LED3 2
P11/IR
1
Switch

P62 61
P61 60
P60 59
RST/NMI
TCK 57
TMS 56
TDI 55
TDO/TDI
XT2IN53
XT2OUT
P6
+3.3 LED8
C4 C3 8
LED7

64
63
62

58

54

52
51
50
49
10uF 100n 7
LED6
6
LED5
5
1 48 LED4

P5.7
P5.6
P5.5
TCK
DVcc1 P5.4 4

TMS
DVss
AVss
AVcc
P63 2 47 LED3

XT2IN
P6.3/A3 P5.3 3

P6.2/A2
P6.1/A1
P6.0/A0
P64 3 46 LED2

XT2OUT
TDO/TDI
RST/NMI
P6.4/A4 P5.2/SOMI1 2

TDI/TCLK
P65 4 45 LED1
C1 P6.5/A5 P5.1/SIMO1 1
12pF P66 5 44
P6.6/A6 P5.0/STE1
P67 6 43 P47 LED
P6.7/A7 P4.7/TB7
7 uP1 42 P46
VREF+ P4.6/TB6
8 MSP430F149 41 P45
XIN P4.5/TB5
9 40 P44 P4
2

XOUT P4.4/TB4
Y1 10 39 P43 P67
VeREF+ P4.3/TB3 8
85SMX 11 38 P42 P66
VREF-/VeREF- P4.2/TB2 7
12 37 P41 P65
P1.0/TACLK P4.1/TB1 6
P11/IR
13 36 P40 P64
P1.1/TA0 P4.0/TB0 5
P1214 35 P63
3

P1.2/TA1 P3.7 4
P1315 34 P62
P1.3/TA2 P3.6 3
P1416 33 P61
C2 P1.4/SMCLK P3.5 2
12pF P60
1
Motores1

P1.5
P1.6
P1.7
P2.0/ACLK
P2.1/TAINCLK
P2.2/CAOUT/TA0
P2.3/CA0/TA1
P2.4/CA1/TA2
P2.5/Rosc
P2.6/ADC12CLK
P2.7/TA0
P3.0/STE0
P3.1/SIMO0
P3.2/SOMI0
P3.3
P3.4
P3
P2 +3.3 P25
6

P20

P22
P23

P25
P21

P24

P30
P31
P32
P33
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
P24
2 C5 C6 5
P23
1 100n 10uF 4
LED7 P22
3
LED3 LED5 P21
2
LED1 P20
R9 Q7 1
P46
P42 R5 Q3 P44 R7 Q5 BC847 Motores 2
P40 R3 Q1 BC847 BC847
4K7
BC847
4K7 4K7
4K7

LED8
LED2 LED4 LED6

P41 R4 Q2 P43 R6 Q4 P45 R8 Q6 P47 R10 Q8


BC847 BC847 BC847 BC847
4K7 4K7 4K7 4K7

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
37
www.msp430.ubi.pt
MSP430 Integration (3/9)
UBI

New MSP430 PCB Connector Motors_1 connections to the


RS controller: Pin U2 controller
P2.0 M1+
P2.1 M1-
P2.2 M2+
P2.3 M2-
P2.4 M3+
P2.5 M3-

New MSP430 PCB Connector Motors_2 connections to the


RS controller: Pin U2 controller
P6.0 M4+
P6.1 M4-
P6.2 M5+
P6.3 M5-
P6.4 M6+
P6.5 M6-
P6.6 M7+
P6.7 M7-
Copyright 2009 Texas Instruments
>> Contents All Rights Reserved
38
www.msp430.ubi.pt
MSP430 Integration (4/9)
UBI

New MSP430 PCB Connector LED connections to the RS


controller:
Pin U2 controller RS location LED position Figure
LED1 (P4.0) L1 Left eye Upper

LED2 (P4.1) L2 Left eye Middle

LED3 (P4.2) L3 Left eye Lower

LED4 (P4.3) L4 Right eye Middle

LED5 (P4.4) L5 Right eye Upper

LED6 (P4.5) L6 Right eye Lower

LED7 (P4.6) L7 Left gripe


LED8 (P4.7) L8 Right gripe

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
39
www.msp430.ubi.pt
MSP430 Integration (5/9)
UBI

New MSP430 PCB connector switch connections to the RS


controller:
Pin U2 controller RS location
P1.1 IR
P1.2 LFT / LFG Left foot + Left finger
P1.3
P1.4 RFT / RFG Right foot + Right finger
(*)
LEL Left elbow
(*)
LSH Left shoulder
(*)
REL Right elbow
(*)
RSH Right shoulder

(*) These connections were not used because the code has
been developed to take into account the shoulders and elbows
motors active period time, to obtain the end positions.
Copyright 2009 Texas Instruments
>> Contents All Rights Reserved
40
www.msp430.ubi.pt
MSP430 Integration (6/9)
UBI

New MSP430 PCB masks:

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
41
www.msp430.ubi.pt
MSP430 Integration (7/9)
UBI

Remove the original U2 controller from the RS PCB:

(a) RoboSapien PCB board without microcontroller. (b) Original ASIC.

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
42
www.msp430.ubi.pt
MSP430 Integration (8/9)
UBI

The next task requires soldering wires onto the


RoboSapien PCB at each pin location of the U2 controller:

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
43
www.msp430.ubi.pt
MSP430 Integration (9/9)
UBI

Examples:
 MSP430 mounted on the back of the RoboSapien PCB;
 Connections to the original PCB assembled in the RS.

(a) Connections to the RoboSapien PCB. (b) New PCB with the MSP430.

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
44
www.msp430.ubi.pt
MSP430 C code programming (1/13)
UBI

Project files:

 C source files: Chapter 15 > Lab11a > main.c


Chapter 15 > Lab11a > Global.h
Chapter 15 > Lab11a > Commands.h
Chapter 15 > Lab11a > Commands.c
Chapter 15 > Lab11a > Actions.h
Chapter 15 > Lab11a > Actions.c

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
45
www.msp430.ubi.pt
MSP430 C code programming (2/13)
UBI

Overview:

 The C code allows the MSP430 to control the RS movements.

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
46
www.msp430.ubi.pt
MSP430 C code programming (3/13)
UBI

Resources:

 TIMER_A is configured in compare mode, providing an ISR


once every 1 msec;

 Timer_B is configured in capture mode, providing an ISR to


implement the receiver command task;

 This application makes use of the following MSP430F149


resources:
• Timer_A;
• Timer_B;
• I/O ports;
• Interrupts; Copyright 2009 Texas Instruments
>> Contents All Rights Reserved
47
www.msp430.ubi.pt
MSP430 C code programming (4/13)
UBI

Software application organization:

 Definition and implementation of the command receiver task


(Commands.h and Commands.c);

 Implements all the functions of the system task, to drive the


motors and LEDs, and monitor the switches (Actions.h and
Actions.c);

 Defines the movement tables ACTION DATA TABLES


(main.c):
• Times when to toggle each motor state (active/inactive);
• LED patterns;
• Motors initially active;
• Motors enabled;
• Data from Step2E and Step2F.
Copyright 2009 Texas Instruments
>> Contents All Rights Reserved
48
www.msp430.ubi.pt
MSP430 C code programming (5/13)
UBI

Software application organization:

 Definition and implementation of the command receiver


task (Commands.h and Commands.c);

 Functions of the System task to drive the motors and LEDs,


and monitor the switches (Actions.h and Actions.c);

 Define the movement tables ACTION DATA TABLES (main.c):


• Time to toggle each motor state (active/inactive);
• LED patterns;
• Motors initially active;
• Motors enabled;
• Data from Step2E and Step2F.

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
49
www.msp430.ubi.pt
MSP430 C code programming (6/13)
UBI

Software application organization:

 A. Organization of the information required for the RS


actions:
• The table pointers ensure rapid access to the “access
table” information:
o Contains all the structure addresses (move data);

o Movements = data structures “data movements ()”;

o Structure = {time, sequence, initial state, stop};

o Each motor starts at the initial state and toggles

between states On and Off when the timer decreases


to 0;
o When a counter reaches 0, the next timer is activated;

o The motor stops if the counter reaches 0 and the next

counter contains a count of zero.


Copyright 2009 Texas Instruments
>> Contents All Rights Reserved
50
www.msp430.ubi.pt
MSP430 C code programming (7/13)
UBI

Software application organization:

 A. Organization of the information required for the RS


actions (continued):

Data Movement (1) Data Movement (2) Data Movement (3) Data Movement (n)

ActPtr[]
Access table
n= Max RS accions

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
51
www.msp430.ubi.pt
MSP430 C code programming (8/13)
UBI

Software application organization:

 B. Logic motors:

• The RS motors have 3 states:


o Rotate clockwise;

o Rotate counter clockwise;

o Stop.

• Control of each motor is implemented as two logic


signals.

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
52
www.msp430.ubi.pt
MSP430 C code programming (9/13)
UBI

Software application organization:

 B. Logic motors:
Timers
[0] [1] [2] [3] [4] [13] [14]

Motor 1
M1+ [0] 2643 425 0 0 0 0 0 1 0 Example: M1 = state 0
M1- [1] 525 531 319 1693 0 0 0 1 1
[2] 0 0 0 0 0 0 0 0 0
If M1+ = High & M1- = Low
Motors

[12] 0 0 0 0 0 0 0 0 0
then, M1 runs counter
[13] 0 0 0 0 0 0 0 0 0 clockwise
Motor State Motor
Motor Initial Value State
4
Clockwise
1 3 5

M1+, M1- are logical motors; M1 Stoped

Cclockwise
0 2

Both represent the physical motor M1; M1 +


Low
HI

Note: M1+, M1- cannot have the M1 -


HI

same high state (short circuit) Low


t [ms]
525 531 319 1693
2643 425
Copyright 2009 Texas Instruments
>> Contents All Rights Reserved
53
www.msp430.ubi.pt
MSP430 C code programming (10/13)
UBI

Software application organization:

 C. Software architecture:

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
54
www.msp430.ubi.pt
MSP430 C code programming (11/13)
UBI

Software application organization:

 D. Background task:

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
55
www.msp430.ubi.pt
MSP430 C code programming (12/13)
UBI

Software application organization:

 D. System task:

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
56
www.msp430.ubi.pt
MSP430 C code programming (13/13)
UBI

Software application organization:

 E. IR command task:

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
57
www.msp430.ubi.pt
Tests and development of new functionalities
UBI

The final task consists of performing tests to evaluate the


robot movements and perform fine-tuning;

Proposals for the development of new functionalities;

Examples:
 Wireless communications instead of IR remote control;
 Voice commands (use other devices in the MSP430 family);
 Integrate sensors (optical, acoustics and others...);
 Digital camera to provide more autonomy for the RoboSapien.

Now, it is up to you! Try to reach the next phase of the


RoboSapien evolution.

Copyright 2009 Texas Instruments


>> Contents All Rights Reserved
58
www.msp430.ubi.pt

Potrebbero piacerti anche