MSP430 Family Starter Kit Evaluation Kit Manual 1999 Mixed-Signal Products SLAS191A
IMPORTANT NOTICE Texas Instruments and its subsidiaries (TI) reserve the right to make changes to their products or to discontinue any product or service without notice, and advise customers to obtain the latest version of relevant information to verify, before placing orders, that information being relied on is current and complete.
Contents Section Title Page 1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1–1 1.1 Installing the Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1–1 1.2 Hardware Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1–2 1.2.1 The STK/EVK-PCB Operating Conditions . . . . . . . . . . . . . . . .
7 A Memory Configurations for MSP430 Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7–1 Difference Between STK and EVK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A–1 List of Illustrations Figure Title Page 1–1 MSP-STK430 Program Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1–2 1–2 MSP/EVK430 Program Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2–14 Transfer Data Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2–14 2–15 EPROM Erase Check Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2–15 2–16 Location of a Breakpoint Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2–16 2–17 Set a Breakpoint Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
vi
1 Getting Started This chapter provides installation and programming instructions for the starter Kit MSP-STK430x320, and the evaluation Kits MSP-EVK430x320 and MSP-EVK430x320. NOTE: This manual covers both the MSP-STK430x320 and MSP-EVK430x320 kits. The actual icons and/or windows on the computer screen may differ from those shown in the book due to software version upgrades. In this documentation, the term STK/EVK is used interchangeably to represent both kits.
Figure 1–1. MSP-STK430 Program Group Figure 1–2. MSP/EVK430 Program Group NOTE: EVK/STK430 Terminal icon Before clicking the EVK/STK430 Terminal icon, ensure the standard Windows Applications Terminal and Notepad are installed in the Windows directory. The Windows terminal emulator is configured to use serial port COM2 by default. 1.2 Hardware Installation The STK/EVK kit hardware includes the STK/EVK-PCB and one 9-pin cable for connection to the PCs serial communication port.
1.2.2 How to Install the Hardware This section targets three main parts: the setup of the serial interface, the programming adapter, and the power supply. LCD and UVEPROM The EVK is supplied with the LCD and a UVEPROM, separate from the EVK PCB. Install the EPROM and LCD into the EVK PCB before proceeding. Refer to the STK/EVK target connectors section for the correct LCD orientation. The STK has a one-time programmable (OTP) device mounted on the PCB.
MSP–STK430A320 >_ Figure 1–3. Terminal Screen A help message is displayed on the screen automatically if the Monitor message MSP-STK430x320 is not received by the STK/EVK control software, where x is the current revision letter. Reset Button NOTE: Pins for the STK Demo Program Some pins of the MSP430 device will be used for the sensor demo program (only available on the STK): • A5 (connected to the sensor) • Seg0. . .Seg13 (connected to the LCD Display) • Com1. . .
Changing the RS232 interface to another COM port (other than COM2) of a personal computer, requires a change to the COM port assignment in the current version of the terminal emulator. 1.2.3 Programming the Monitor Software Into an Erased EPROM (EVK Only) The following steps are recommended to program the Monitor into an EPROM after it has been erased: 1. Connect the EVK-PCB to the programming adapter. 2. Connect the programming adapter to the PC. 3.
1.2.4 MSP-STK/EVK430x320 Target Connectors External Supply 3–5V dc Only Required If Stand Alone Operation Pin 1 Pin 2 Pin 3 Pin 4 Pin 5 Pin 6 Pin 7 Pin 8 VCC 3V 5V VCC 5V 5V 3V A4 A5 A2 A3 SVCC REXT A0 A1 Digital Signals: Pin 1 Pin 2 Pin 3 Pin 4 Pin 5 Pin 6 Pin 7 Pin 8 XIN XOUT XBUF RST/NMI TCK TMS TDI TDO Pin 9 Pin 10 Pin 11 Pin 12 Pin 13 Pin 14 Pin 15 Pin 16 NC CI TP.0 TP.1 TP.2 TP.3 TP.4 TP.5 Pin 17 Pin 18 Pin 19 Pin 20 Pin 21 Pin 22 Pin 23 Pin 24 PO.0 PO.1 PO.2 PO.3 PO.4 PO.5 PO.6 PO.
1.2.5 MSP-EVK430x330 Target Connectors Pin z = Power g = Ground Figure 1–6.
1.2.6 The LCD Figure 1–7 shows the segment type LCD supplied with the STK/EVK. 40.00 1.80x 19 = 34.20 ± 0.05 2.90 20 6.00 1 Digit 7 6 5 4 3 2 1 0 Figure 1–7. Supplied LCD Mechanical Data 1–8 ± 0.15 0.90 8.30 2.00 VEWING AREA 4.10 0.90 ± 0.10 14.40 ± 0.25 ± 0.15 4.85 2.90 ± 0.
The LCD is connected to the STK/EVK as shown in Table 1–1. Table 1–1. LCD Connector PIN NO.
D1 LL103A VCCEXT BU1 A K D2 LL103A C4 10 µ F 30 V FD 25 A F1 R4 510 K GND K U4 TL751L1200 1 S/F OUT1 8 2 7 PQ OUT2 3 6 GND IN3 4 5 EN_ IN2 A K A D13 LL303A D12 LL434B GND R7 270 K U1 – + – + R1 100 k Open TPS720100 8 S/F OUT1 2 7 PQ OUT2 3 6 GND IN3 4 5 EN_ IN2 1 GND R23 1k GND A GND K 13 11 9 7 5 3 1 J1 XOUT RST/NMI 14 12 10 8 B C T1 8C850 E VCC_MSP 6 4 2 J1 Not Assembled onSTK R9 100 k R3 4.
BU1 Buchse VCC C6 100 N GND 270 kΩ R7 D11 GND LL103A 8 IN 7 C4 6 5 C3 EN 1 OUT 2 C1 3 C2 4 NC TL751L12QD D12 C7 + S1 2 C3 100 N R1 C8 GND C12 33 µ F R7 1 kΩ TDO TDI TMS TCK GND GND 10 µ F – 100 N TPS7201QD 8 1 SF OUT1 2 7 PG OUT2 3 6 4 GND IN1 5 EN IN2 Not Assembled GND F0.25 A LL4148 F1 – Solder Eyes 1 R8 LL103A D2 C6 10 µ F LL103A + R4 R6 VCC = 3 V, 0 Ω VCC = 5 V, Open 560 kΩ 10 V C12 100 N 1OO kΩ D1 VCC EXIT 510 kΩ R5 100 kΩ 9.
1.2.9 Starting the STK Demo Program In the HyperTerminal program, type a d to start the demo program. If the HyperTerminal program has been closed, double click on the Sensor Demo icon to start the demo program. LUXMETER Demo Program: The STK Monitor includes a demo program that shows a metering application. The application hardware consists of the light sensor, a trigger button, and a voltage reference for the analog-to-digital converter.
How to use the command line parameters of the assembler: The default command line parameters of the assembler (asm430.exe) are -z and -I. These parameters are set in the Properties of the Assembler icon after installation. For further information on command line parameters see the Assembly Language Tools User’s Guide. To change the parameters, select the ASM430 Assembler icon with one left mouse click. Click on the file menu in the Windows Program Manager and select the Properties command.
;**************************************************************************** ;Getting Started 1 Demo Program (C) TEXAS INSTRUMENTS on 2/96 ;**************************************************************************** SIM .set 0 RAM_orig SP_orig .set .set 00240h 003DEh ; ; ; ; 1 = Simulator 0 = STK/EVK Free Memory startadress stackpointer ;––– Control register definitions IE1 IE2 IFG1 IFG2 ME1 ME2 .equ .equ .equ .equ .equ .equ 0h 01h 02h 03h 04h 05h WDTCTL WDTHold WDT_wrkey .equ .equ .
Use the assembler icon in the ADT430 Program Folder to assemble the gs_stk1.asm file, which is located in the C:\ADT430\STK\EXAMPLES directory, and is shown in Figure 1–11. Ensure that the Start in: property of the assemble icon is set to the source directory (C:\ADT430\STK\EXAMPLES). Click on the ASM430 Assembler icon. The following screen will appear (the version number, date, and copyright date may differ from that shown below): Figure 1–12.
Enter the source name gs_stk1 and press ENTER. This will cause the assembler to assemble gs_stk1.asm into gs_stk1.txt. The following display will appear: File Source Figure 1–13. gs_stk1.asm Window Display The assembler output file is named gs_stk1.txt. This file is created only if the assembler is invoked with the option -z. To verify that the gs_stk1.txt file was created, check the ADT430\STK\EXAMPLES directory. An additional listing of gs_stk1.lst is created when the option -l is used.
MSP430 Macro Assembler Version 1.08 [09/96] Tue Jun 30 07:20:38 1998 Copyright (C) 1995, 1996 Texas Instruments Incorporated c:\adt430\stk\examples\gs_stk1.asm Page 1 1;*************************************************************************** 2;Getting Started 1 Demo Program (C) TEXAS INSTRUMENTS on 2/96 3;*************************************************************************** 4 5;*** Set this variable to ’1’ for the use on the Simulator*** 6 00 SIM .
Next, the object file gs_stk1.txt will be downloaded to RAM of the MSP430-STK/EVK. The PC downloads the object file gs_stk1.txt to RAM of the MSP430_STK/EVK. The PC uses the HyperTerminal to communicate with the Monitor Program in the EVK/STK EPROM or ROM. Windows95 (NT) provides a terminal emulator icon under Start/Programs/Accessories. Double-clicking with the mouse on the STK430 terminal icon also starts the HyperTerminal. The STK430 icon is located under the ADT430 program group.
Open the pulldown menu Transfer in the HyperTerminal to load the program using the RS232 into the STK/EVK, as shown in Figure 1–16. Select the Send Text File menu item. NOTE: Transfer Send Text File MSP–STK430A320 >_ Receive text file... View Text File... Send Binary File... Receive Binary File... Pause Resume Stop Figure 1–16. Terminal Transfer NOTE: The help menu can be displayed by typing an h.
Select the assembler output file gs_stk1.txt in the examples directory from the Send Text File . . dialog box. Figure 1–17 shows the HyperTerminal screen displaying the following data after loading gs_stk1.txt into the STK/EVK. Init MSP–STK430A320 >@0240 31 40 DE 03 B2 40 01 00 C2 43 02 00 q >downloaded _PC_ reg 0000 4204 reg 0008 : 0c62 80 5A 20 01 F2 42 00 00 C2 43 C2 43 03 00 FF 3F _SP_ _SR_ 03de 0008 0000 f48c cd9f 0069 000e 4071 0000 ffd0 2051 0e10 08ac f84e Figure 1–17.
In the HyperTerminal , type r0 to modify the program counter of the user program. The program displays the current content of r0. Next type 0240 to set the start address as defined in gs_stk1.asm. Exit the modify register mode by pressing the key. Each time the SPACE bar is pressed, the program executes one single step and the program displays the registers contents. Typing a g followed by causes the program to continue from the current address stored in the program counter.
1.2.11 How to Use Breakpoints Continue the Getting Started exercise by assembling and downloading the file gs_stk2.asm in the examples directory as described previously. This program includes a section for the reset vector, so the program counter is initialized after the download and each time a user performs a reset. ;**************************************************************************** ; Interrupt vectors ;**************************************************************************** .
Enter The g-command to start the program Press to Interrupt the program Enter the u-command to execute a user reset Enter the s-command to set a breakpoint Enter the address of the breakpoint >downloaded _PC_ _SP_ _SR_ reg 000: 0240 03de 0008 0000 f48c 0010 0000 15de reg 0008 0e62 404d 0000 ffd0 2153 0e14 28ad feff >go . .
$ML1 BIT.B JNZ 1.2.13 #01h,P0IN $ML1 ; Test P0.0 ; Do nothing if P0.0 low How to Use an Interrupt Routine Assemble and download the file gs_stk4.asm in the examples directory, as described previously. 1. When an interrupt occurs, the program sends the contents of the program counter and status register to the stack. 2. Next, the program branches to the starting address of the interrupt routine. 3. The interrupt routine normally ends with the RETI instruction. 4.
Set a breakpoint at address 025Eh, and single step through the program. A longer reaction time can be expected for any step beyond address 025Eh. At this time, the CPU is off and waiting for the Basic Timer interrupt. NOTE: Only two breakpoints may be set at any one time.
VPP -Input Apply If programming via serial port VPP fuse F250 mA Connects to programming adapter MSP-PRG430x (EVK only) Jumper for programming the EPROM of an EVK with the Monitor Figure 1–22. Programming Voltage and Jumper Location To load a program into the MSP430 EPROM/ROM using the HyperTerminal, the following points must be considered: • The Monitor code must already be programmed into the EPROM/ROM (only the EVK is supplied with the code for the monitor program mon_x.txt).
;**************************************************************************** ; Section in EPROM ;**************************************************************************** .sect “PrepLCD”, EPROM_orig ;––– Prepare LCD and Basic timer PrepLCD MOV.B #–1h,LCDM ;LCD : Analog generator on Low ; impedance 4 Mux active ; all outputs are Seg MOV.B #057h,BTCTL ; Basic Timer : SSEL=0 DIV=0 Reset=1 ; ACLK ; 32768/256 = 128 Hz ; (7.8 ms debounce time) ; LCD frame frequency @ 4 Mux: 64 Hz BIS.
MSP–STK430A320 >_ Figure 1–24. HyperTerminal Window To load a program into the MSP430 using the HyperTerminal, activate the Transfers/Send Text File. . . command as shown in Figure 1–25. Transfer Send Text File MSP–STK430A320 >_ Receive text file... View Text File... Send Binary File... Receive Binary File... Pause Resume Stop Figure 1–25. Transfers \ Send Text File Figure 1–26 shows the Send Text File dialog box.
Choose your Text File Press Open to Send TXT File Figure 1–26. Send Text File Dialog Box Figure 1–27 represents a burn fail screen. If an error occurs during the programming of the EPROM, the screen shows the message burn failed at XXXX. Where XXXX is the address where the programming cycle failed the first time.
>@C000 F2 43 30 00 F2 40 57 00 40 00 F2 D0 80 F2 C0 40 00 40 00 F2 D0 80 00 01 00 F0 01 42 B0 12 50 C0 32 D2 @C050 35 40 0F 00 C5 43 30 00 15 83 FC 23 30 @C100 D0 83 1F 41 06 20 B1 C0 10 00 00 00 F0 11 41 00 13 @03E0 40 02 00 C1 40 02 40 02 40 02 40 02 40 40 02 40 02 40 02 40 02 40 02 40 02 40 q >burn failed at c000 >downloaded _PC_ _SP_ _SR_ reg 0000 0240 03de 0008 0000 f48c c010 reg 0008 0c62 4098 0000 ffd0 2051 0e14 > 00 05 00 40 80 00 41 40 80 00 02 40 02 02 40 02 0000 0010 28ac f84e Figure 1–27.
2 Monitor Commands This chapter describes the syntax conventions and the available commands of the Monitor Program. 2.1 Syntax Conventions • • • • • • • • • • • 2.2 The numbers in brackets [ ] are optional. x is a hexadecimal address. n is the hexadecimal number of bytes to show. i is the hexadecimal register number. Only the r, m, and e commands expect or commands. The key provides a keyboard interrupt for all command inputs except m.
2.3 h Commands The h command displays the Help Command screen shown in Figure 2–2 with the available commands. Enter h at the command prompt >Monitor Commands h b,w i,w r[x] mx[n] ex n @x .. q d sx cx g >_ help byte, word mode monitor, user reset inspect registers inspect memory eprom erase check load program run DEMO set breakpoint clear breakpoint go (free run) single step exit command Figure 2–2.
b,w The b and w commands shown in Figure 2–3 switch to byte or word indication mode. The two indication modes are only important for the memory inspect command m. The Monitor completes the entered command (byte or word). Enter b at the command prompt Enter w at the command prompt >MSP–STK430A320 >byte >m0300 10 mem 0300 : 40 00 80 80 00 00 52 00 41 10 01 06 04 20 02 00 >word >m0300 10 mem 0300 : 0040 8080 0000 0052 1041 1601 2004 0002 Figure 2–3.
i The i command, shown in Figure 2–4, initializes the entire monitor program. This command performs a software reset of the STK/EVK, but is only possible if the monitor is still running. If the contents of memory location 3DEh are AA55h, the i command will start the user application. Turn off the hardware supply voltage to return control to the monitor. This clears the bit-pattern AA55h. Enter i at the command prompt >init MSP–STK430A320 Figure 2–4.
u The u command, shown in Figure 2–5, sets the user PC to the start vector of the loaded user program. This performs a user reset of the application. In this example, the start vector of the user application, located at address 03FEh, is 0300h. Enter u at the command prompt >user reset _PC_ _SP_ _SR_ reg 0000 0300 03de 0008 000u0 f48cP1c14 0069 000e reg 0008 1a28 400f 0000 ffd0 4040 6803 e2c2 07a0 > Figure 2–5.
r[i] The r command, shown in Figure 2–6, without a specific register number, shows all 16 CPU registers R0 to R15. With this syntax, a modification of the register contents is not possible. Enter r then at the command prompt >init MSP–STK430A320 >r reg 0000 : 0300 03de 0008 0000 f48c 0010 0069 000e reg 0008 : 1a28 402a 0000 ffd0 4040 6803 e2c2 07a0 > Figure 2–6.
Entering the command with the hexadecimal register number r[i] as shown in Figure 2–7, results in displaying only the contents of the dedicated register i. Type r5 at the command prompt >r5 reg 0005 : 0010 _ Figure 2–7. Register Specified Command NOTE: Modification of the Registers R1, R3, and R4 The Monitor Program does not allow the modification of registers R1, R3, and R4. R1 is the stack pointer and can not be modified because of the internal program structure of the monitor.
Figure 2–8 shows the procedure for changing data in a register. Write new data into register r[i] by pressing and the program displays the next register. Type r5 at the command prompt Type the new desired register contents and press >init MSP–STK430A320 >r5 reg 0005 : 0010 ffff reg 0006 0069 >r5 reg 0005 : 0010 ffff_ Type r5 again to view the new content of the register If it is not desired to modify additional registers press Figure 2–8.
Figure 2–9 shows the procedure to modify an additional register. Press , and the program displays the next register. Enter r to show the modified register contents Press here Modified registers r5, r6 >init MSP–STK430A320 >r5 reg reg reg >r reg reg > 0005 : 0010 aaaa 0006 0069 bbbb 0007 000e 0000 : 0300 03de 0008 0000 f48c aaaa bbbb 000e 0008 : 9a28 4092 0000 ffd0 4040 6807 e6ca 87a4 Figure 2–9.
Figure 2–10 shows the proper way to change incorrect entries. Using the Arrow, Delete or Insert keys as inputs causes unpredictable behavior. After entering an incorrect register content, the entire input should be entered again. Another method is to press and to enter the r[i] command again. NOTE: The ENTER key must never be pressed after entering an incorrect input.
mx[n] The m command allows the user to inspect (read/modify/write) memory locations. Use the m command in conjunction with the b or w commands. The b or w command displays the memory as shown in Figure 2–11.
Figure 2–12 shows how to modify memory contents. Modify the memory by typing in new data and pressing . The program displays the next memory location. If no modification is necessary press . To exit the memory command (mx) press the key. Pressing toggles through memory locations, displaying each new location after .
To revise an incorrect terminal input, perform the following functions as shown in Figure 2–13. Using the Arrow, Delete or Insert keys as inputs causes unpredictable behavior. After entering an incorrect register contents, the entire input should be entered again. Another method is to press and enter the m command again. Never type after entering an incorrect input.
@x The @x command loads program/data section(s), byte by byte, into the RAM/EPROM. A program algorithm detects the correct download section (in the RAM or EPROM) and runs automatically. The transfer can be made by using a keyboard or by file transfer (pull-down menu Transfers/Send Text File in Hyperterminal program). If download is performed manually, it can be terminated with a q keystroke. Normally the data associated with the load command is a content of linker or assembler-generated program/data files.
ex n The EPROM erase check (ex n) command verifies that the EPROM is empty. The EPROM is empty if the contents of all EPROM-memory locations are FFh. The x represents the starting address to verify that the EPROM has been erased. The n portion of this command will show the number of bytes that have been erased. The Monitor ceases checking the EPROM if a memory location other than FFh is detected and displays that memory location as shown in the Figure 2–15.
s The s command allows a breakpoint to be set. The program supports the capability of having two breakpoints. Breakpoints may be set only if the program is in RAM. Typing an s shows the breakpoints that are currently set. Figure 2–16 shows how to enter the location of the breakpoint. Set a breakpoint by Typing ‘s’ Enter the location of the breakpoint: 24e MSP–STK430A320 >Set Bkpt 0000 0000 24e Figure 2–16. Location of a Breakpoint Command Both breakpoint addresses are displayed.
The address of the two breakpoints should not be identical. Only two breakpoints are supported, a third breakpoint cannot be set. In order to set another breakpoint, one breakpoint has to be cleared first with the c command. Figure 2–17 shows the breakpoint after entry. To set a breakpoint type s Enter the location of the breakpoint: 24e >init MSP–STK430A320 >Set Bkpt 0000 0000 24e >Set Bkpt 024e 0000 Press here Figure 2–17.
c The c command is used to clear a breakpoint. Typing c shows the set breakpoints, as shown in Figure 2–18. Clear a breakpoint by typing a ‘c’ >Clr Bkpt 024e 0000 Figure 2–18. Clearing a Breakpoint Command To clear one of the breakpoints (other than zero), it is necessary to enter the associated address. Typing the key after entering the address clears the breakpoint. See Figure 2–19.
g The g command starts/restarts the user application that is loaded into RAM. The system retrieves the start vector of a user’s application from memory location (3FEh on the 320 STK/EVK, 5FEh on the 330 EVK) if a new program is loaded, or after executing a PUC command or a user reset. Otherwise, the program execution continues with the actual PC (R0). Return to the Monitor occurs after pressing any key on the keyboard.
2–20
3 Monitor Restrictions 3.1 Register R4 The Monitor Program uses the R4 register internally to return data from the user application to the Hyperterminal. Modifications to the value stored in R4 will result in unexpected behavior of the Monitor Program. The Monitor command r, to change the register contents, is not supported for R4. The register R4 can be modified by the user application code. Consequently, the user should exercise caution when using this register.
3.3 Peripheral Hardware/Registers Do not modify the following peripheral registers and bits because UART operation uses these register and bits. Table 3–1. Peripheral Registers and Bits 3.
In most cases, it is efficient to initialize the user stack which is allowed to grow (downwards) until it reaches the address 270h (26Fh–32h=23Eh). Thus, the resulting size of the maximum user stack is 16Dh (3DCh–272h=16Ah) on the MSP430x325 family and 360h (5DCh–272h = 36Ah) on the MSP430x33x family.
The user application data is located within the RAM area from 272h to 3FEh (5FEh for 33x). The locations used statically (200h to 214h) and dynamically (stack) by the Monitor Program limit the size of the available RAM. Due to limited size, two memory configurations are recommended as shown in Figure 3–3.
3.5 Writing Data Into the EPROM When data is written into the EPROM address range, software code is written into RAM locations 214h to 23Dh. All addresses 1000h or higher are assumed to be EPROM. After the write operation is completed, the code in the RAM is no longer needed. The code is written into RAM when a write into the EPROM address range is performed. Ensure that the data in these locations are not needed when the EPROM write code is temporarily loaded into those locations.
3–6
4 Treatment of Interrupts This chapter describes the special treatment of interrupts in the Monitor environment. 4.1 Use of Interrupts in the Monitor Environment The interrupt structure of the MSP430 is fully supported by the terminal program with one exception, the NMI interrupt has the same interrupt vector as the RESET interrupt. There are no restrictions on the interrupt flags, but certain restrictions apply to the interrupt vectors.
Figure 4–2 shows the handling of a P0.0 interrupt for the MSP430X32x family. For the MSP430X33x, replace address 03FAh with 05FAh. P0.0 Interrupt FFFAh XXXX XXXX BR & 03FAh 03FAh YYYY YYYY YYYY Is The Start Address Of The Interrupt Service Routine Figure 4–2. P0.0 Interrupt Example The number of cycles an interrupt is additionally delayed in the Monitor Program depends on the type of interrupt received. Table 4–1.
Table 4–2. Interrupt Vectors for the MSP430x32x Family INTERRUPT FLAG INTERRUPT SOURCE SYSTEM INTERRUPT WORD ADDRESS PRIORITY Reset 3FEh 15, highest NMI Oscillator fault RSTI†, WDI† NMIIFG† OFIFG† Nonmaskable Nonmaskable 3FCh 14 Dedicated I/O P0.0IFG Maskable 3FAh 13 Dedicated I/O P0.
4–4
5 Half Duplex Monitor Software UART The Monitor Program provides several functions for handling serial data communications using the RS-232 interface. The user can call these functions by using the associated vectors in the terminal program. Use the absolute address mode to call these functions. For example, a possible syntax for preparing the half duplex software UART to receive characters is: CALL &0FFD6h ;in address FFD6h the vector of RX_Prep is stored another possible syntax is: RX_Prep .
The flow chart in Figure 5–1 I illustrates the entry point of the INT_RXTX interrupt service routine: INT_P0.1 Identification ? Contents Of Memory Location 3DEh = AA55h no yes P0.
NOTE: Init Command Do not use the Monitor init command out of the terminal emulator while the bit pattern AA55h is stored in memory location 3DEh on the MSP430X32x, or 5DEh on the MSP430X33x family. Otherwise, the user application with the reset vector stored at 3FEh (5FEh for the MSP430X33x family) will be started. To use the INT_RXTX interrupt service routine, first load the P0.1 interrupt-vector, which is responsible for the timer interrupt used in the software UART. The P0.
5.3 Special Treatment of in the Software UART The software UART treats a received ESC character in two different ways: • The software UART receives the ESC character and stores it at address 210h. The condition, therefore, is that bit 0 in memory location 200h is reset. • The software UART receives the ESC and returns back to the Hyperterminal. The condition is that bit 0 in memory location 200h be set.
5.4 Transmitting One Character To transmit one character, copy AA55h to memory location 3DEh, or memory location 5DEh for the MSP430X33x family. Store the character to transmit in RAM-location 020Eh. TX: MOV MOV.B #0AA55h,&03DEh #‘a’,&TX_Data ; &05DEh for MSP430X33x ; put char to TX_Data Call the function TX_Char to transmit the character stored at location 20Eh.
The following code in Figure 5–3 is an example of transmission of the single character s. WDTCTL WDTHold WDT_wrkey TXCHAR TXTABLE PREPRX PREPTX INT_RXTX TXDATA RXBUF RESET: TX: ; ENDL: UART: .equ .equ .equ .equ .equ .equ .equ .equ .equ .equ 0120h 80h 05a00h 0FFD2h 0FFD4h 0FFD6h 0FFD8h 0FFDAh 020Eh 0210h .
In Figure 5–3, the endless loop at the end of the program can be interrupted by pressing in the HyperTerminal. If no special treatment of is required in the software UART, bit 0 in RAM location 200h must be cleared. This bit is the ESC-active-flag and allows itself to return back to the Hyperterminal when pressing the ESC key. Conditions for implementation: • Correct setting of the P0.
MOV ENDL UART 5.6 JMP BR .sect .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .
WAIT TX ; UART TST.B JEQ MOV.B CLR.B BIC &RXBUF WAIT &RXBUF,&TXDATA &RXBUF #01h,&200h CALL &TXCHAR CALL &PREPRX JMP BR .sect .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .end WAIT &INT_RXTX “Int_Vect”,03E0h RESET RESET RESET RESET RESET RESET RESET RESET RESET RESET RESET RESET UART RESET RESET RESET ; ; ; ; ; receive to get back to monitor with ESC char.
RX: WAIT: TX: ; ENDL; UART: 5–10 EINT CALL MOV MOV MOV.B CMP.B JEQ CLR.B CMP.B &PREPRX #0AA55h,&03DEh #STRING,R7 #RXBUF,R6 #0h,r6 WAIT &RXBUF #cr,R6 JEQ MOV.B INC CMP TX R6,0(R7) R7 #064h,R7 JL MOV MOV BIC WAIT #STRING,R11 #0h,1(R7) #01h,&200h CALL CALL MOV JMP BR .sect .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .word .
6 Using Interrupt Vectors in the EPROM This chapter describes how to use interrupt vectors stored in the EPROM. The interrupt vectors are stored in EPROM so they are not lost when power is removed. 6.1 The Identification Bit Pattern After a Reset The reset start-up sequence checks the contents of memory location E9DEh to see if its contents are equal to AA55h.
Reset Set Location of Identification Address Pointer to E9DEh Decrement Identification Address Pointer By 22h Identification ? Contents of Identification Address = 0000h no yes Identification ? Contents of Identification Address = AA55h Copy EPROM Interrupt Vectors And Identification AA55h To RAM Interrupt Vectors Jump To New Reset Vector Address In RAM Start Monitor yes Emergency Return To Monitor ? (Optional – User Defined yes: BR Ret_Mon) Figure 6–1.
The following example demonstrates how to implement and test the emergency come-back to the monitor routine: 1. Set the variable DVLP to 0 after the routine has been successfully tested in RAM. The variable TRIAL indicates the number of interrupt tables that have been burned. The last necessary input is the start address BEGIN. 2. Insert the address where the program is stored. To find a free section in EPROM, use the m or the e command. 3.
.word start ;––– additionally define reset vector in EPROM if final version .if DVLP = 0 .sect “EPRM_RES”, 0E9FEh–((TRIAL–1)*22h) .word start ; write identification to EPROM if final version. This MUSt be the LAST section ! .sect “IDENT”, 0E9DEh–((TRIAL–1)*22h) .word 0AA55h .endif NOTE: Identification Pattern AA55h Program the identification pattern as the last word of the download. To assure this, the section containing the identification should be the last section in the source file.
7 Memory Configurations for MSP430 Devices The MSP430 is well suited for the development cycle. The Monitor Program provides the commands s and c to set and clear breakpoints, and SPACE to perform a single step execution in the RAM area for these devices.
Address RAM Address 3FEh RESET FFFEh User Interrupt Vectors EPROM MONITOR User RAM 3E0h 3DEh Ident. (AA55h) 3DCh EA00h E9FEh User Program, Data and Stack 23Eh 23Dh 214h 212h User Interrupt Vectors E9E0h E9DEh Temporary EPROM Programming Routine† RESET Ident. (AA55h) E9DCh User Program (– 11K) Reserved For Monitor C000h 200h MSP430P325 in MSP–STK430x320 MSP430E325 in MSP–EVK430x320 Figure 7–2.
Address RAM Address 5FEh RESET FFFEh User Interrupt Vectors EPROM MONITOR User RAM 5E0h 5DEh Ident. (AA55h) 5DCh EA00h E9FEh User Program, Data and Stack 23Eh 23Dh 214h 212h User Interrupt Vectors E9E0h E9DEh Temporary EPROM Programming Routine† RESET Ident. (AA55h) E9DCh User Program (– 28K) Reserved For Monitor 8000h 200h MSP430P325 MSP–EVK430x320 MSP430E337 MSP–EVK430x330 Figure 7–3.
7–4
Appendix A Difference Between STK and EVK STK EVK Initialization banner MSP-STK430x320 MSP-EVK430x320/MSP-EVK430x330 Device One mounted OTP device MSP430P325IPM Two windowed unbearable devices PMS430E325FZ or PMS430E337HFD Monitor Programmed Programmed in only one device. After erasing the device, the monitor program (mon_140.txt for the MSP–EVK430x320, and mon_160.txt for the MSP–EVK430x330) in the STK directory must be programmed again. See Programming Adapter Manual.
A–2