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 >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 1 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 >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 2 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. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 3 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. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 4 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; >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 5 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 onboard 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. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 6 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/ >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 7 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: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 8 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. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 9 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) >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 10 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) >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 11 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. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 12 How RoboSapien works? (2/4) Step 1: Analysis of the robot kinematics and dynamics UBI A. Analysis of the RS movements: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 13 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. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 14 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 robotexecutable commands are available. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 15 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 >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 16 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. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 17 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. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 18 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: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 19 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: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 20 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: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 21 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: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 22 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: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 23 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: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 24 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: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 25 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: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 26 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: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 27 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: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 28 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). >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 29 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. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 30 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. >> Contents (b) Left elbow movement from the inside to outside and vice-versa. Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 31 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”. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 32 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 Awake Eye pattern Commands 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 Eye pattern Listen >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 33 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); >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 34 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. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 35 MSP430 Integration (1/9) UBI Development of a PCB to facilitate connections to the MSP430; Microcontroller: MSP430F149; Resources: Motors: LEDs: IR: Switches: P6.0 – P6.7 , P2.0 – P2.5; P4.0 – P4.7; P1.1; P1.2 – P1.3; This task requires the fabrication and assembly of the components and devices on the proposed PCB. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 36 >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt BC847 P47 P45 P43 8 Q 6 Q 4 Q 2 Q R10 8 R 6 R LED6 LED4 LED2 LED8 4K7 4K7 4K7 BC847 4K7 BC847 BC847 1 Q 3 R 2 Motores P44 P42 BC847 5 Q 3 Q 7 R 5 R P46 7 Q 9 R 1 P20 LED1 2 P21 LED5 LED3 3 P22 LED7 n 0 0 1 4 F u 0 1 P23 P33 P32 P31 P30 P25 P24 P23 P22 P21 P20 5 C 5 6 C P24 3 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 6 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 P25 +3.3 2 P 3 P P3.4 P3.3 P3.2/SOMI0 P3.1/SIMO0 P3.0/STE0 P2.7/TA0 P2.6/ADC12CLK P2.5/Rosc P2.4/CA1/TA2 P2.3/CA0/TA1 P2.2/CAOUT/TA0 P2.1/TAINCLK P2.0/ACLK P1.7 P1.6 P1.5 Motores1 1 C P60 2 P1.4/SMCLK P1.3/TA2 P1.2/TA1 P12 P1.1/TA0 P11/IR P1.0/TACLK 1 VREF-/VeREF- 85SMX VeREF+ Y 2 P3.5 P61 P62 4 3 3 3 3 P3.6 5 1 P13 6 1 P14 4 P3.7 P63 5 3 4 1 5 P4.0/TB0 P64 P40 6 3 3 1 6 P4.1/TB1 P65 P41 7 3 2 7 P4.2/TB2 P66 P42 8 3 1 1 8 P4.3/TB3 P67 P43 9 3 0 1 1 X 9 XIN 8 VREF+ 7 P6.7/A7 P67 P4.4/TB4 T U O 4 P P44 0 4 P4.5/TB5 P45 1 4 MSP430F149 P4.6/TB6 P46 2 4 uP1 P4.7/TB7 LED P47 3 4 6 P6.6/A6 P5.0/STE1 4 4 5 P66 F 1 p 1 2 2 4 3 F p 2 1 1 C 1 P5.1/SIMO1 P6.5/A5 LED1 5 4 4 P65 TDI/TCLK 2 P5.2/SOMI1 P6.4/A4 RST/NMI TDO/TDI XT2OUT LED2 6 4 3 P64 P6.0/A0 P6.1/A1 P6.2/A2 3 P5.3 P6.3/A3 XT2IN LED3 7 4 2 P63 AVcc AVss DVss TMS 4 P5.4 TCK DVcc1 P5.5 P5.6 P5.7 LED4 8 4 1 5 LED5 6 LED6 n 0 0 1 F u 0 1 7 4 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 LED7 3 C 4 C 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 8 LED8 +3.3 6 P XT2OUT XT2IN TDO/TDI TDI TMS TCK RST/NMI P60 P61 P62 Switch 1 P11/IR LED3 2 P12 7X2 Header DS1 3 P13 P14 4 4 2 1 1 1 1 3 1 5 P RST/NMI 0 1 9 R 0 3 3 8 7 TCK 2 R F n 0 1 6 5 TMS +3.3 4 3 TDI 2 1 C15 +3.3 K 7 4 TDO/TDI 1 R 1 P New PCB schematics: BC847 BC847 BC847 4 R P40 2 +3.3 UBI 4K7 4K7 4K7 4K7 P41 1 MSP430 Integration (2/9) 37 MSP430 Integration (3/9) UBI New MSP430 PCB Connector Motors_1 connections to the RS controller: Pin U2 controller P2.0 P2.1 P2.2 P2.3 P2.4 P2.5 M1+ M1M2+ M2M3+ M3- New MSP430 PCB Connector Motors_2 connections to the RS controller: Pin U2 controller P6.0 P6.1 P6.2 P6.3 P6.4 P6.5 P6.6 P6.7 >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt M4+ M4M5+ M5M6+ M6M7+ M738 MSP430 Integration (4/9) UBI New MSP430 PCB Connector LED connections to the RS controller: Pin LED1 (P4.0) U2 controller L1 RS location Left eye LED position 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) LED8 (P4.7) L7 L8 Left gripe Right gripe >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt Figure 39 MSP430 Integration (5/9) UBI New MSP430 PCB connector switch connections to the RS controller: Pin P1.1 P1.2 P1.3 P1.4 (*) (*) (*) (*) U2 controller IR LFT / LFG RS location Left foot + Left finger RFT / RFG LEL LSH REL RSH Right foot + Right finger Left elbow Left shoulder Right elbow 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. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 40 MSP430 Integration (6/9) UBI New MSP430 PCB masks: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 41 MSP430 Integration (7/9) UBI Remove the original U2 controller from the RS PCB: (a) RoboSapien PCB board without microcontroller. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt (b) Original ASIC. 42 MSP430 Integration (8/9) UBI The next task requires soldering wires onto the RoboSapien PCB at each pin location of the U2 controller: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 43 MSP430 Integration (9/9) UBI Examples: MSP430 mounted on the back of the RoboSapien PCB; Connections to the original PCB assembled in the RS. (b) New PCB with the MSP430. (a) Connections to the RoboSapien PCB. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 44 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 >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 45 MSP430 C code programming (2/13) UBI Overview: The C code allows the MSP430 to control the RS movements. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 46 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; >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 47 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. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 48 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. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 49 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. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 50 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 >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 51 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. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 52 MSP430 C code programming (9/13) UBI Software application organization: B. Logic motors: Timers [0] [1] [2] [3] [4] [13] [14] Example: M1 = state 0 M1+ [0] 2643 425 0 0 0 0 0 1 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 [12] 0 0 0 0 0 0 0 0 0 [13] 0 0 0 0 0 0 0 0 0 then, M1 runs counter clockwise Motors Motor 1 Motor State Motor State Motor Initial Value 4 Clockwise M1+, M1- are logical motors; 1 M1 5 3 Stoped 0 2 Cclockwise Both represent the physical motor M1; M1 + HI Low Note: M1+, M1- cannot have the same high state (short circuit) HI M1 Low 525 531 319 2643 >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt t [ms] 1693 425 53 MSP430 C code programming (10/13) UBI Software application organization: C. Software architecture: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 54 MSP430 C code programming (11/13) UBI Software application organization: D. Background task: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 55 MSP430 C code programming (12/13) UBI Software application organization: D. System task: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 56 MSP430 C code programming (13/13) UBI Software application organization: E. IR command task: >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 57 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. >> Contents Copyright 2009 Texas Instruments All Rights Reserved www.msp430.ubi.pt 58