SlideShare a Scribd company logo
1 of 245
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
i
Table of Contents
Chapter 1 ADS integrated development the environment and EasyJTAG emulator application
...................................... ......... 2
The 1.1 ADS 1.2 integrated development environment composed ..........................................
...................................... 2
1.1.1 CodeWarrior IDE Introduction ............................................ ......................................... 2
1.1.2 AXD debugger Introduction ........................................... .................................................. 3
1.2 Project Editing .............................................. .................................................. ............... 4
1.2.1 to establish engineering ............................................. .................................................. ............ 4
1.2.2 to establish file ............................................. .................................................. ............ 5
1.2.3 Add file to the project ........................................... .................................................. .. 5
The 1.2.4 compiler connect engineering ............................................ .................................................. ..... 6
1.2.5 Open the old project ............................................ .................................................. ......... 8
1.3 Project Debugging .............................................. .................................................. ............... 9
1.3.1 Select the debug target ............................................ .................................................. ..... 9
1.3.2 debugging tool bar ............................................ .................................................. ......... 9
1.4 LPC2200-series ARM7 microcontroller template ......................................... .................. 10
The 1.4.1 for ADS1.2 increase of the LPC2200 dedicated engineering template ......................................
............... 11
1.4.2 use the LPC2200 dedicated engineering template to establish engineering ........................................
................ 11
1.4.3 template Scope ............................................ .................................................. ... 13
Of 1.5 EasyJTAG emulator installed application .......................................... ................................. 16
To 1.5.1 installed EasyJTAG emulator ........................................... ....................................... 17
1.5.2 use EasyJTAG emulator ........................................... ....................................... 17
1.6 curing procedures ............................................... .................................................. ................ 19
1.6.1 chip FLASH curing .......................................... ............................................ 19
1.6.2 chip FLASH curing .......................................... ............................................ 23
Chapter 2, the basis of experimental ............................................. .................................................. .........
26
2.1 external interrupt Experiment 2 ............................................. .................................................. ....... 26
2.2 External Memory Interface Experiment 2 ............................................ .............................................. 28
Experiment 2 ............................................. 2.3 Timer .................................................. ........... 32
2.4 UART Experiment 2 .............................................. .................................................. .......... 35
2.5 I2C Interface Experiment 2 ............................................. .................................................. ........ 40
2.6 SPI Interface experimental (elected to do) .......................................... ................................................
44
2.7 RTC Experiment 2 .............................................. .................................................. ............. 47
2.8 low-power experiment 2 ............................................ .................................................. ............ 51
Chapter 3 μC / OS-II-based basic experiment ...................................... .................................... 55
3.1 SPI bus LED control applications ........................................... ......................................... 55
3.2 I2C bus EEPROM applications ............................................ ........................................ 58
The of 3.3 I2C bus ZLG7290 application ............................................ ......................................... 62
3.4 LPC2000 series microcontroller the MODEM interface package ........................................ ........... 65
3.4.1 Overview .............................................. .................................................. ................. 65
3.4.2 packages use ........................................... .................................................. .... 66
3.4.3 Design principle ............................................. .................................................. .......... 69
Chapter 4 ZLG / SD package user manual ........................................ ..................................... 78
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
ii
4.1 SD / MMC Card external physical interface ......................................... ....................................... 78
4.1.1 SD mode ............................................. .................................................. ............ 79
4.1.2 SPI mode ............................................. .................................................. ........... 80
4.2 SD / MMC card SPI mode hardware circuit design ...................................... ................. 81
4.2.1 SPI bus ............................................. .................................................. ........... 82
4.2.2 card power supply control ........................................... .................................................. ........ 82
4.2.3 card detection circuit ............................................ .................................................. ....... 82
4.3 ZLG / SD package file structure and the overall framework ...................................... ........................ 82
4.3.1 ZLG / SD package file composed ....................................... ................................... 82
4.3.2 ZLG / SD package overall framework ........................................ ...................................... 83
4.4 ZLG / SD package instructions ......................................... ......................................... 83
4.4.1 ZLG / SD package of hardware configuration ....................................... ................................... 83
4.4.2 ZLG / SD package provides API functions ...................................... ........................... 87
Chapter 5 ISP1161A1 and ISP1181B Introduction and hardware circuit design ....................................... ...
90
5.1 ISP1161A1 Introduction and hardware circuit design ........................................... ..............................
90
5.1.1 ISP1161A1 Pin Description ........................................... .......................................... 91
5.1.2 ISP1161A1 the LPC2200 hardware circuit design ........................................ ............ 93
Design of About 5.2 ISP1181B hardware circuit ........................................... ................................. 94
5.2.1 ISP1181B Pin Description ........................................... ............................................ 95
5.2.2 ISP1181B the LPC2200 hardware circuit design ........................................ .............. 98
5.2.3 ISP1181B PACK Introduction ............................................ ........................................ 99
Chapter 6 ZLG/USBD13 package .......................................... ....................................... 101
6.1 ZLG/USBD13 package structure ........................................... ....................................... 101
Of 6.2 ZLG/USBD13 package to use ......................................... ............................. 101
The package 6.2.1 ZLG/USBD13 hardware configuration methods ...................................... ................ 102
6.2.2 package configuration .......................................... ............................................. 105
6.3 ZLG/USBD13 package API function .......................................... ................................ 107
A 6.4 EasyUSBD13.dll dynamic library ............................................ .......................................... 110
Chapter 7 the ZLG driven middleware for use ......................................... ................................ 111
1.1 ZLG / CF-driven middleware ........................................... ................................................. 111
1.1.1 Overview .............................................. .................................................. ............... 111
1.1.2 ZLG / CF-driven structure view ........................................ .................................... 111
1.1.3 middleware configuration options .......................................... ................................................. 112
1.1.4 API function manual ............................................ .................................................. .113
Chapter 8, to read and write the U disk module driven use ....................................... ..................................
120
8.1 read U disk module Introduction ........................................... .................................................. .120
8.2 firmware drivers instructions .............................................. .................................................. ....... 120
8.2.1 initialization configuration ........................................... .................................................. ...... 120
8.2.2 User-written interface functions .......................................... ......................................... 121
8.2.3 API function ............................................. .................................................. ........ 124
Chapter 9 the MiniGUI graphical interface experiment ........................................... ...................................
127
9.1 MiniGUI for uC / OS-II transplantation experiments ........................................ .................................
127
9.2 MiniGUI message processing experiment ............................................. .......................................... 147
9.3 dialog box application programming experiment ............................................
............................................... 153
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
iii
9.4 control application programming experiment .............................................
.................................................. 162
9.5 custom control experiment ............................................. .................................................. .... 170
The 9.6 VerySimpleEditor experiment ............................................. .................................................. ....
175
Figure 9.7 display experiments ............................................. .................................................. ........ 181
9.8 GDI drawing experiment .............................................. .................................................. ....... 186
9.9 desktop themes experiment .............................................. .................................................. ....... 191
The Chapter 10 μCLinux development platform building ........................................... .................................
202
10.1 host and target machines ............................................ .................................................. ..... 202
10.2 to establish a cross-development environment .............................................
.................................................. 202
10.2.1 establish a development environment ............................................ ..................................................
.202
10.2.2 Installation μCLinux ............................................. .................................................. .203
10.2.3 configuration μCLinux ............................................. .................................................. .203
10.3 download μCLinux kernel to the development board ...........................................
.................................... 206
10.3.1 file structure ............................................. .................................................. ........ 206
10.3.2 Download ZLG_BOOT ............................................. ............................................ 208
The 10.3.3 download μCLinux kernel and file system ......................................... .......................... 213
10.4 start μCLinux ............................................... .................................................. ....... 221
10.4.1 through HyperTerminal under Widows ........................................ ........................ 221
10.4.2 via Minicom under Linux ......................................... .......................... 223
10.5 NFS settings ............................................... .................................................. ............. 224
10.6 GDB debugging ............................................... .................................................. ............ 228
Chapter 11 is based on μCLinux basic experiment ........................................... ................................. 229
11.1 CAT1025 read and write experimental ............................................. .................................................
229
11.2 task timer .............................................. .................................................. ........... 231
11.3 semaphore timer ........................................... ................................................ 234
Over 11.4 process experimental .............................................. .................................................. ........... 236
11.5 WebServer experiment ............................................... .................................................. ... 239
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
1
μC / OS-II papers
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
2
Chapter 1 ADS integrated development the environment and EasyJTAG emulator application
ADS integrated development environment for ARM core microcontrollers ARM has introduced an
integrated development tool, called the English
ARM Developer Suite, mature version ADS1.2. ADS1.2 support the ARM10 before all ARM series of
micro-
Controller, support for software debugging and the JTAG hardware simulation debugging support
Assembler, C, C + + source with compiler efficiency
High, the system library function, Windows98, Windows XP, Windows 2000 and RedHat Linux
Run.
Here brief ADS1.2 to establish engineering compilation connection settings, debugging operations.
Finally introduced
Based on the use of the LPC2200 series ARM7 microcontroller project templates, EasyJTAG emulator to
install and use.
The 1.1 ADS 1.2 integrated development environment composed
ADS 1.2 consists of six sections, as shown in Table 1.1.
Table 1.1 ADS 1.2 part
Name Description use
Code generation tools
ARM assembler
The ARM C and C + + compiler,
The Thumb of C, C + + compiler,
ARM connector
Call by the CodeWarrior IDE
Integrated development environment the CodeWarrior IDE engineering management, compiled
connection
Debugger
AXD,
ADW / ADU,
armsd
Simulation debugging
Instruction simulator ARMulator by the AXD call
ARM development package some of the underlying routines
Utility (such as fromELF)
Some utility by CodeWarrior
IDE call
ARM Applications Library C, C + + libraries and other user programs use
Because users typically direct manipulation is the the CodeWarrior IDE integrated development
environment and AXD debugger, so this
Chapter describes the use of the two parts of the software, a detailed description of the rest of
Reference ADS 1.2 online help documentation or phase
Relevant information.
1.1.1 CodeWarrior IDE Introduction
The ADS 1.2 the CodeWarrior IDE integrated development environment, and integrate the ARM
assembler, ARM C / C + +
Compiler Thumb C / C + + compiler, ARM connectors include project management, code generation
interface, syntax-sensitive
Sense (keyword displayed in different colors) editor, source files and class browser and so on.
CodeWarrior IDE main window shown in Figure
1.1 shows.
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
3
Figure 1.1 CodeWarrior development environment
1.1.2 AXD debugger Profile
AXD debugger for ARM Extended Debugger (ARM eXtended Debugger), including all ADW / ADU
Features, support for hardware emulation and software simulation (The ARMulator). The AXD image file
can be loaded into the target memory, with a single
Step, full-speed and breakpoint debugging features, variables, registers, and memory data, can be
observed. The AXD debugger main window
Port is shown in Figure 1.2.
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
4
Figure 1.2 AXD debugger
1.2 Project editor
1.2.1 Establishing the works
WINDOWS operating system, click the [Start] -> [Programs] -> [ARM Developer Suite v1.2] ->
[CodeWarrior for ARM Developer Suite] starting Metrowerks CodeWarrior, or the double-"CodeWarrior
for ARM Developer Suite "shortcut starter start ADS1.2 IDE as shown in Figure 1.3.
Figure 1.3 start ADS1.2 IDE
Click the [File] menu, select [New ...] pop-up New dialog box, shown in Figure 1.4.
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
5
Figure 1.4 New dialog
Select the project template for ARM executable image (ARM Executable Image) or Thumb executable
mappings
(Thumb Executable Image), or the Thumb, ARM intertwined image (Thumb ARM Interworking Image),
Storage path and in [Location options works, and in the [Project name] entry input project name, click
[indeed
Given] button to create the corresponding engineering project file name suffix for mcp (hereinafter
sometimes project called Project).
1.2.2 create documents
Create a text file, in order to enter the user program. Click "New Text File" icon button, shown in Figure
1.5
Shows.
Figure 1.5 "New Text File" icon button
New file program, click on the "Save" icon button to save files (or from the [File] menu options
Choose [Save]), the full name of the input file, such as TEST1.S. Note that, save the file to the
corresponding directory of the project,
Easy to manage and find.
Of course, you can also New dialog box, select [File] page to create a source file, as shown in Figure 1.4,
or use other
A text editor to create or edit the source files.
1.2.3 add files to the project
In the project window, shown in Figure 1.6 [Files] page blank space right click pop-up floating menu,
select "Add
Files ... "to pop up the" Select files to add ... "dialog box, select the corresponding source file (subject
Ctrl key election
Optional multiple files), click [open] button.
Project templates
Engineering the storage path
Project Name
New Text File
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
6
In addition, users can select the [Project] menu [Add Files ...] to add the source files, or use the New
Source file to create the dialog box, select [File] page, select the project (ie select "Add to Project"). Add
text
The parts operation shown in Figure 1.6, as shown in Figure 1.7.
Figure 1.6 add the source files in the project window
Figure 1.7 Select files to add ... dialog box
The 1.2.4 compiled connected engineering
Figure 1.8 shows the icon button in the project window, through these icon buttons, you can quickly
project set
Set, compiled connection start debugging (on a different menu items can find the corresponding menu
command). They left to
To the right, respectively, as follows:
DebugRel Settings ... project settings, such as the address set the output file settings, such as compiler
options,
In which DebugRel for the current generation target (target system).
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
7
Synchronize Modification Dates sync each file modification date, modified date, check the project if
Updates (such as the use of other editor to edit the source files), in
Touch column marked "√".
Make compile connection (shortcut key F7).
Debug start AXD debugging (shortcut key F5).
Run start AXD debug, and run the program directly.
The Project Inspector engineering checks, view and configure the project source file.
Figure 1.8 project window icon button
Figure 1.9 DebugRel Settings window
Icon click "DebugRel Settings ..." button, you can project address set the output file settings, compiled
Translation options, and so on, as shown in Figure 1.9. "ARM Linker" dialog box to set the connection
address, "Language Settings"
Set compiler compiler option.
View simple software debugging connection address settings can not click directly on the project
window "Make".
Standard button to complete the compilation connection. If compile error, there will be a corresponding
error message, double-click the error prompt line information
Editing window that uses the cursor pointed out this error source lines of code, compiled connected to
the output window in Figure 1.10 below. Similarly,
You can find the appropriate command in the [Project] menu.
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
8
The Figure 1.10 compiled connect output window
As shown in Figure 1.11, Touch the bar to mark the file is compiled, if the "√" indicates that the
corresponding file required
To recompile. Touch bar for tag files are compiled, if the "√" indicates that the corresponding files need
to be renumbered
Translation. / Cancel symbol "√" can be set by clicking on the column position or project directory *. Tdt
file deletion
The entire project source files are marked with a "√".
The Make operation in Figure 1.11 Project window
1.2.5 Open the old project
Click [File] menu, select Open ...] that pop up the "Open" dialog box, find the corresponding project file
(*. Mcp)
Touch bar
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
9
Click [Open]. Double-click the source file name to open the file in the project window [Files] page
Edited.
The 1.3 engineering of debugging
1.3.1 Select the debug target
Figure 1.12 Choose Target window
When engineering compiled connected by click "Debug" icon button in the project window, you can
start AXD
Debug (You can also start] menu starting AXD). Click on the menu [Options] select [the Configure Target
...]
That pop up the Choose Target window, shown in Figure 1.12. Add other emulation driver, Target in
Only two were ADP (JTAG hardware simulation) and ARMUL (software emulation).
Select emulation driver, click [File] Select [Load Image ...] the loaded ELF format executable
Pieces, ie *. Axf file. Description: When engineering compiled connected by the project name  project
name _Data  current generated mesh
Standard "directory will generate a *. Axf debug files such as engineering the TEST, the current
generation of target Debug compile even
After connected, in ...  the TEST  TEST_Data  Debug directory generate TEST.axf file.
1.3.2 debug toolbar
AXD run debug toolbar as shown in Figure 1.13, Figure 1.14 debug observation window toolbar, file
operatives
Toolbar shown in Figure 1.15.
Figure 1.13 run debug toolbar
Running at full speed (Go)
Stop running (Stop)
Single-step operation (Step In), the Step command that the function call statement, will enter the Step
In command
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
10
The function.
Single-step operation (Step), each execution of a statement, then the function call will perform as a
statement.
Single-step operation (Step Out), performing this function is called, to stop the next statement in the
function call.
Run to Cursor (Run To Cursor), stop the run the program until the current cursor row.
Set breakpoints (Toggle BreakPoint)
Figure 1.14 debug observation window toolbar
Open the register window (Processor Registers)
The open observation window (Processor Watch)
Open the variable observation window (Context Variable)
To open memory observation window (Memory)
Open the disassembly window (Disassembly)
Figure 1.15 file operations toolbar
To load debug files (Load Image)
Reload the file (Reload Current Image). AXD not reset command, it is usually to use
Reload achieve reset (directly change the PC register zero can achieve reset).
1.4 LPC2200 series ARM7 microcontroller project template
Section 1.2 describes the newly created engineering, we have contacted several standard project
template provided ADS1.2 so
Various templates created works, they all have different set of convenient to generate the different
structure of the code, such as ARM
Executable image (generation ARM instruction code) or Thumb executable image (generated the Thumb
instruction code), or
Thumb, ARM interwoven image (generated Thumb and ARM instruction interwoven code).
For LPC2200 series ARM7 micro-controller, we define six project templates, these templates are
generally contained
Setup information FLASH start address 0x00000000, the on-chip RAM starting address 0x40000000, off-
chip RAM since
Start address 0x80000000, compile connectivity options and compiler optimization level, and so on;
template contains the LPC2200 series
The ARM7 microcontroller starter file, including STARTUP.S TARGET.C; template also includes LPC2200
series
ARM7 microcontroller header file (such as: LPC2294.h LPC2294.inc, LPC2294 register is downward
compatible)
Scatter-loading description file (such as: mem_a.scf mem_b.scf mem_c.scf) and so on.
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
11
The 1.4.1 for ADS1.2 increase the LPC2200 dedicated engineering template
"Lpc2200 project module" directory of all files and directories are copied to, "<ADS1.2 install directory
>  Stationery  "to the operation shown in Figure 1.16 and Figure 1.17. This step only once, after you
can directly make
Project template.
Figure 1.16 Select copy files and directories
Figure 1.17 Copy files directory
1.4.2 use the LPC2200 dedicated engineering template to establish engineering
Start ADS1.2 IDE, click [File] menu, select New ...] that is the pop-up New dialog box, shown in Figure
1.18
Shown. Prior increase LPC2200 dedicated engineering template, so more several engineering template
selected in the project template column
Entry.
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
12
Figure 1.18 increase in the project templates
LPC2200 special project templates are described as follows:
ARM Executable Image for lpc2200: no operating system, all the C code is compiled into the ARM
instruction
Project template.
asm for lpc2200: the assembler project templates.
Thumb ARM Interworking Image for lpc2200: operating system, some C code compiled for ARM
Instruction, part of the C code is compiled for the the Thumb instruction of project templates.
Thumb Executable Image for lpc2200: No operating system all C compiled into the Thumb instruction
work
The process template.
ARM Executable Image for UCOSII (for lpc2200): all the C code compiled for ARM instruction
μC / OS-II project template
Thumb Executable Image for UCOSII (for lpc2200): part of the C code is compiled into the ARM
instruction
Part of the C code is compiled for Thumb instruction μC / OS-II project template (use the μC / OS-II, it is
not possible to all code
Compiled into the Thumb instruction).
The user to select the appropriate project templates create works, as shown in Figure 1.19 to use the
ARM Executable Image for
lpc2200 project template to build a project. Works four generate the target (target system):
DebugInExram
The DebugInChipFlash, RelInChip RelOutChip, their configuration is shown in Table 1.2. Project
templates will phase
Should the compiler parameters set up, you can use directly.
Note: the LPC2200 chip selection RelInChip goals encryption (no chip chip FLASH
Not encrypted). The encryption chip can only use the ISP chip global erase in order to restore the JTAG
debug and ISP read /
Write operations.
Table 1.2 LPC2200 special project templates each generated target configuration
Generate the target scatter-loading description file to debug entry point address C optimization level
application notes
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
13
DebugInExram mem_b.scf 0x80000000 Most RAM chip debug mode, the program
In the off-chip RAM
DebugInChipFlash mem_c.scf 0x00000000 Most chip FLASH debug mode, Cheng
Sequence in FLASH chip
FLASH work mode the RelInChip mem_c.scf 0x00000000 Most chip, Cheng
The sequence in the chip FLASH. Program
Write chip after chip will be protected
RelOutChip mem_a.scf 0x80000000 Most chip FLASH mode, Cheng
The FLASH sequence chip
Figure 1.19 with LPC2200 dedicated project templates to establish engineering
1.4.3 template Scope
(1) The template assumes that the user system using off-chip memory. If the user does not use off-chip
memory, you can use
LPC2100 project templates, download address for
http://www.zlgmcu.com/tools/kaifaban/EasyARM2100.asp
Of the EasyARM2100 Development Kit QuickStart and LPC210 ....
(2) The template assumes that the user system off-chip memory using a 16-bit bus, and does not use the
ETM function. If the user's
Chip memory instead of using the 16-bit bus, and / or use of ETM function, need to modify Startup.s this
file repair
Change point to see the list of procedures 1.1. Please refer to the user manual of LPC2200 chip how to
modify the download address:
http://www.zlgmcu.com/philips/philips-arm.asp.
Note: the various engineering template Startup.s not exactly the same, may need to modify.
Program the list 1.1 Startup.s file need to change code
......
ResetInit
; The initialization external bus controller, configured according to the target board decided
LDR R0, = PINSEL2
IF: DEF: EN_CRP
LDR R1, = 0x0f814910
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
14
; 0x0f814910 changed to a desired value, note that the minimum 4 0
ELSE
LDR R1, = 0x0f814914
; 0x0f814914 changed to a desired value, if you use ETM last 4 need to be modified to 6
ENDIF
STR R1, [R0]
LDR R0, = BCFG0
LDR R1, = 0x1000ffef
; 0x1000ffef changed values
STR R1, [R0]
LDR R0, = BCFG1
LDR R1, = 0x1000ffef
; 0x1000ffef changed values
STR R1, [R0]
......
(3) to generate goals DebugInExRam. Suppose the user systems chip debugging the RAM usage bank0 (ie
origin
Address is 0x8000 0000), this one can not be modified. If the user is not the case, you can not use
DebugInExRam
This generated a target debugger.
(4) to generate goals DebugInExRam. Assuming the user system in debug chip RAM size is 512K bytes,
this
Article affects only generate the target DebugInExRam. If not, you will need to modify mem_b.scf this
file, modify
Point to see the list of procedures 1.2.
Note: to the Windows hides the extension of this file only appears as mem_b.
Program Listing 1.2 mem_b.scf file need to modify the code
......
ERAM 0x80040000
/ * Be modified according to the actual situation from the beginning of the address stored program can
read and write variables * /
{
* (+ RW, + ZI)
}
......
HEAP_BOTTOM 0x80080000 UNINIT
/ * This address is the end of the address of the RAM chip, according to the practical situation * /
{
Startup.o (HeapTop)
}
(5) to generate the target RelOutChip. The hypothetical user system using an external start, the starting
address will chip FLASH
For 0x8000 0000 (LPC2200 chip requirements), off-chip RAM usage Bank1 (starting address 0x8100
0000). Do not use if there is no off-chip FLASH RelOutChip the generated target. If the off-chip RAM
starting
The address is not is 0x8100 0000, you will need to modify mem_a.scf file, modify the point shown in
Listing 1.3.
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
15
Note: to the Windows hides the extension of this file only displayed for mem_a.
Program Listing 1.3 mem_a.scf file need modify the code - chip RAM
......
ERAM 0x81000000
/ * From the beginning of the address stored program can read and write variables, changed to the
actual start of the off-chip RAM address * /
{
* (+ RW, + ZI)
}
......
HEAP_BOTTOM 0x81080000 UNINIT
/ * This address is the end of the address of the RAM chip, according to the practical situation * /
{
Startup.o (HeapTop)
}
(6) to generate goals DebugInChipFlash and RelInChip. A hypothetical user system chip RAM usage
Bank0 (ie
Start address 0x8000 0000). Chip RAM starting address 0x8000 0000, you need to modify mem_c.scf
File, modify the point shown in Listing 1.4.
Program Listing 1.4 mem_c.scf file need modify the code - chip RAM
......
ERAM 0x80000000
/ * From the beginning of the address stored program can read and write variables, changed to the
actual start of the off-chip RAM address * /
{
* (+ RW, + ZI)
}
......
HEAP_BOTTOM 0x80080000 UNINIT
/ * This address is the end of the address of the RAM chip, according to the practical situation * /
{
Startup.o (HeapTop)
}
Note: Users can also modify several files mem_a.scf, mem_b.scf, mem_c.scf memory
For more control.
(7) in order to adapt to the different speed of the memory, the engineering template default
configuration 4 Bank the memory interface slowest visit
Q speed. The user can be re-configured according to the actual use of the memory access speed, in
order to obtain the best system performance, the reference
Program list 1.5.
Program list configuration memory interface 1.5 target.c file access speed
void TargetResetInit (void)
{
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
16
# Ifdef __ DEBUG
MEMMAP = 0x3; / / remap
/ * Bank0 reconfigure the access speed * /
BCFG0 = 0x10000400;
# Endif
# Ifdef __ OUT_CHIP
MEMMAP = 0x3; / / remap
/ * Bank0 reconfigure the access speed * /
BCFG0 = 0x10000400;
# Endif
# Ifdef __ IN_CHIP
MEMMAP = 0x1; / / remap
/ * Bank0 reconfigure the access speed * /
BCFG0 = 0x10000400;
# Endif
......
}
Note: Users can also modify target.c TargetResetInit () function before entering the main function to
initialize
More things (using assembler template other than construction).
The 1.5 EasyJTAG emulator installation and application
The EasyJTAG emulator is Luminary Micro Development Co., Ltd. developed the LPC2000 family of
ARM7 micro-controller
Made a JTAG emulator, to support ADS1.2 integrated development environment, supports single-step,
full-speed and breakpoint debugging features, support
Holding download the program to the chip FLASH and specific types of off-chip FLASH, using ARM's
standard 20-pin JTAG
Simulation debugging interface. Its main features are as follows:
� the RDI communication interface, seamless to scarfing ADS1.2 and RDI interface IDE debugging
environment.
� up to 1M rate JTAG clock drive.
� sync Flash refresh technology (synFLASH), synchronization download user code into Flash, and that
under that tune.
� using the synchronous timing control technology (synTIME), simulation is reliable and stable.
� support 32-bit ARM instruction / 16 THUMB instruction mixed debugging.
� increase mapped register window, user-friendly view / modify the register values.
� micro-volume design, user-friendly flexibility.
EasyJTAG emulator appearance Figure 1.20, its driver in http://www.zlgmcu.com/tools/kaifa
ban/EasyARM2200.asp Web download or on the product CD (the directory named EasyJTAG_drive
A readme.txt file in the directory noted).
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
17
The Figure 1.20 EasyJTAG emulators physical appearance
To 1.5.1 installed EasyJTAG emulator
First of all, the driver of the EasyJTAG emulator (like product CD EasyJTAG_drive directory all files
Pieces) to the ADS BIN directory, such as C:  Program Files  ARM  ADSv1_2  BIN.
Then, the EasyJTAG emulator's 25-pin interface connected via a parallel port extension cord with the
parallel port of a PC,
EasyJTAG emulator, 20-pin interface connection cable 20 PIN received SmartARM2200 development
board J2 on
Matching transformer (9V) power supply to the development board.
Then enter AXD debug environment, open the [Options] -> [Configure Target ...] to pop up the Choose
Target
Window, shown in Figure 1.12. Click "ADD" to add the emulator driver in the Add File window choose,
such as C:  Program
Files  ARM  ADSv1_2  BIN directory EasyJTAG.dll, click "Open".
Description: Windows system, click [start] -> [Programs] -> [ARM Developer Suite v1.2] ->
【The AXD Debugger】 can run AXD software directly.
Note: Add Files window displays DLL file, set the the WINDOWS file browser window "file
Folder Options (O) ... "," hidden files "View page items using the" Show All Files ".
The 1.5.2 use EasyJTAG emulator
Computer parallel port with EasyJTAG of emulator connection and emulator JTAG port connector into
SmartARM2200
Development board J2 AXD software is set to simulation debugging.
1 emulator settings
AXD debugging environment, open the [Options] -> [Configure Target ...] Choose Target window pops
up,
"Target Environments" box, select "EasyJTAG ..." item.
Click the "Configure" button, enter "EasyJTAG Setup" settings window, as shown in Figure 1.21.
"ARMcore"
Select the CPU type, select the "Options" item Halt program. Then click "OK", and then click on the "OK"
The connection (development board) operation will be carried out at this time EasyJTAG. If the
connection is successful, the development board LPC2210 chip
EasyJTAG control, the previously running program is stopped.
Note: Sometimes, AXD will pop up an error dialog box as shown in Figure 1.23, or a similar dialog box
can
Click "Connect mode ...", and then select the "ATTACH ..." to determine, and then click "Restart". If
EasyJTAG
Correctly connected to the development board, AXD code window will display a blank, then you can use
[File] -> [Load Image ...]
Debug file is loaded, JTAG debug.
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
18
Figure 1.21 "EasyJTAG Setup" settings window
EasyJTAG set Option Description:
ARMcore items, select CPU model;
Tap No. Items, when the CPU for LPC2106/2105/2104, master / slave JTAG debug port, Tap1 main
Tap2 from;
Connection, hardware connection interface options;
Halt Mode, the shutdown mode selection contains Halt program (to stop CPU) and Halt and reset (reset
and then stopped
Stop CPU) two;
Aux. Option, support options, including Step In Interrupt (allows single step into the interrupt) and Erase
Flash
when need (allow EasyJTAG Erase Flash) two;
Flash Type, chip FLASH Model Select two FLASH chip, when ARMcore choose LPC2200
Series CPU this to be effective. When the program needs to be downloaded to the chip FLASH, EasyJTAG
emulator will be selected core
Model of chip erase / program.
Flash 0 Addrss, the first piece of Flash address set contains the Start Address (Flash the start address,
such as
Bank0 0x80000000) Memory Size (memory capacity when fill in the actual chip capacity, such as
The capacity of the SST39VF160 0x200000). When the program do not need to download to the chip
FLASH, or the system does not chip
When FLASH, Start Address and Memory Size is set to 0.
The Flash 1 Addrss, with Flash 0 Addrss.
2 emulator application
Press F5 or Debug icon button to ADS1.2 IDE environment directly into AXD, but sometimes appear as
Prompt shown in Figure 1.22, the processing method is to click "OK", and then click the "Load Session
window pop-up to take
Elimination. "Into AXD After, the main debug window without any code, and [File] -> [Load Image ...]
menu item without
Efficiency, the need to re-open the [Options] -> [Configure Target ...] Click the "OK", and then click [File]
Select Load Image ...] to load the debug files.
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
19
Figure 1.22 session file error
AXD debug environment, sometimes the Fatal AXD Error window pops up, as shown in Figure 1.23, then
you can
To click on the "Connect mode ...", and then select the "ATTACH ..." to determine, and then click
"Restart". Next on
Can use [File] -> [Load Image ...] loaded debug files for JTAG debugging.
Note: for some of the PC, EasyJTAG not correctly connected to the development board, always error
dialog box pops up, then can be
To check the parallel port connection is reliable, check whether the parallel port on the dongle is
connected to, or to re-development board under electric. In addition,
CMOS settings in the PC parallel port mode is set to SPP mode, set the parallel port of the resources for
the 378H to 37FH.
Figure 1.23 Fatal AXD error
Chip peripheral registers observation. To open in the System Views] -> [Debugger Internals] LPC2000
Series ARM7 microcontroller chip peripheral register window. Some registers are not allowed to deliver
the show or read operation will affect
The value of other registers, so can not be found in the on-chip peripheral register window, if you need
to observe these registers can be
Use of the the memory observation window (Memory).
JTAG download the program to the FLASH. Enter the AXD debugging environment, open the [Options] ->
[Configure
Target ...] Choose Target window pops up, click on the "Configure" button to enter the set of "EasyJTAG
Setup"
Window, select "FLASH" item "Erase Flash when need", then OK to exit. In this way, each loaded FLASH
Address debug files, erase the FLASH and download code to FLASH.
1.6 firmware
To download the program to the on-chip FLASH FLASH or external JTAG emulator debug through (ie
curing
Program), before they can run offline.
1.6.1 chip FLASH curing
Firmware for LPC2200 series ARM7 microcontroller chips to chip FLASH two parties
Style to achieve: JTAG interface to download and use ISP function download. No matter which way the
user first set compiled
Translation of the address of the link, the code address start from 0x00000000 address, such as using
LPC2200 special project templates
In to generate target selection RelInChip, scatter-loading description the file mem_c.scf such as shown in
the program listing 1.6.
, ROM_LOAD loading area behind 0x00000000 the address of the start of the loading area (DPS
Put the starting address of the program code), can also be added later in the size of its space, such as
"ROM_LOAD 0x00000000
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
20
0x20000 "loading area starting address 0x00000000, size is 128K bytes; ROM_EXEC describe the
execution
Line of the address, location defined on the first piece, the starting address of the starting address space
size and loading area space
Consistent. Placed from the start address to the scale (ie Startup.o (vectors + First) where Startup.o for
Startup.s
Target file), and then place the other code (* (+ RO)); the variable area IRAM starting address
0x40000000 placed
The starting address of the variable area ERAM Startup.o (MyStacks); 0x80000000, placed outside in
addition Startup.o file
Other variables of the file (ie * (+ RW, + ZI)); close to the the ERAM variable area system heap space
(HEAP) is placed
Described as Startup.o (Heap); stack area the STACKS using the on-chip RAM, generally full delivery due
to the ARM stack
Less stack, so the starting address of the stack area is set to 0x40004000, placed be is described as
Startup.o (Stacks).
Program list 1.6 scatter-loading description file for curing procedures mem_c.scf
ROM_LOAD 0x00000000
{
ROM_EXEC 0x00000000
{
Startup.o (vectors, + First)
* (+ RO)
}
IRAM 0x40000000
{
Startup.o (MyStacks)
}
STACKS_BOTTOM +0 UNINIT
{
Startup.o (StackBottom)
}
STACKS 0x40004000 UNINIT
{
Startup.o (Stacks)
}
ERAM 0x80000000
{
* (+ RW, + ZI)
}
HEAP +0 UNINIT
{
Startup.o (Heap)
}
HEAP_BOTTOM 0x80080000 UNINIT
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
21
{
Startup.o (HeapTop)
}
}
1. Use the JTAG interface to download
JTAG interface to download the program to the FLASH JTAG emulator support is required. EasyJTAG
emulator support
Held LPC2000 series ARM7 micro controller chip FLASH download, so you can use this feature to
program
To FLASH, in order to run offline.
The first set EasyJTAG emulator, see Figure 1.24, note ARMcore must select the correct CPU type
Number, otherwise may lead to programming errors.
Figure 1.24 the FLASH of EasyJTAG download chip set
Then chosen to generate the target of the project RelInChip, compiled and linked AXD debugging
environment, and then press the F5 key to enter in
To load the the debug image file that will download a program to FLASH.
In fact, as long as you load the debug image file and code address is set to FLASH address, EasyJTAG
Emulator that the program is downloaded to the specified FLASH.
ISP download
LPC2200 series ARM7 microcontroller chip with ISP (LPC2210 chip FLASH, can not be
The ISP programming), you can download the program via the serial port.
First, the current project compiled to generate HEX file, open the engineering DebugRel Settings
window, in the Target
Post-linker is set in the Settings item selected the ARM fromELF (as shown in Figure 1.25).
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
22
Figure 1.25 Set Post-linker
In the ARM formELF items set the output file type, such as the Intel 32 bit Hex, and then set the output
text
The file name can also be specified directory, If you do not specify a directory, the generated files are
stored in the directory of the current project (Figure 1.26
Shown). Recompile connection, compiled by that will generate the specified output file.
Figure 1.26 generated file set
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
23
Generate the HEX file, then use the serial port extension cord connected to a PC serial port (COM1) and
SmartARM2200
Experiment Board (UART0), and experimental board ISP (JP1) jumper shorted. Open LPC2000 Flash
Utility software and
Set the serial port, baud rate, system crystal (note that the entry unit of the crystal frequency in kHz), as
shown in Figure 1.27.
After setting parameters, click the Read Device ID button, read the chip ID number, if the read was
successful (status bar displays "Read
Part ID Successfully! "), Indicates that the ISP connection is successful. Otherwise, when the error
message is reset LPC2000
First by SmartARM2200 development board RST key to reset, and then determine the prompt, as shown
in Figure 1.28.
After a successful connection, first use the Erase button to erase the selected sectors FLASH, then enter
the Filename entry
Download the HEX file, click Upload to Flash button to start the download process. Cured of the
program, the ISP (JP1)
Jumper disconnected, reset the system to run the program again. Description LPC2200 series ARM7
microcontrollers to Scale
32-bit data (machine code instruction 0x00000000 ~ 0x0000001c address) accumulation and zero to Kai
Activity user program. Retained by setting the data in the exception vector address 0x14 achieve.
Figure 1.27 LPC2000 Flash Utility software settings
Figure 1.28 Reset LPC2000 Tip
3 run offline
� to JP9 jumper selection INSIDE, JP1 disconnection inhibition ISP;
JP10 Jumper � be to choose RAM BANK0 address, FLASH BANK1 address;
� reset the system, you can start the program in the chip FLASH.
1.6.2 chip FLASH curing
EasyJTAG emulator supports specific chip FLASH programming. The user must first address, set the
compiler links
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
24
Code address 0x80000000 address begins LPC2200 special project templates, such as the use of the
election in the target system
With RelOutChip, scatter-loading description file mem_a.scf such as the list of procedures 1.7 below.
, ROM_LOAD the name of the loading area behind the starting address 0x80000000 said loading zone
(due to
Chip FLASH allocation Bank0); ROM_EXEC described perform the address position defined on the first
piece of
Starting address of the start address, size and loading area, the size of the space to be consistent from
the start address placed to scale (ie
Other Startup.o (vectors, + First), which Startup.o target file Startup.s), then place the code (ie *
(+ RO)); the the variable area IRAM start address 0x40000000, to be placed Startup.o (MyStacks); stack
area STACKS
The use of on-chip RAM, ARM stack is generally full descending stack, so the starting address of the
stack area is set to
0x40004000, place described as Startup.o (Stacks); the variable area ERAM starting address 0x81000000
(because
Chip RAM allocation BANK1), placed outside Startup.o file file variable (ie, * (+ RW, + ZI));
Close to the the ERAM variable area system heap space (HEAP), placed be is described as Startup.o
(Heap);
List of procedures for curing procedures 1.7 scatter-loading description file mem_a.scf
ROM_LOAD 0x80000000
{
ROM_EXEC 0x80000000
{
Startup.o (vectors, + First)
* (+ RO)
}
IRAM 0x40000000
{
Startup.o (MyStacks)
}
STACKS_BOTTOM +0 UNINIT
{
Startup.o (StackBottom)
}
STACKS 0x40004000 UNINIT
{
Startup.o (Stacks)
}
ERAM 0x81000000
{
* (+ RW, + ZI)
}
HEAP +0 UNINIT
{
Startup.o (Heap)
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
25
}
HEAP_BOTTOM 0x81080000 UNINIT
{
Startup.o (HeapTop)
}
}
1. Use the JTAG interface to download
JTAG interface to download the program to the chip FLASH JTAG emulator support is needed. EasyJTAG
simulator
Support of specific chip FLASH download program, so that you can use this feature of the program is
downloaded to the chip FLASH
In order to run offline.
JP10 jumper select Bank0-Flash, Bank1-Ram;
Then to set EasyJTAG emulator, see Figure 1.29;
Figure 1.29 download chip the FLASH of EasyJTAG set
Final selection will generate the target of the project RelOutChip, compiled and linked AXD debug
environment, and then press the F5 key to enter
Load debug image file that will download the program to the chip FLASH.
In fact, as long as you load the debug image file, and the address of the code is set to address chip FLASH
The EasyJTAG emulator that the program is downloaded to the specified FLASH.
2 run offline
� to select OUTSIDE, JP1 disconnect prohibit ISP JP9 jumper;
JP10 jumper � will be select Bank0-Flash, Bank1-Ram;
� reset the system, you can start the program in the chip FLASH.
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
26
Chapter 2 Basic Experiment
2.1 External Interrupt Experiment 2
1. Purpose of the experiment
(1) The master vector IRQ interrupt settings and applications;
(2) to grasp the external interrupt pin feature set and an external interrupt mode is set;
2. Laboratory equipment
� Hardware: PC, a
SmartARM2200 teaching a set of experimental development platform
� software: Windows98/XP/2000 system, ADS 1.2 integrated development environment
3. Experimental content
Setting P0.20 feet for EINT3 functions, initialize the interrupt vector, and is set to falling edge trigger
mode, and so on
Subject to the external interrupt. Interrupt service routine buzzer control output signal is negated, and
then clear the interrupt flag and exit the interrupt.
4. Prelab requirements
"ARM based embedded system tutorial carefully read Section 5.4.6, external interrupt input
instructions, 5.8 vector
Interrupt controller instructions.
5. Experimental Procedure
(1) Start ADS 1.2, ARM Executable Image for lpc2200 project template to create a project
VICVect_C.
(2) the preparation of the main program code in a user group's main.c.
(3) In subprogram of Startup.s files InitStack, modify the set system mode stack at code "MSR
CPSR_c, # 0x5f ", even if the IRQ interrupt.
(4) The selection DebugInExram generate the target, and then compile the connection works.
(5) the SmartARM2200 teaching experimental development platform JP2, JP4 jumper shorted, JP7
disconnected. JP9 set
Set to OUTSIDE, JP10 jumper settings to as Bank0-RAM, Bank1-Flash.
(6) Select [Project] -> [Debug] start AXD JTAG emulator debug.
(7) to set a breakpoint in the interrupt service routine, run the program at full speed, so EINT3 low /
high, that repeatedly press
And release under KEY1.
(8) Single-step / full-speed running program to observe the program is properly run, whether the beeper
beeps.
(9) has been the press the KEY1, observe whether it will continue to generate an interrupt.
Note: KEY1 operation jitter may cause multiple interrupts.
6. Experimental reference program
External interrupt experiment reference program shown in Listing 2.1.
Program Listing 2.1 external interrupt experiment reference program
/ ************************************************* ***************************
* File name: main.c
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
27
* Function: using external interrupt 3 B1 control, whenever there is an interruption that negated B1
control port, to indicate the interrupt input.
* Vector interrupt, EINT3 the negative edge.
* Note: The jumper JP2, JP4 shorted, JP7 disconnect, then repeatedly press release KEY1.
************************************************** ************************** /
# Include "config.h"
# Define BEEPCON 1 << 7 / / P0.7 pin control B1, low beep, 1 << 7 equivalent to 0x80
/ ************************************************* ***************************
* Name: IRQ_Eint3 ()
* Function: external interrupt service function of EINT3, negated B1 control port.
The * entrance parameters: no
* Export parameters: None
************************************************** ************************** /
void __ irq IRQ_Eint3 (void)
{
uint32 i;
i = IO0SET; / / read the current B1 control value
if ((i & BEEPCON) == 0) / / to control B1 output negated
{
IO0SET = BEEPCON;
}
else
{
IO0CLR = BEEPCON;
}
EXTINT = 1 << 3; / / Clear EINT3 interrupt flag 1 << 3 is equivalent to 0x08
VICVectAddr = 0; / / Vectored Interrupt conclude
}
/ ************************************************* ***************************
* Name: main ()
* Function: Initialize external interrupt 3 (EINT3) interrupt vector, and set to a falling edge trigger mode,
and then wait for the external interrupt.
* Description: make STARTUP.S file the IRQ interrupts (clear I bit in the CPSR).
************************************************** ************************** /
int main (void)
{
PINSEL1 = 3 << 8; / / set pin connection, P0.20 is set to EINT3
/ / 3 << 8 is equivalent to 0x00000180
IO0DIR = BEEPCON; / / set B1 control port for output, and other I / O input
EXTMODE = 1 << 3; / / set EINT3 interrupt edge-triggered mode
/ / 1 << 3 is equivalent to 0x08
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
28
"EXTPOLAR = 0x00; / / setting EINT3 interrupt for falling edge trigger
/ * Interrupted open EINT3 (set vector controllers that use vector IRQ) * /
VICIntSelect = 0x00000000; / / set all interrupt as IRQ interrupt
VICVectCntl0 = 0x20 | 17; / / the allocation EINT3 interrupt to vector interrupt 0
/ / 0x20 indicates vector IRQ Enable, 1 << 17 EINT3 No. 17 in the VIC channel
VICVectAddr0 = (int) IRQ_Eint3; / / set the interrupt service routine address
EXTINT = 1 << 3; / / Clearing the EINT3 interrupt flag
VICIntEnable = 1 << 17; / / make capable EINT3 interrupt, EINT3 VIC channel on the 17th
while (1); / / wait for interrupt
return (0);
}
7. Think
(1) IRQ interrupt the CPSR I bit is 0 or 1?
(2) how to properly understand VIC interrupt priority?
(3) The experimental the reference program's EINT3 interrupt setting interrupt for Slot10 vector.
2.2 External Memory Interface Experiment 2
1. Purpose of the experiment
Experimental control the settings of the external memory controller (EMC), so that the external memory
access speed optimization, to improve
External program running speed.
2. Laboratory equipment
� Hardware: PC, a
SmartARM2200 teaching a set of experimental development platform
� software: Windows98/XP/2000 system, ADS 1.2 integrated development environment
EasyARM software
3. Experimental content
Display control program (using software delay), and use the timer 0 external RAM running LED light
water measurement per
The time required for one cycle, and the timer value (i.e. the program running time) is sent upward
through the serial bit machine. Through more
Change EMC storage group configuration, control external RAM access speed, and then observe the
running speed of the program.
4. Prelab requirements
(1) Carefully read the description of the external memory controller, ARM Embedded Systems Essentials
5.6.
(2) Carefully read the contents of Chapter 1 of the book to understand the hardware structure of
SmartARM2200 teaching experimental development platform
Note that the system memory circuit.
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
29
5. Experimental Procedure
(1) Start ADS 1.2, ARM Executable Image for lpc2200 project template to create a project
Speed_C.
(2) to write the main program code main.c user group, joined the project in config.h file # include
<stdio.h>.
(3) in the file ResetInit subroutine Startup.s observed the BCFG0 and BCFG1 register setting value,
The external memory interface known engineering template default configuration for the slowest
speed.
(4) The selection DebugInExram generate the target, and then compile the connection works.
(5) the SmartARM2200 teaching experimental development platform jumper JP12 shorted. JP9 set to
OUTSIDE, JP10 jumper settings to as Bank0-RAM, Bank1-Flash.
(6) using the serial port extension cord CZ2 (UART0), SmartARM2200 teaching experimental
development platform and PC
COM1 connection. PC the machine running EasyARM software, set the serial port is COM1, baud rate of
115200, and then select the
[Settings] -> [sending data】, in the pop-up window to send data, click on the "Advanced" to open the
receive window.
(7) Select [Project] -> [Debug] start AXD JTAG emulator debug.
(8) at full speed to run the program, the show's running time in the observation the light water change
speed and EasyARM of software
Value.
(9) Stop to JTAG emulator debugging, Close AXD software. Subfunctions of Startup.s files ResetInit
weight
The speed of the new configuration Bank0 access, see Listing 2.2.
Note: If you enter AXD software is unsuccessful, check whether BCFG0, and BCFG1 parameters to set the
bus too fast.
Reconfigure the access speed of the memory interface 2.2 in the program list
ResetInit
; Initial extenal bus controller.
; The initialization external bus controller, configured according to the target board decided
LDR R0, = PINSEL2
IF: DEF: EN_CRP
LDR R1, = 0x0f814910
ELSE
LDR R1, = 0x0f814914
ENDIF
STR R1, [R0]
LDR R0, = BCFG0
LDR R1, = 0x1000ffef; the slowest operating parameters of the 16-bit bus
STR R1, [R0]
....
(10) to recompile the connection works again Kai AXD JTAG emulator debug.
(11) full-speed run the program, the show's running time in the observation the light water change
speed and EasyARM of software
Value.
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
30
6. Experimental reference program
External memory interface experiment reference program shown in Listing 2.3.
Listing 2.3 External Memory Interface Experiment 2 reference
/ ************************************************* ***************************
* File name: main.c
* Function: through I / O control LED1 ~ LED4, the effect of a flowing light, and measuring
program running time,
* Run-time values and then send to UART0.
* Description: jumper JP12 shorted
* Communications 115200 baud, 8 data bits, 1 stop bit, no parity.
* Please Modify BCFG0 values to achieve the purpose of the test, pay attention to the limits of
the parameters of PSRAM otherwise might debugging failed
************************************************** ************************** /
# Include "config.h"
# Define LEDCON 0xf0000000
# Define UART_BPS 115200 / / Define communication baud rate
const uint32 DISP_TAB [8] = {0x1fffffff, 0x2fffffff, 0x4fffffff, 0x8fffffff,
0xffffffff, 0x0fffffff, 0xffffffff, 0x0fffffff};
/ ************************************************* ***************************
* Name: DelayNS ()
* Function: long software delay
* Entry parameters: dly delay parameter, larger the value, the longer the delay
* Export parameters: None
************************************************** ************************** /
void DelayNS (uint32 dly)
{Uint32 i;
for (; dly> 0; dly -)
{
for (i = 0; i <5000; i + +);
}
}
/ ************************************************* ***************************
* Name: UART0_Ini ()
* Function: initialize the serial port 0. Is set to 8 data bits, 1 stop bit, no parity, baud rate is
115200
The * entrance parameters: no
* Export parameters: None
************************************************** ************************** /
void UART0_Init (void)
{Uint16 Fdiv;
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
31
U0LCR = 0x83; / / DLAB = 1, set the baud rate
Fdiv = (Fpclk / 16) / UART_BPS; / / set the baud rate
U0DLM = Fdiv / 256;
U0DLL = Fdiv% 256;
U0LCR = 0x03;
}
/ ************************************************* ***************************
* Name: UART0_SendByte ()
* Function: send a byte of data to the serial port and waiting to be sent finished.
* Entry parameters: data data to be sent
* Export parameters: None
************************************************** ************************** /
void UART0_SendByte (uint8 data)
{
U0THR = data; / / send data
while ((U0LSR & 0x40) == 0); / / wait until the data has been sent
}
/ ************************************************* ***************************
* Name: UART0_SendStr ()
* Function: send a string to the serial port
* Entrance parameters: srt To send a string pointer
* Export parameters: None
************************************************** ************************** /
void UART0_SendStr (uint8 const * str)
{
while (1)
{
if (* str == ' 0') break;
UART0_SendByte (* str + +); / / send data
}
}
/ ************************************************* ***************************
* Name: main ()
* Functions: According to table DISP_TAB to control the LED display.
************************************************** ************************** /
int main (void)
{Uint8 i;
char disp_buf [30];
PINSEL0 = 0x00000005; / / set the I / O connected to UART0
UART0_Init ();
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
32
/ * PINSEL2 startup code default configuration, Never any configuration PINSEL2, otherwise
the bus will be disturbed * /
IO2DIR = LEDCON;
T0PR = 0;
while (1)
{
T0TC = 0;
T0TCR = 0x01;
for (i = 0; i <8; i + +)
{
IO2SET = DISP_TAB [i]; / / output LED display data
DelayNS (10); / / delay
IO2CLR = 0xffffffff;
}
T0TCR = 0x00;
sprintf (disp_buf, "Run time is:% d  r  n", (uint32) T0TC);
UART0_SendStr ((uint8 *) disp_buf);
}
return (0);
}
7. Think
(1) In addition to the EMC configuration, which system settings will affect the external program
access speed?
(2) If the program is on-chip FLASH run, running speed will be raised? Why?
2.3 Timer Experiment 2
1. Purpose of the experiment
Familiar with the basic settings and the timing of the LPC2000 series ARM7 microcontroller
timer 0 interrupt.
2. Laboratory equipment
� Hardware: PC, a
SmartARM2200 teaching a set of experimental development platform
� software: Windows98/XP/2000 system, ADS 1.2 integrated development environment
3. Experimental content
Using timer 0 1 second timing, control the buzzer to buzzer. Using interrupt timing control.
4. Prelab requirements
Carefully read the description of the ARM-based embedded system tutorial 5.14 Timer 0 and
Timer 1, 5.8
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
33
Section vectored interrupt controller's instructions.
5. Experimental Procedure
(1) Start ADS 1.2, ARM Executable Image for lpc2200 project template to create a project
TimeOut_C.
(2) the preparation of the main program code in a user group's main.c.
(3) In subprogram of Startup.s files InitStack, the code to modify the set system mode stack at
MSR
CPSR_c, # 0x5f, even if IRQ interrupts.
(4) The selection DebugInExram generate the target, and then compile the connection works.
(5) development platform SmartARM2200 teaching experiment JP4 jumper shorted, JP7 jumper
disconnected. JP9 set
OUTSIDE, JP10 jumper settings Bank0-RAM, Bank1-Flash.
(6) Select [Project] -> [Debug] start AXD JTAG emulator debug.
(6) can be run at full speed program, the buzzer will ring for one second, stop one second, and
then loud one second ... turn cycle.
6. Experimental reference program
Timer experimental reference program shown in Listing 2.4.
The program list 2.4 timer Experiment 2 reference program
/ ************************************************* ***************************
* File name: main.c
* Function: Timer 0 1 second timing to control the buzzer beeps. (Interrupt)
* Note: JP4 jumper shorted, JP7 jumper disconnected.
************************************************** ************************** /
# Include "config.h"
# Define BEEPCON 1 << 7 / / P0.7 pin control B1, low level beep
/ ************************************************* ***************************
* Name: IRQ_Time0 ()
* Function: Timer 0 interrupt service routine, negated BEEPCON control port.
The * entrance parameters: no
* Export parameters: None
************************************************** ************************** /
void __ irq IRQ_Time0 (void)
{
if ((IO0SET & BEEPCON) == 0)
{
IO0SET = BEEPCON;
}
else
{
IO0CLR = BEEPCON;
}
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
34
T0IR = 0x01; / / clear the interrupt flag
VICVectAddr = 0x00; / / notice VIC interrupt processing is completed
}
/ ************************************************* ***************************
* Name: Time0Init ()
* Function: Initialize timer 0, timer time 1S, and enable the interrupt.
The * entrance parameters: no
* Export parameters: None
************************************************** ************************** /
void Time0Init (void)
{/ * Fcclk = Fosc * 4 = 11.0592MHz * 4 = 44.2368MHz
Fpclk = Fcclk / 4 = 44.2368MHz / 4 = 11.0592MHz
* /
T0PR = 99; / / set timer 0 frequency of 100 divided too 110592Hz
T0MCR = 0x03; / / match channel 0 match interrupt and reset T0TC
T0MR0 = 110592; / / comparison value (1S-time value)
T0TCR = 0x03; / / start and reset T0TC of
T0TCR = 0x01;
/ * Set the timer 0 interrupt IRQ * /
VICIntSelect = 0x00; / / all interrupt channel is set to IRQ interrupts
VICVectCntl0 = 0x24; / / Timer 0 interrupt the channel assigned highest priority (vector
controller 0)
VICVectAddr0 = (uint32) IRQ_Time0; / / set interrupt service routine address vector
VICIntEnable = 0x00000010; / / enable timer 0 interrupt
}
/ ************************************************* ***************************
* Name: main ()
* Function: Initialize I / O and timer, and then wait for the interrupt.
* Description: make STARTUP.S file the IRQ interrupts (clear I bit in the CPSR).
************************************************** ************************** /
int main (void)
{
PINSEL0 = 0x00000000; / / set pin connected to GPIO
IO0DIR = BEEPCON; / / set I / O output
Time0Init (); / / initialize the timer 0 and enable interrupts
while (1); / / wait for the timer 0 interrupt or timer 1 match output
return (0);
}
7. Think
(1) using the Timer 0 and Timer 1 timer interrupt to control the buzzer (to achieve sound 0.5
seconds, 0.5 seconds off), two fixed
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
35
The timer are 1S timing control buzzer beeps when the timer 0 interrupt, Timer 1 interrupt
control buzzer stop Please knitting
Write programs. (Hint: Timer 0 start 0.5S, and then immediately start the timer)
2.4 UART Experiment 2
1. Purpose of the experiment
Through experiments, the master the UART interrupt program design, and be able to understand
the function of the transmit FIFO and receive FIFO.
2. Laboratory equipment
� Hardware: PC, a
SmartARM2200 teaching a set of experimental development platform
� software: Windows98/XP/2000 system, ADS 1.2 integrated development environment
EasyARM software
3. Experimental content
Host computer using the serial port UART0 receive data sent and received eight consecutive data
will receive the count is incremented.
1 and outputs LED1 ~ LED4 intact, then the received data is sent back to the host computer.
Enable the UART0
FIFO for data transmission / reception, the receiver uses the interrupt handling. UART0
communication baud rate is set to 115200,
Data bits, 1 stop bit, no parity.
4. Prelab requirements
(1) "ARM based embedded system tutorial 5.10 UART0 description carefully read, pay attention
to the FIFO then
Closing the case characteristics.
(2) Carefully read the contents of Chapter 1 of the book to understand the hardware structure of
SmartARM2200 teaching experimental development platform
Note that the serial part of the circuit.
(3) Carefully read the the SP3232E chip data sheet to understand the role and application of this
chip circuit design.
5. Experimental Procedure
(1) Start ADS 1.2, ARM Executable Image for lpc2200 project template to create a project
DataRet_C.
(2) to write the main program code main.c user group, joined the project in config.h file #
include
<stdio.h>.
(3) In subprogram of Startup.s files InitStack, modify the set system mode stack at code "MSR
CPSR_c, # 0x5f ", even if the IRQ interrupt.
(4) The selection DebugInExram generate the target, and then compile the connection works.
(5) experimental development platform of SmartARM2200 teaching JP12 jumper shorted. JP9
set to
OUTSIDE, JP10 jumper settings to as Bank0-RAM, Bank1-Flash.
(6) using the serial port extension cord CZ2 (UART0), SmartARM2200 teaching experimental
development platform and PC
COM1 connection. PC the machine running EasyARM software, set the serial port is COM1,
baud rate of 115200, and then select the
[Settings] -> [sending data】, in the pop-up window to send data, click on the "Advanced" to
open the receive window.
(7) Select [Project] -> [Debug] start AXD JTAG emulator debug.
(8) at full speed to run the program on the PC EasyARM software sends 8 bytes of data,
LPC2210 received several
According to the control board after LED1 ~ LED4 display, and stores the received data back to
the PC. Result of the program such as
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
36
Shown in Figure 2.1. Note 8-byte data must be continuously transmitted.
Figure 2.1 UART experimental run results
6. Experimental reference program
UART experiment reference program shown in Listing 2.5.
Program Listing 2.5 UART Experiment 2 reference
/ ************************************************* ***************************
* File name: main.c
* Function: use the serial port UART0 PC to receive the data sent, received eight consecutive
data, will receive the count is incremented after transfusion
The * out LED1 - LED4 display, and data to be sent back to the host computer.
* Description: jumper JP12 shorted.
* Communications 115200 baud, 8 data bits, 1 stop bit, no parity.
* Interrupt service routine does not respond to single-byte send the total to 8 Bytes, a PC must be
sent continuously 8 Bytes.
************************************************** ************************** /
# Include "config.h"
# Define LEDCON 0xf0000000
/ * Define serial mode set data structure * /
typedef struct UartMode
{Uint8 datab; / / word length, 5/6/7/8
uint8 stopb; / / stop bit, 1/2
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
37
uint8 parity; / / parity bit, no parity, 1 odd parity, 2 for even parity
} UARTMODE;
uint8 rcv_buf [8]; / / UART0 receive buffer
volatile uint8 rcv_new; / / receive new data flag
/ ************************************************* ***************************
* Name: IRQ_UART0 ()
* Function: serial port UART0 receive interrupt.
The * entrance parameters: no
* Export parameters: None
************************************************** ************************** /
void __ irq IRQ_UART0 (void)
{Uint8 i;
if (0x04 == (U0IIR & 0x0F)) rcv_new = 1; / / set to receive new data flag
for (i = 0; i <8; i + +)
{
rcv_buf [i] = U0RBR; / / read FIFO data, and clear the interrupt flag
}
VICVectAddr = 0x00; / / end of interrupt handling
}
/ ************************************************* ***************************
* Name: SendByte ()
* Function: send a byte of data to the serial port UART0.
* Entry parameters: data data to be sent
* Export parameters: None
************************************************** ************************** /
void SendByte (uint8 data)
{
U0THR = data; / / send data
}
/ ************************************************* ***************************
* Name: ISendBuf ()
* Function: buffer data sent back to the host (using FIFO) and the wait has been sent.
The * entrance parameters: no
* Export parameters: None
************************************************** ************************** /
void ISendBuf (void)
{Uint8 i;
for (i = 0; i <8; i + +) SendByte (rcv_buf [i]);
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
38
while ((U0LSR & 0x20) == 0); / / wait for data transmission
}
/ ************************************************* ***************************
* Name: UART0_Init ()
* Function: initialize the serial port 0. Set the work mode and baud rate.
* Entrance parameters: baud baud rate
* Set mode the set (UARTMODE data structure)
* Export parameters: return value of 1 indicates the beginning of the successful, 0 table
parameter error
************************************************** ************************** /
uint8 UART0_Init (uint32 baud, UARTMODE set)
{Uint32 bak;
/ * The filtering parameters * /
if ((0 == baud) | | (baud> 115200))
{
return (0);
}
if ((set.datab <5) | | (set.datab> 8))
{
return (0);
}
if ((0 == set.stopb) | | (set.stopb> 2))
{
return (0);
}
if (set.parity> 4)
{
return (0);
}
/ * Set the serial port baud rate * /
U0LCR = 0x80; / / when DLAB position
bak = (Fpclk >> 4) / baud;
U0DLM = bak >> 8;
U0DLL = bak &0xff;
/ * Set serial mode * /
bak = set.datab-5; / / Set the word length
if (2 == set.stopb)
{
bak | = 0x04; / / determine whether two stop bits
}
if (0! = set.parity)
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
39
{
set.parity = set.parity-1;
bak | = 0x08;
}
bak | = set.parity << 4; / / set the parity
U0LCR = bak;
return (1);
}
/ ************************************************* ***************************
* Name: main ()
* Function: initialize the serial port, and waiting to receive the serial data.
* Description: make STARTUP.S file the IRQ interrupts (clear I bit in the CPSR).
************************************************** ************************** /
int main (void)
{Uint8 rcv_counter;
UARTMODE uart0_set;
PINSEL0 = 0x00000005; / / set the I / O connected to UART0
IO2DIR = LEDCON; / / set the I / O connection LED output
rcv_new = 0; / / received flag 0
uart0_set.datab = 8; / / 8 data bits
uart0_set.stopb = 1; / / 1 stop bit
uart0_set.parity = 0; / / no parity
UART0_Init (115200, uart0_set); / / initialize serial mode
U0FCR = 0x81; / / enable FIFO, and set the trigger point for 8 bytes
U0IER = 0x01; / / allow RBR interrupt, that receive interrupt
/ * Set interrupt enable * /
VICIntSelect = 0x00000000; / / set all channels for the IRQ interrupt
VICVectCntl0 = 0x26; / / UART0 interrupt channel assigned to IRQ slot 0, the highest priority
VICVectAddr0 = (int) IRQ_UART0; / / set UART0 vector address
VICIntEnable = 0x00000040; / / Enable UART0 interrupt
rcv_counter = 0;
IO2SET = 0xffffffff;
while (1) / / wait for interrupt
{
if (1 == rcv_new) / / has received 8 Bytes of data
{
rcv_new = 0; / / clear the flag
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
40
ISendBuf (); / / the received data is sent back to the host
IO2SET = 0xffffffff; / / LED lamp reset
IO2CLR = (rcv_counter << 28); / / count value in binary display via LED
rcv_counter + +; / / receives the count value plus one
}
}
return (0);
}
7. Think
(1) Why must send 8-byte data continuously? (Hint: Note the hardware FIFO receive mode)
(2) If the character timeout interrupt what should read the received data? (Tip: U0LSR, Send
RDR bit register to determine whether there are unread data)
(3) If a byte of data received each receive interrupt is generated, how to design the program?
2.5 I2C Interface Experiment 2
1. Purpose of the experiment
(1) to master the use of the LPC2000 series ARM7 microcontroller hardware I2C interface.
(2) the use of of ZLG7290 keyboard.
2. Laboratory equipment
� Hardware: PC, a
SmartARM2200 teaching a set of experimental development platform
� software: Windows98/XP/2000 system, ADS 1.2 integrated development environment
EasyARM software
3. Experimental content
Use main mode I2C operation ZLG7290, receive keyboard input, according to the key value in
the serial print mentioning
Shown to the PC.
4. Prelab requirements
(1) Carefully read the instructions in Section 5.12 of the ARM-based embedded system tutorial
section I2C interface.
(2) Carefully read the contents of Chapter 1 of the book to understand the hardware structure of
SmartARM2200 teaching experimental development platform
Note that part of the circuit of the keyboard.
(3) carefully read ZLG7290 datasheets, understand this chip circuit design.
5. Experimental Procedure
(1) Start ADS 1.2, ARM Executable Image for lpc2200 project template to create a project
I2cInt_c.
(2) main.c user group to write the main program code, and then the zlg7290.c, zlg7290.h and
I2cInt.c
The I2cInt.h Add to the engineering of the user group, added in the project file config.h "#
include" I2CINT.H ""
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
41
And "# include" ZLG7290.H "".
(3) In subprogram of Startup.s files InitStack, modify the set system mode stack at code "MSR
CPSR_c, # 0x5f ", even if the IRQ interrupt.
(4) The selection DebugInExram generate the target, and then compile the connection works.
(5) the development platform SmartARM2200 teaching experiment JP6 jumper all shorted. JP9
set to
OUTSIDE, JP10 jumper settings to as Bank0-RAM, Bank1-Flash.
(6) Select [Project] -> [Debug] start AXD JTAG emulator debug.
(7) using the serial port extension cord CZ2 (UART0), SmartARM2200 teaching experimental
development platform and PC
COM1 connection. PC the machine running EasyARM software, set the serial port is COM1,
baud rate of 115200, and then select the
[Settings] -> [sending data】, in the pop-up window to send data, click on the "Advanced" to
open the receive window.
(8) run the program at full speed, LPC2210 through I2C interface control ZLG7290. S1 ~ S16
keys, receiver window
The port can be related tips.
6. Experimental reference program
I2C interface experiment reference program shown in Listing 2.6. The which ZLG7290 the
control interface functions stored in zlg7290.c
File, I2C interface function and interrupt handler I2cInt.c file (file code, see the product CD-
ROM).
Experiment 2 reference program Listing 2.6 I2C interface
/ ************************************************* ***************************
* File name: main.c
* Function: Use hardware I2C ZLG7290 operation, interrupt operation.
* Description: jumper JP6 shorted.
* Main program do not do image stabilization processing
************************************************** ************************** /
# Include "config.h"
# Define ZLG7290 0x70 / / define the device address
/ ************************************************* ***************************
* Name: UART0_Init ()
* Function: initialize the serial port 0. Is set to 8 data bits, 1 stop bit, no parity
The * entrance parameters: no
* Export parameters: None
************************************************** ************************** /
void UART0_Init (uint32 bps)
{Uint16 Fdiv;
PINSEL0 = (PINSEL0 & (~ 0x0F)) | 0x05; / / does not affect the other pins are connected, set
the I / O connected to UART0
U0LCR = 0x83; / / DLAB = 1, set the baud rate
Fdiv = (Fpclk / 16) / bps; / / set the baud rate
U0DLM = Fdiv / 256;
U0DLL = Fdiv% 256;
U0LCR = 0x03;
}
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
42
/ ************************************************* ***************************
* Name: UART0_SendByte ()
* Function: send a byte of data to the serial port and waiting to be sent finished.
* Entry parameters: data data to be sent
* Export parameters: None
************************************************** ************************** /
void UART0_SendByte (uint8 data)
{
U0THR = data; / / send data
while ((U0LSR & 0x40) == 0); / / wait until the data has been sent
}
/ ************************************************* ***************************
* Name: UART0_SendStr ()
* Function: send a string to the serial port
* Entrance parameters: srt To send a string pointer
* Export parameters: None
************************************************** ************************** /
void UART0_SendStr (char * str)
{
while (1)
{
if (* str == ' 0') break;
UART0_SendByte (* str + +); / / send data
}
}
/ ************************************************* ***************************
* Name: I2C_Init ()
* Function: main mode I2C initialization, including initialization its interrupt is vectored IRQ
interrupts.
* Entry parameters the: fi2c initialize I2C bus speed, a maximum of 400K
* Export parameters: None
************************************************** ************************** /
void I2C_Init (uint32 fi2c)
{
if (fi2c> 400000) fi2c = 400000;
PINSEL0 = (PINSEL0 & (~ 0xF0)) | 0x50; / / does not affect the other pins are connected, set
the I / O connected to the I2C
I2SCLH = (Fpclk/fi2c + 1) / 2; / / set I2C clock for fi2c
I2SCLL = (Fpclk/fi2c) / 2;
I2CONCLR = 0x2C;
I2CONSET = 0x40; / / enable master I2C
/ * Set I2C interrupt enable * /
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
43
VICIntSelect = 0x00000000; / / set all channels for the IRQ interrupt
VICVectCntl0 = 0x29; / / I2C channel assigned to IRQ slot 0, ie the highest priority
VICVectAddr0 = (int) IRQ_I2C; / / set I2C interrupt vector address
VICIntEnable = 0x0200; / / Enable I2C interrupt
}
/ ************************************************* ***************************
* Name: DelayNS ()
* Function: long software delay
* Entry parameters: dly delay parameter, larger the value, the longer the delay
* Export parameters: None
************************************************** ************************** /
void DelayNS (uint32 dly)
{Uint32 i;
for (; dly> 0; dly -)
{
for (i = 0; i <5000; i + +);
}
}
/ ************************************************* ***************************
* Name: main ()
* Function: ZLG7290 operate
* Description: make STARTUP.S file the IRQ interrupts (clear I bit in the CPSR);
* Included in the CONFIG.H files I2CINT.H, ZLG7290.H.
************************************************** ************************** /
int main (void)
{Uint8 key_buf [8];
char disp_buf [32];
uint8 key;
I2C_Init (30000); / / I2C configuration initialization
UART0_Init (115200); / / UART0 configuration initialization
sprintf (disp_buf, " r  nKey testing!  r  n");
UART0_SendStr (disp_buf);
/ * Read the key results through a the UART0 distributed PC * /
while (1)
{
DelayNS (5);
key = 0;
IRcvStr (ZLG7290, 0x01, key_buf, 8);
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
44
if (0 == key_buf [1]) / / validity keystrokes
{
key = key_buf [0]; / / obtain key
}
sprintf (disp_buf, "This is key% d!  r  n", key);
UART0_SendStr (disp_buf);
}
return (0);
}
7. Think
(1) To improve the speed of the I2C bus, the bus pull-up resistor to increase or to reduce?
(2) If the primary function button dithering process, and how to achieve?
2.6 SPI interface experiments (elected to do)
1. Purpose of the experiment
Through experiments, the master SPI interface initialization and data input / output control.
2. Laboratory equipment
� Hardware: PC, a
SmartARM2200 teaching a set of experimental development platform
Bring your own LED display SPI interface board is a
� software: Windows98/XP/2000 system, ADS 1.2 integrated development environment
3. Experimental content
Use hardware SPI interface to connect with the 74HC595, control 74HC595 driven a digital
display.
4. Prelab requirements
(1) Carefully read the instructions in Section 5.13 of the ARM-based embedded system tutorial
section SPI interface.
(2) Carefully read the contents of Chapter 1 of the book to understand the hardware structure of
SmartARM2200 teaching experimental development platform
Identify SPI1 cited export.
(3) Carefully read the the 74HC595 data manual to understand how to control the data shift, latch
data output.
5. Experimental principle
(1) shown in Figure 2.2, SmartARM2210 provides a GPIO connector the SPI1 signal from J5
cited
Out to the sub-panel. Note the P.20 (SSLE1) must be pulled up to the high level (3.3V),
otherwise SPI1 not work.
P0.25_RD1
TD1 P0.29_MAT0.3
P0.24_TD2
P0.17_CAP1.2
P0.18_CAP1.3 P0.19_MAT1.2
P0.20_EINT3 P0.23_RD2
1 2
3 4
56
78
9 10
11 12
13 14
15 16
17 18
19 20
J5
P2.16
P2.18
P2.20
P2.22
P2.17
P2.19
P2.21
P2.23
GND
+5 V VDD3.3
P.20 - SSEL1 (3.3V
P.19 - MOSI1
P.18 - MISO1
P.17 - SCK1
VDD3.3
R
10K
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
45
The 2.2 SmartARM2210 connector J5
(2) the user can prepare an SPI interface daughter board for LED experiment according to the schematic.
Through the SPI interface and
The LPC2210 phase connection, as shown in Figure 2.3.
1 QB
2 QC
3 QD
4 QE
5 QF
6 QG
7 QH GND 8
SQH 9
SCLR 10
SCK 11 RCK 12
OE 13
SI 14
15 QA VCC 16
U11
74HC595
VDD3.3
nCS
MOSI1
SCK1
MISO1
QA
QB
QC
QD
QE
QF
QG
QH
470 x 8
R34 - R41
QD
QA
QB
QC
QE
QF
QG
QH
12345
6789
10
LED
LN3161BS
VDD3.3
VDD3.3 P0.19
P0.25
P0.17
P0.18
LPC2210
Figure 2.3 LED display SPI interface board
6. Experimental Procedure
(1) Start ADS 1.2, ARM Executable Image for lpc2200 project template to create a project
SPIDisp_C.
(2) the preparation of the main program code in a user group's main.c.
(3) selection of DebugInExram generate the target, and then compile the connection works.
(4) using the DuPont line on the J5 SmartARM2200 teaching experiment development platform SPI1
signals and LED daughter board
The SPI
The interface is connected to 3.3V power supply to the sub-board power supply teaching experimental
development platform.
(5) Select [Project] -> [Debug] start AXD JTAG emulator debug.
(6) full speed to run the program, the observed changes in the LED display.
7. Experimental reference program
SPI interface experiment reference program shown in Listing 2.7.
Program listing 2.7 SPI interface experiment reference program
/ ************************************************* ***************************
* File name: main.c
* Function: use hardware SPI interface output control LED display. (Hardware: 74HC595 output control
LED display)
* Note: on the J5 SmartARM2200 teaching experiment development platform SPI1 signals and LED
daughter board SPI interface
************************************************** ************************** /
# Include "config.h"
# Define HC595_CS 1 << 25 / / P0.25 chip select lines
uint8 const DISP_TAB [16] = {/ / 0 1 2 3 4 5 6 7 8 9
0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8, 0x80, 0x90,
/ / A b C d E F
0x88, 0x83, 0xC6, 0xA1, 0x86, 0x8E};
uint8 rcv_data;
/ ************************************************* ***************************
* Name: DelayNS ()
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
46
* Function: long software delay
* Entry parameters: dly delay parameter, larger the value, the longer the delay
* Export parameters: None
************************************************** ************************** /
void DelayNS (uint32 dly)
{
uint32 i;
for (; dly> 0; dly -)
{
for (i = 0; i <5000; i + +);
}
}
/ ************************************************* ***************************
* Name: MSpiInit ()
* Function: initializing the SPI interface, is set to host.
The * entrance parameters: no
* Export parameters: None
************************************************** ************************** /
void MSpiInit (void)
{
PINSEL1 = (PINSEL1 & ~ 0x3fc) | 0x2a8;
S1PCCR = 0x52; / / set the SPI clock divider
S1PCR = (0 << 3) | / / CPHA = 0, the data in the first SCK a clock edge sampling
(1 << 4) | / / CPOL = 1, SCK is active low
(1 << 5) | / / MSTR = 1, SPI in master mode
(0 << 6) | / / LSBF = 0, the SPI data transfer MSB of the (7) prior
(0 << 7); / / SPIE = 0, SPI interrupts are disabled
}
/ ************************************************* ***************************
* Name: MSendData ()
* Function: send data to the SPI bus, and receives the data sent back from the machine.
* Data the entrance parameters: data to be sent
* Export parameters: returns the value of the received data
************************************************** ************************** /
uint8 MSendData (uint8 data)
{
IO0CLR = HC595_CS; / / Chip Select
S1PDR = data;
while (0 == (S1PSR & 0x80)); / / wait for SPIF is set, that is waiting for data has been sent
IO0SET = HC595_CS;
return (S1PDR);
}
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
47
/ ************************************************* ***************************
* Name: main ()
* Function: use the hardware SPI Interface the output DISP_TAB array data, control the LED display.
************************************************** ************************** /
int main (void)
{Uint8 i;
IO0DIR = HC595_CS;
MSpiInit (); / / initialize SPI interface
while (1)
{
for (i = 0; i <16; i + +)
{
rcv_data = MSendData (DISP_TAB [i]); / / send display data
DelayNS (10);
}
}
return (0);
}
8. Think
(1) using the SPI interface to read the data from the machine, the host why send data?
(2) Let SPCR register CPOL = 1, CPHA = 1, how the SPI data transfer formats?
2.7 RTC Experiment 2
1. Purpose of the experiment
Mastering the RTC points in different system clock frequency set master RTC date and time value set
and read.
2. Laboratory equipment
� Hardware: PC, a
SmartARM2200 teaching a set of experimental development platform
� software: Windows98/XP/2000 system, ADS 1.2 integrated development environment
EasyARM software
3. Experimental content
Initialize and run the RTC, and then every 1 second read time value, and send through the serial the
upward-bit machine,
Bit using EasyARM software simulation calendar window for display.
4. Prelab requirements
(1) Carefully read the "ARM based embedded system tutorial 5.17 real-time clock (RTC) instructions.
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
48
(2) Appendix A to read this book carefully EasyARM software instructions for use, pay attention to the
communication part of the agreement.
5. Experimental Procedure
(1) Start ADS 1.2, ARM Executable Image for lpc2200 project template to create a project
disptimer2.
(2) the preparation of the main program code in a user group's main.c.
(3) selection of DebugInExram generate the target, and then compile the connection works.
(4) the SmartARM2200 teaching experimental development platform JP9 set to OUTSIDE, JP10 jumper
settings
For Bank0-RAM Bank1-Flash.
(5) using the serial port extension cord CZ2 (UART0), SmartARM2200 teaching experimental
development platform and the PC's
COM1 connection. PC the machine running EasyARM software, set the serial port is COM1, baud rate of
115200, and then select the
[Function] -> [calendar, open emulation calendar window.
(6) Select [Project] -> [Debug] start AXD JTAG emulator debug.
(7) at full speed to run the program, the PC on EasyARM software will continue to display the time value
of the RTC.
6. Experimental reference program
RTC experiment reference program shown in Listing 2.8.
Program in Listing 2.8 RTC Experiment 2 reference
/ ************************************************* ***************************
* File name: main.c
* Function: run RTC timing, and the time value constantly sent through the serial the upward-bit
machine. The use EasyARM of the host computer
* Software, the results observed in the simulation of the calendar display.
* Communications 115200 baud, 8 data bits, 1 stop bit, no parity.
* Description:
************************************************** ************************** /
# Include "config.h"
uint8 const SHOWTABLE [10] = {0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F};
/ ************************************************* ***************************
* Name: UART0Init ()
* Function: initialize the serial port 0. Is set to 8 data bits, 1 stop bit, no parity
* Entrance parameter: bps communication baud rate
* Export parameters: None
************************************************** ************************** /
void UART0Init (uint32 bps)
{
uint16 Fdiv;
PINSEL0 = (PINSEL0 & (~ 0x0F)) | 0x05; / / does not affect the other pins are connected, set the I / O
connected to UART0
U0LCR = 0x83; / / DLAB = 1, set the baud rate
Fdiv = (Fpclk / 16) / bps; / / set the baud rate
U0DLM = Fdiv / 256;
U0DLL = Fdiv% 256;
U0LCR = 0x03;
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
49
}
/ ************************************************* ***************************
* Name: UART0SendByte ()
* Function: send a byte of data to the serial port and waiting to be sent finished.
* Entry parameters: data data to be sent
* Export parameters: None
************************************************** ************************** /
void UART0SendByte (uint8 data)
{
U0THR = data; / / send data
while ((U0LSR & 0x40) == 0); / / wait until the data has been sent
}
/ ************************************************* ***************************
* Name: PC_DispChar ()
* Function: sent to PC display characters.
* Entrance parameters: no display position
* Chr displayed character, not to 0xff
* Export parameters: None
************************************************** ************************** /
void PC_DispChar (uint8 no, uint8 chr)
{
UART0SendByte (0xff);
UART0SendByte (0x81);
UART0SendByte (no);
UART0SendByte (chr);
UART0SendByte (0x00);
}
/ ************************************************* ***************************
* Name: SendTimeRtc ()
* Function: read the RTC time value, and read out the hour, minute, and second values sent by the serial
port to the PC.
The * entrance parameters: no
* Export parameters: None
************************************************** ************************** /
void SendTimeRtc (void)
{Uint32 datas;
uint32 times;
uint32 bak;
times = CTIME0; / / read the complete clock register
datas = CTIME1;
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
50
bak = (datas >> 16) &0xFFF; / / obtain annual value
PC_DispChar (0, SHOWTABLE [bak/1000]);
bak = bak% 1000;
PC_DispChar (1, SHOWTABLE [bak/100]);
bak = bak% 100;
PC_DispChar (2, SHOWTABLE [bak/10]);
PC_DispChar (3, SHOWTABLE [bak% 10]);
bak = (datas >> 8) &0x0F; / / get month value
PC_DispChar (4, SHOWTABLE [bak/10]);
PC_DispChar (5, SHOWTABLE [bak% 10]);
bak = datas &0x1F; / / obtain date values
PC_DispChar (6, SHOWTABLE [bak/10]);
PC_DispChar (7, SHOWTABLE [bak% 10]);
bak = (times >> 24) &0x07; / / get day of the week
PC_DispChar (8, SHOWTABLE [bak]);
bak = (times >> 16) &0x1F; / / obtain value
PC_DispChar (9, SHOWTABLE [bak/10]);
PC_DispChar (10, SHOWTABLE [bak% 10]);
bak = (times >> 8) &0x3F; / / obtain the value of sub-
PC_DispChar (11, SHOWTABLE [bak/10]);
PC_DispChar (12, SHOWTABLE [bak% 10]);
bak = times &0x3F; / / get second value
PC_DispChar (13, SHOWTABLE [bak/10]);
PC_DispChar (14, SHOWTABLE [bak% 10]);
}
/ ************************************************* ***************************
* Name: RTCInit ()
* Function: Initialize the real-time clock.
The * entrance parameters: no
* Export parameters: None
************************************************** ************************** /
void RTCInit (void)
{
PREINT = Fpclk / 32768 - 1; / / set the reference clock divider
PREFRAC = Fpclk - (Fpclk / 32768) * 32768;
YEAR = 2005; / / initial of years
MONTH = 5; / / early of January
Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
http://www.zlgmcu.com
51
DOM = 01; / / early of the day
HOUR = 8;
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx
ARM 嵌入式系统实验教程(二)扩展实验.docx

More Related Content

Similar to ARM 嵌入式系统实验教程(二)扩展实验.docx

devicetree-specification
devicetree-specificationdevicetree-specification
devicetree-specificationSurajRGupta2
 
CFC_Egress_FPGA_HWSpec_V1.0
CFC_Egress_FPGA_HWSpec_V1.0CFC_Egress_FPGA_HWSpec_V1.0
CFC_Egress_FPGA_HWSpec_V1.0Craig Maiman
 
software-eng.pdf
software-eng.pdfsoftware-eng.pdf
software-eng.pdffellahi1
 
ARM 嵌入式系统实验教程(1).docx
ARM 嵌入式系统实验教程(1).docxARM 嵌入式系统实验教程(1).docx
ARM 嵌入式系统实验教程(1).docxMostafaParvin1
 
Team Omni L2 Requirements Revised
Team Omni L2 Requirements RevisedTeam Omni L2 Requirements Revised
Team Omni L2 Requirements RevisedAndrew Daws
 
Motorola solutions ap6532 access point installation guide (part no. 72 e 1493...
Motorola solutions ap6532 access point installation guide (part no. 72 e 1493...Motorola solutions ap6532 access point installation guide (part no. 72 e 1493...
Motorola solutions ap6532 access point installation guide (part no. 72 e 1493...Advantec Distribution
 
Motorola solutions ap6532 access point installation guide (part no. 72 e 1493...
Motorola solutions ap6532 access point installation guide (part no. 72 e 1493...Motorola solutions ap6532 access point installation guide (part no. 72 e 1493...
Motorola solutions ap6532 access point installation guide (part no. 72 e 1493...Advantec Distribution
 
Simocode dp = manual de parametrização e operação
Simocode dp = manual de parametrização e operaçãoSimocode dp = manual de parametrização e operação
Simocode dp = manual de parametrização e operaçãoconfidencial
 
An introduction to tivoli net view for os 390 v1r2 sg245224
An introduction to tivoli net view for os 390 v1r2 sg245224An introduction to tivoli net view for os 390 v1r2 sg245224
An introduction to tivoli net view for os 390 v1r2 sg245224Banking at Ho Chi Minh city
 
Tr 3749 -net_app_storage_best_practices_for_v_mware_vsphere,_dec_11
Tr 3749 -net_app_storage_best_practices_for_v_mware_vsphere,_dec_11Tr 3749 -net_app_storage_best_practices_for_v_mware_vsphere,_dec_11
Tr 3749 -net_app_storage_best_practices_for_v_mware_vsphere,_dec_11Accenture
 
Nvidia CUDA Programming Guide 1.0
Nvidia CUDA Programming Guide 1.0Nvidia CUDA Programming Guide 1.0
Nvidia CUDA Programming Guide 1.0Muhaza Liebenlito
 
B7.2 a1353-ra platform commissioning solaris 2.6
B7.2 a1353-ra platform commissioning solaris 2.6B7.2 a1353-ra platform commissioning solaris 2.6
B7.2 a1353-ra platform commissioning solaris 2.6chungminh1108
 
Endversion1 skriptum characterization of miscellaneous multi parametrical sil...
Endversion1 skriptum characterization of miscellaneous multi parametrical sil...Endversion1 skriptum characterization of miscellaneous multi parametrical sil...
Endversion1 skriptum characterization of miscellaneous multi parametrical sil...EjderCevher
 
Fanuc pmc programming manual
Fanuc pmc programming manualFanuc pmc programming manual
Fanuc pmc programming manualAntonio J
 

Similar to ARM 嵌入式系统实验教程(二)扩展实验.docx (20)

devicetree-specification
devicetree-specificationdevicetree-specification
devicetree-specification
 
CFC_Egress_FPGA_HWSpec_V1.0
CFC_Egress_FPGA_HWSpec_V1.0CFC_Egress_FPGA_HWSpec_V1.0
CFC_Egress_FPGA_HWSpec_V1.0
 
test6
test6test6
test6
 
software-eng.pdf
software-eng.pdfsoftware-eng.pdf
software-eng.pdf
 
ARM 嵌入式系统实验教程(1).docx
ARM 嵌入式系统实验教程(1).docxARM 嵌入式系统实验教程(1).docx
ARM 嵌入式系统实验教程(1).docx
 
Team Omni L2 Requirements Revised
Team Omni L2 Requirements RevisedTeam Omni L2 Requirements Revised
Team Omni L2 Requirements Revised
 
Graduation Report
Graduation ReportGraduation Report
Graduation Report
 
Motorola solutions ap6532 access point installation guide (part no. 72 e 1493...
Motorola solutions ap6532 access point installation guide (part no. 72 e 1493...Motorola solutions ap6532 access point installation guide (part no. 72 e 1493...
Motorola solutions ap6532 access point installation guide (part no. 72 e 1493...
 
Motorola solutions ap6532 access point installation guide (part no. 72 e 1493...
Motorola solutions ap6532 access point installation guide (part no. 72 e 1493...Motorola solutions ap6532 access point installation guide (part no. 72 e 1493...
Motorola solutions ap6532 access point installation guide (part no. 72 e 1493...
 
910 247 f-lr-1
910 247 f-lr-1910 247 f-lr-1
910 247 f-lr-1
 
Simocode dp = manual de parametrização e operação
Simocode dp = manual de parametrização e operaçãoSimocode dp = manual de parametrização e operação
Simocode dp = manual de parametrização e operação
 
An introduction to tivoli net view for os 390 v1r2 sg245224
An introduction to tivoli net view for os 390 v1r2 sg245224An introduction to tivoli net view for os 390 v1r2 sg245224
An introduction to tivoli net view for os 390 v1r2 sg245224
 
Tr 3749 -net_app_storage_best_practices_for_v_mware_vsphere,_dec_11
Tr 3749 -net_app_storage_best_practices_for_v_mware_vsphere,_dec_11Tr 3749 -net_app_storage_best_practices_for_v_mware_vsphere,_dec_11
Tr 3749 -net_app_storage_best_practices_for_v_mware_vsphere,_dec_11
 
AAPM-2005-TG18.pdf
AAPM-2005-TG18.pdfAAPM-2005-TG18.pdf
AAPM-2005-TG18.pdf
 
Nvidia CUDA Programming Guide 1.0
Nvidia CUDA Programming Guide 1.0Nvidia CUDA Programming Guide 1.0
Nvidia CUDA Programming Guide 1.0
 
B7.2 a1353-ra platform commissioning solaris 2.6
B7.2 a1353-ra platform commissioning solaris 2.6B7.2 a1353-ra platform commissioning solaris 2.6
B7.2 a1353-ra platform commissioning solaris 2.6
 
Endversion1 skriptum characterization of miscellaneous multi parametrical sil...
Endversion1 skriptum characterization of miscellaneous multi parametrical sil...Endversion1 skriptum characterization of miscellaneous multi parametrical sil...
Endversion1 skriptum characterization of miscellaneous multi parametrical sil...
 
100384784c
100384784c100384784c
100384784c
 
Stk 500
Stk 500Stk 500
Stk 500
 
Fanuc pmc programming manual
Fanuc pmc programming manualFanuc pmc programming manual
Fanuc pmc programming manual
 

More from MostafaParvin1

More from MostafaParvin1 (11)

arm-intro.ppt
arm-intro.pptarm-intro.ppt
arm-intro.ppt
 
ARMInst.ppt
ARMInst.pptARMInst.ppt
ARMInst.ppt
 
ARM.ppt
ARM.pptARM.ppt
ARM.ppt
 
ARM11.ppt
ARM11.pptARM11.ppt
ARM11.ppt
 
ARM_2.ppt
ARM_2.pptARM_2.ppt
ARM_2.ppt
 
ARM7_Architecture.ppt
ARM7_Architecture.pptARM7_Architecture.ppt
ARM7_Architecture.ppt
 
ARM7TDMI-S_CPU.ppt
ARM7TDMI-S_CPU.pptARM7TDMI-S_CPU.ppt
ARM7TDMI-S_CPU.ppt
 
arm_3.ppt
arm_3.pptarm_3.ppt
arm_3.ppt
 
ARM Embedded System Essentials + ZLG.docx
ARM Embedded System Essentials + ZLG.docxARM Embedded System Essentials + ZLG.docx
ARM Embedded System Essentials + ZLG.docx
 
20090814102834_嵌入式C与C++语言精华文章集锦.docx
20090814102834_嵌入式C与C++语言精华文章集锦.docx20090814102834_嵌入式C与C++语言精华文章集锦.docx
20090814102834_嵌入式C与C++语言精华文章集锦.docx
 
IOT Persentation1.pdf
IOT Persentation1.pdfIOT Persentation1.pdf
IOT Persentation1.pdf
 

Recently uploaded

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........LeaCamillePacle
 

Recently uploaded (20)

TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........
 

ARM 嵌入式系统实验教程(二)扩展实验.docx

  • 1. Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com i Table of Contents Chapter 1 ADS integrated development the environment and EasyJTAG emulator application ...................................... ......... 2 The 1.1 ADS 1.2 integrated development environment composed .......................................... ...................................... 2 1.1.1 CodeWarrior IDE Introduction ............................................ ......................................... 2 1.1.2 AXD debugger Introduction ........................................... .................................................. 3 1.2 Project Editing .............................................. .................................................. ............... 4 1.2.1 to establish engineering ............................................. .................................................. ............ 4 1.2.2 to establish file ............................................. .................................................. ............ 5 1.2.3 Add file to the project ........................................... .................................................. .. 5 The 1.2.4 compiler connect engineering ............................................ .................................................. ..... 6 1.2.5 Open the old project ............................................ .................................................. ......... 8 1.3 Project Debugging .............................................. .................................................. ............... 9 1.3.1 Select the debug target ............................................ .................................................. ..... 9 1.3.2 debugging tool bar ............................................ .................................................. ......... 9 1.4 LPC2200-series ARM7 microcontroller template ......................................... .................. 10 The 1.4.1 for ADS1.2 increase of the LPC2200 dedicated engineering template ...................................... ............... 11 1.4.2 use the LPC2200 dedicated engineering template to establish engineering ........................................ ................ 11 1.4.3 template Scope ............................................ .................................................. ... 13 Of 1.5 EasyJTAG emulator installed application .......................................... ................................. 16 To 1.5.1 installed EasyJTAG emulator ........................................... ....................................... 17 1.5.2 use EasyJTAG emulator ........................................... ....................................... 17 1.6 curing procedures ............................................... .................................................. ................ 19 1.6.1 chip FLASH curing .......................................... ............................................ 19 1.6.2 chip FLASH curing .......................................... ............................................ 23 Chapter 2, the basis of experimental ............................................. .................................................. ......... 26 2.1 external interrupt Experiment 2 ............................................. .................................................. ....... 26 2.2 External Memory Interface Experiment 2 ............................................ .............................................. 28 Experiment 2 ............................................. 2.3 Timer .................................................. ........... 32 2.4 UART Experiment 2 .............................................. .................................................. .......... 35 2.5 I2C Interface Experiment 2 ............................................. .................................................. ........ 40 2.6 SPI Interface experimental (elected to do) .......................................... ................................................ 44 2.7 RTC Experiment 2 .............................................. .................................................. ............. 47 2.8 low-power experiment 2 ............................................ .................................................. ............ 51
  • 2. Chapter 3 μC / OS-II-based basic experiment ...................................... .................................... 55 3.1 SPI bus LED control applications ........................................... ......................................... 55 3.2 I2C bus EEPROM applications ............................................ ........................................ 58 The of 3.3 I2C bus ZLG7290 application ............................................ ......................................... 62 3.4 LPC2000 series microcontroller the MODEM interface package ........................................ ........... 65 3.4.1 Overview .............................................. .................................................. ................. 65 3.4.2 packages use ........................................... .................................................. .... 66 3.4.3 Design principle ............................................. .................................................. .......... 69 Chapter 4 ZLG / SD package user manual ........................................ ..................................... 78 Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com ii 4.1 SD / MMC Card external physical interface ......................................... ....................................... 78 4.1.1 SD mode ............................................. .................................................. ............ 79 4.1.2 SPI mode ............................................. .................................................. ........... 80 4.2 SD / MMC card SPI mode hardware circuit design ...................................... ................. 81 4.2.1 SPI bus ............................................. .................................................. ........... 82 4.2.2 card power supply control ........................................... .................................................. ........ 82 4.2.3 card detection circuit ............................................ .................................................. ....... 82 4.3 ZLG / SD package file structure and the overall framework ...................................... ........................ 82 4.3.1 ZLG / SD package file composed ....................................... ................................... 82 4.3.2 ZLG / SD package overall framework ........................................ ...................................... 83 4.4 ZLG / SD package instructions ......................................... ......................................... 83 4.4.1 ZLG / SD package of hardware configuration ....................................... ................................... 83 4.4.2 ZLG / SD package provides API functions ...................................... ........................... 87 Chapter 5 ISP1161A1 and ISP1181B Introduction and hardware circuit design ....................................... ... 90 5.1 ISP1161A1 Introduction and hardware circuit design ........................................... .............................. 90 5.1.1 ISP1161A1 Pin Description ........................................... .......................................... 91 5.1.2 ISP1161A1 the LPC2200 hardware circuit design ........................................ ............ 93 Design of About 5.2 ISP1181B hardware circuit ........................................... ................................. 94 5.2.1 ISP1181B Pin Description ........................................... ............................................ 95 5.2.2 ISP1181B the LPC2200 hardware circuit design ........................................ .............. 98 5.2.3 ISP1181B PACK Introduction ............................................ ........................................ 99 Chapter 6 ZLG/USBD13 package .......................................... ....................................... 101 6.1 ZLG/USBD13 package structure ........................................... ....................................... 101 Of 6.2 ZLG/USBD13 package to use ......................................... ............................. 101 The package 6.2.1 ZLG/USBD13 hardware configuration methods ...................................... ................ 102 6.2.2 package configuration .......................................... ............................................. 105 6.3 ZLG/USBD13 package API function .......................................... ................................ 107 A 6.4 EasyUSBD13.dll dynamic library ............................................ .......................................... 110
  • 3. Chapter 7 the ZLG driven middleware for use ......................................... ................................ 111 1.1 ZLG / CF-driven middleware ........................................... ................................................. 111 1.1.1 Overview .............................................. .................................................. ............... 111 1.1.2 ZLG / CF-driven structure view ........................................ .................................... 111 1.1.3 middleware configuration options .......................................... ................................................. 112 1.1.4 API function manual ............................................ .................................................. .113 Chapter 8, to read and write the U disk module driven use ....................................... .................................. 120 8.1 read U disk module Introduction ........................................... .................................................. .120 8.2 firmware drivers instructions .............................................. .................................................. ....... 120 8.2.1 initialization configuration ........................................... .................................................. ...... 120 8.2.2 User-written interface functions .......................................... ......................................... 121 8.2.3 API function ............................................. .................................................. ........ 124 Chapter 9 the MiniGUI graphical interface experiment ........................................... ................................... 127 9.1 MiniGUI for uC / OS-II transplantation experiments ........................................ ................................. 127 9.2 MiniGUI message processing experiment ............................................. .......................................... 147 9.3 dialog box application programming experiment ............................................ ............................................... 153 Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com iii 9.4 control application programming experiment ............................................. .................................................. 162 9.5 custom control experiment ............................................. .................................................. .... 170 The 9.6 VerySimpleEditor experiment ............................................. .................................................. .... 175 Figure 9.7 display experiments ............................................. .................................................. ........ 181 9.8 GDI drawing experiment .............................................. .................................................. ....... 186 9.9 desktop themes experiment .............................................. .................................................. ....... 191 The Chapter 10 μCLinux development platform building ........................................... ................................. 202 10.1 host and target machines ............................................ .................................................. ..... 202 10.2 to establish a cross-development environment ............................................. .................................................. 202 10.2.1 establish a development environment ............................................ .................................................. .202 10.2.2 Installation μCLinux ............................................. .................................................. .203 10.2.3 configuration μCLinux ............................................. .................................................. .203 10.3 download μCLinux kernel to the development board ........................................... .................................... 206
  • 4. 10.3.1 file structure ............................................. .................................................. ........ 206 10.3.2 Download ZLG_BOOT ............................................. ............................................ 208 The 10.3.3 download μCLinux kernel and file system ......................................... .......................... 213 10.4 start μCLinux ............................................... .................................................. ....... 221 10.4.1 through HyperTerminal under Widows ........................................ ........................ 221 10.4.2 via Minicom under Linux ......................................... .......................... 223 10.5 NFS settings ............................................... .................................................. ............. 224 10.6 GDB debugging ............................................... .................................................. ............ 228 Chapter 11 is based on μCLinux basic experiment ........................................... ................................. 229 11.1 CAT1025 read and write experimental ............................................. ................................................. 229 11.2 task timer .............................................. .................................................. ........... 231 11.3 semaphore timer ........................................... ................................................ 234 Over 11.4 process experimental .............................................. .................................................. ........... 236 11.5 WebServer experiment ............................................... .................................................. ... 239 Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 1 μC / OS-II papers Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 2 Chapter 1 ADS integrated development the environment and EasyJTAG emulator application ADS integrated development environment for ARM core microcontrollers ARM has introduced an integrated development tool, called the English ARM Developer Suite, mature version ADS1.2. ADS1.2 support the ARM10 before all ARM series of micro- Controller, support for software debugging and the JTAG hardware simulation debugging support Assembler, C, C + + source with compiler efficiency High, the system library function, Windows98, Windows XP, Windows 2000 and RedHat Linux Run. Here brief ADS1.2 to establish engineering compilation connection settings, debugging operations. Finally introduced Based on the use of the LPC2200 series ARM7 microcontroller project templates, EasyJTAG emulator to install and use. The 1.1 ADS 1.2 integrated development environment composed ADS 1.2 consists of six sections, as shown in Table 1.1. Table 1.1 ADS 1.2 part Name Description use Code generation tools ARM assembler The ARM C and C + + compiler,
  • 5. The Thumb of C, C + + compiler, ARM connector Call by the CodeWarrior IDE Integrated development environment the CodeWarrior IDE engineering management, compiled connection Debugger AXD, ADW / ADU, armsd Simulation debugging Instruction simulator ARMulator by the AXD call ARM development package some of the underlying routines Utility (such as fromELF) Some utility by CodeWarrior IDE call ARM Applications Library C, C + + libraries and other user programs use Because users typically direct manipulation is the the CodeWarrior IDE integrated development environment and AXD debugger, so this Chapter describes the use of the two parts of the software, a detailed description of the rest of Reference ADS 1.2 online help documentation or phase Relevant information. 1.1.1 CodeWarrior IDE Introduction The ADS 1.2 the CodeWarrior IDE integrated development environment, and integrate the ARM assembler, ARM C / C + + Compiler Thumb C / C + + compiler, ARM connectors include project management, code generation interface, syntax-sensitive Sense (keyword displayed in different colors) editor, source files and class browser and so on. CodeWarrior IDE main window shown in Figure 1.1 shows. Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 3 Figure 1.1 CodeWarrior development environment 1.1.2 AXD debugger Profile AXD debugger for ARM Extended Debugger (ARM eXtended Debugger), including all ADW / ADU Features, support for hardware emulation and software simulation (The ARMulator). The AXD image file can be loaded into the target memory, with a single Step, full-speed and breakpoint debugging features, variables, registers, and memory data, can be observed. The AXD debugger main window Port is shown in Figure 1.2. Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com
  • 6. 4 Figure 1.2 AXD debugger 1.2 Project editor 1.2.1 Establishing the works WINDOWS operating system, click the [Start] -> [Programs] -> [ARM Developer Suite v1.2] -> [CodeWarrior for ARM Developer Suite] starting Metrowerks CodeWarrior, or the double-"CodeWarrior for ARM Developer Suite "shortcut starter start ADS1.2 IDE as shown in Figure 1.3. Figure 1.3 start ADS1.2 IDE Click the [File] menu, select [New ...] pop-up New dialog box, shown in Figure 1.4. Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 5 Figure 1.4 New dialog Select the project template for ARM executable image (ARM Executable Image) or Thumb executable mappings (Thumb Executable Image), or the Thumb, ARM intertwined image (Thumb ARM Interworking Image), Storage path and in [Location options works, and in the [Project name] entry input project name, click [indeed Given] button to create the corresponding engineering project file name suffix for mcp (hereinafter sometimes project called Project). 1.2.2 create documents Create a text file, in order to enter the user program. Click "New Text File" icon button, shown in Figure 1.5 Shows. Figure 1.5 "New Text File" icon button New file program, click on the "Save" icon button to save files (or from the [File] menu options Choose [Save]), the full name of the input file, such as TEST1.S. Note that, save the file to the corresponding directory of the project, Easy to manage and find. Of course, you can also New dialog box, select [File] page to create a source file, as shown in Figure 1.4, or use other A text editor to create or edit the source files. 1.2.3 add files to the project In the project window, shown in Figure 1.6 [Files] page blank space right click pop-up floating menu, select "Add Files ... "to pop up the" Select files to add ... "dialog box, select the corresponding source file (subject Ctrl key election Optional multiple files), click [open] button. Project templates Engineering the storage path Project Name New Text File
  • 7. Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 6 In addition, users can select the [Project] menu [Add Files ...] to add the source files, or use the New Source file to create the dialog box, select [File] page, select the project (ie select "Add to Project"). Add text The parts operation shown in Figure 1.6, as shown in Figure 1.7. Figure 1.6 add the source files in the project window Figure 1.7 Select files to add ... dialog box The 1.2.4 compiled connected engineering Figure 1.8 shows the icon button in the project window, through these icon buttons, you can quickly project set Set, compiled connection start debugging (on a different menu items can find the corresponding menu command). They left to To the right, respectively, as follows: DebugRel Settings ... project settings, such as the address set the output file settings, such as compiler options, In which DebugRel for the current generation target (target system). Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 7 Synchronize Modification Dates sync each file modification date, modified date, check the project if Updates (such as the use of other editor to edit the source files), in Touch column marked "√". Make compile connection (shortcut key F7). Debug start AXD debugging (shortcut key F5). Run start AXD debug, and run the program directly. The Project Inspector engineering checks, view and configure the project source file. Figure 1.8 project window icon button Figure 1.9 DebugRel Settings window Icon click "DebugRel Settings ..." button, you can project address set the output file settings, compiled Translation options, and so on, as shown in Figure 1.9. "ARM Linker" dialog box to set the connection address, "Language Settings" Set compiler compiler option. View simple software debugging connection address settings can not click directly on the project window "Make". Standard button to complete the compilation connection. If compile error, there will be a corresponding error message, double-click the error prompt line information Editing window that uses the cursor pointed out this error source lines of code, compiled connected to the output window in Figure 1.10 below. Similarly, You can find the appropriate command in the [Project] menu.
  • 8. Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 8 The Figure 1.10 compiled connect output window As shown in Figure 1.11, Touch the bar to mark the file is compiled, if the "√" indicates that the corresponding file required To recompile. Touch bar for tag files are compiled, if the "√" indicates that the corresponding files need to be renumbered Translation. / Cancel symbol "√" can be set by clicking on the column position or project directory *. Tdt file deletion The entire project source files are marked with a "√". The Make operation in Figure 1.11 Project window 1.2.5 Open the old project Click [File] menu, select Open ...] that pop up the "Open" dialog box, find the corresponding project file (*. Mcp) Touch bar Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 9 Click [Open]. Double-click the source file name to open the file in the project window [Files] page Edited. The 1.3 engineering of debugging 1.3.1 Select the debug target Figure 1.12 Choose Target window When engineering compiled connected by click "Debug" icon button in the project window, you can start AXD Debug (You can also start] menu starting AXD). Click on the menu [Options] select [the Configure Target ...] That pop up the Choose Target window, shown in Figure 1.12. Add other emulation driver, Target in Only two were ADP (JTAG hardware simulation) and ARMUL (software emulation). Select emulation driver, click [File] Select [Load Image ...] the loaded ELF format executable Pieces, ie *. Axf file. Description: When engineering compiled connected by the project name project name _Data current generated mesh Standard "directory will generate a *. Axf debug files such as engineering the TEST, the current generation of target Debug compile even After connected, in ... the TEST TEST_Data Debug directory generate TEST.axf file. 1.3.2 debug toolbar AXD run debug toolbar as shown in Figure 1.13, Figure 1.14 debug observation window toolbar, file operatives Toolbar shown in Figure 1.15. Figure 1.13 run debug toolbar Running at full speed (Go)
  • 9. Stop running (Stop) Single-step operation (Step In), the Step command that the function call statement, will enter the Step In command Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 10 The function. Single-step operation (Step), each execution of a statement, then the function call will perform as a statement. Single-step operation (Step Out), performing this function is called, to stop the next statement in the function call. Run to Cursor (Run To Cursor), stop the run the program until the current cursor row. Set breakpoints (Toggle BreakPoint) Figure 1.14 debug observation window toolbar Open the register window (Processor Registers) The open observation window (Processor Watch) Open the variable observation window (Context Variable) To open memory observation window (Memory) Open the disassembly window (Disassembly) Figure 1.15 file operations toolbar To load debug files (Load Image) Reload the file (Reload Current Image). AXD not reset command, it is usually to use Reload achieve reset (directly change the PC register zero can achieve reset). 1.4 LPC2200 series ARM7 microcontroller project template Section 1.2 describes the newly created engineering, we have contacted several standard project template provided ADS1.2 so Various templates created works, they all have different set of convenient to generate the different structure of the code, such as ARM Executable image (generation ARM instruction code) or Thumb executable image (generated the Thumb instruction code), or Thumb, ARM interwoven image (generated Thumb and ARM instruction interwoven code). For LPC2200 series ARM7 micro-controller, we define six project templates, these templates are generally contained Setup information FLASH start address 0x00000000, the on-chip RAM starting address 0x40000000, off- chip RAM since Start address 0x80000000, compile connectivity options and compiler optimization level, and so on; template contains the LPC2200 series The ARM7 microcontroller starter file, including STARTUP.S TARGET.C; template also includes LPC2200 series ARM7 microcontroller header file (such as: LPC2294.h LPC2294.inc, LPC2294 register is downward compatible) Scatter-loading description file (such as: mem_a.scf mem_b.scf mem_c.scf) and so on.
  • 10. Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 11 The 1.4.1 for ADS1.2 increase the LPC2200 dedicated engineering template "Lpc2200 project module" directory of all files and directories are copied to, "<ADS1.2 install directory > Stationery "to the operation shown in Figure 1.16 and Figure 1.17. This step only once, after you can directly make Project template. Figure 1.16 Select copy files and directories Figure 1.17 Copy files directory 1.4.2 use the LPC2200 dedicated engineering template to establish engineering Start ADS1.2 IDE, click [File] menu, select New ...] that is the pop-up New dialog box, shown in Figure 1.18 Shown. Prior increase LPC2200 dedicated engineering template, so more several engineering template selected in the project template column Entry. Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 12 Figure 1.18 increase in the project templates LPC2200 special project templates are described as follows: ARM Executable Image for lpc2200: no operating system, all the C code is compiled into the ARM instruction Project template. asm for lpc2200: the assembler project templates. Thumb ARM Interworking Image for lpc2200: operating system, some C code compiled for ARM Instruction, part of the C code is compiled for the the Thumb instruction of project templates. Thumb Executable Image for lpc2200: No operating system all C compiled into the Thumb instruction work The process template. ARM Executable Image for UCOSII (for lpc2200): all the C code compiled for ARM instruction μC / OS-II project template Thumb Executable Image for UCOSII (for lpc2200): part of the C code is compiled into the ARM instruction Part of the C code is compiled for Thumb instruction μC / OS-II project template (use the μC / OS-II, it is not possible to all code Compiled into the Thumb instruction). The user to select the appropriate project templates create works, as shown in Figure 1.19 to use the ARM Executable Image for lpc2200 project template to build a project. Works four generate the target (target system): DebugInExram The DebugInChipFlash, RelInChip RelOutChip, their configuration is shown in Table 1.2. Project
  • 11. templates will phase Should the compiler parameters set up, you can use directly. Note: the LPC2200 chip selection RelInChip goals encryption (no chip chip FLASH Not encrypted). The encryption chip can only use the ISP chip global erase in order to restore the JTAG debug and ISP read / Write operations. Table 1.2 LPC2200 special project templates each generated target configuration Generate the target scatter-loading description file to debug entry point address C optimization level application notes Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 13 DebugInExram mem_b.scf 0x80000000 Most RAM chip debug mode, the program In the off-chip RAM DebugInChipFlash mem_c.scf 0x00000000 Most chip FLASH debug mode, Cheng Sequence in FLASH chip FLASH work mode the RelInChip mem_c.scf 0x00000000 Most chip, Cheng The sequence in the chip FLASH. Program Write chip after chip will be protected RelOutChip mem_a.scf 0x80000000 Most chip FLASH mode, Cheng The FLASH sequence chip Figure 1.19 with LPC2200 dedicated project templates to establish engineering 1.4.3 template Scope (1) The template assumes that the user system using off-chip memory. If the user does not use off-chip memory, you can use LPC2100 project templates, download address for http://www.zlgmcu.com/tools/kaifaban/EasyARM2100.asp Of the EasyARM2100 Development Kit QuickStart and LPC210 .... (2) The template assumes that the user system off-chip memory using a 16-bit bus, and does not use the ETM function. If the user's Chip memory instead of using the 16-bit bus, and / or use of ETM function, need to modify Startup.s this file repair Change point to see the list of procedures 1.1. Please refer to the user manual of LPC2200 chip how to modify the download address: http://www.zlgmcu.com/philips/philips-arm.asp. Note: the various engineering template Startup.s not exactly the same, may need to modify. Program the list 1.1 Startup.s file need to change code ...... ResetInit ; The initialization external bus controller, configured according to the target board decided LDR R0, = PINSEL2 IF: DEF: EN_CRP
  • 12. LDR R1, = 0x0f814910 Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 14 ; 0x0f814910 changed to a desired value, note that the minimum 4 0 ELSE LDR R1, = 0x0f814914 ; 0x0f814914 changed to a desired value, if you use ETM last 4 need to be modified to 6 ENDIF STR R1, [R0] LDR R0, = BCFG0 LDR R1, = 0x1000ffef ; 0x1000ffef changed values STR R1, [R0] LDR R0, = BCFG1 LDR R1, = 0x1000ffef ; 0x1000ffef changed values STR R1, [R0] ...... (3) to generate goals DebugInExRam. Suppose the user systems chip debugging the RAM usage bank0 (ie origin Address is 0x8000 0000), this one can not be modified. If the user is not the case, you can not use DebugInExRam This generated a target debugger. (4) to generate goals DebugInExRam. Assuming the user system in debug chip RAM size is 512K bytes, this Article affects only generate the target DebugInExRam. If not, you will need to modify mem_b.scf this file, modify Point to see the list of procedures 1.2. Note: to the Windows hides the extension of this file only appears as mem_b. Program Listing 1.2 mem_b.scf file need to modify the code ...... ERAM 0x80040000 / * Be modified according to the actual situation from the beginning of the address stored program can read and write variables * / { * (+ RW, + ZI) } ...... HEAP_BOTTOM 0x80080000 UNINIT / * This address is the end of the address of the RAM chip, according to the practical situation * / {
  • 13. Startup.o (HeapTop) } (5) to generate the target RelOutChip. The hypothetical user system using an external start, the starting address will chip FLASH For 0x8000 0000 (LPC2200 chip requirements), off-chip RAM usage Bank1 (starting address 0x8100 0000). Do not use if there is no off-chip FLASH RelOutChip the generated target. If the off-chip RAM starting The address is not is 0x8100 0000, you will need to modify mem_a.scf file, modify the point shown in Listing 1.3. Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 15 Note: to the Windows hides the extension of this file only displayed for mem_a. Program Listing 1.3 mem_a.scf file need modify the code - chip RAM ...... ERAM 0x81000000 / * From the beginning of the address stored program can read and write variables, changed to the actual start of the off-chip RAM address * / { * (+ RW, + ZI) } ...... HEAP_BOTTOM 0x81080000 UNINIT / * This address is the end of the address of the RAM chip, according to the practical situation * / { Startup.o (HeapTop) } (6) to generate goals DebugInChipFlash and RelInChip. A hypothetical user system chip RAM usage Bank0 (ie Start address 0x8000 0000). Chip RAM starting address 0x8000 0000, you need to modify mem_c.scf File, modify the point shown in Listing 1.4. Program Listing 1.4 mem_c.scf file need modify the code - chip RAM ...... ERAM 0x80000000 / * From the beginning of the address stored program can read and write variables, changed to the actual start of the off-chip RAM address * / { * (+ RW, + ZI) } ...... HEAP_BOTTOM 0x80080000 UNINIT / * This address is the end of the address of the RAM chip, according to the practical situation * /
  • 14. { Startup.o (HeapTop) } Note: Users can also modify several files mem_a.scf, mem_b.scf, mem_c.scf memory For more control. (7) in order to adapt to the different speed of the memory, the engineering template default configuration 4 Bank the memory interface slowest visit Q speed. The user can be re-configured according to the actual use of the memory access speed, in order to obtain the best system performance, the reference Program list 1.5. Program list configuration memory interface 1.5 target.c file access speed void TargetResetInit (void) { Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 16 # Ifdef __ DEBUG MEMMAP = 0x3; / / remap / * Bank0 reconfigure the access speed * / BCFG0 = 0x10000400; # Endif # Ifdef __ OUT_CHIP MEMMAP = 0x3; / / remap / * Bank0 reconfigure the access speed * / BCFG0 = 0x10000400; # Endif # Ifdef __ IN_CHIP MEMMAP = 0x1; / / remap / * Bank0 reconfigure the access speed * / BCFG0 = 0x10000400; # Endif ...... } Note: Users can also modify target.c TargetResetInit () function before entering the main function to initialize More things (using assembler template other than construction). The 1.5 EasyJTAG emulator installation and application The EasyJTAG emulator is Luminary Micro Development Co., Ltd. developed the LPC2000 family of ARM7 micro-controller Made a JTAG emulator, to support ADS1.2 integrated development environment, supports single-step, full-speed and breakpoint debugging features, support Holding download the program to the chip FLASH and specific types of off-chip FLASH, using ARM's
  • 15. standard 20-pin JTAG Simulation debugging interface. Its main features are as follows: � the RDI communication interface, seamless to scarfing ADS1.2 and RDI interface IDE debugging environment. � up to 1M rate JTAG clock drive. � sync Flash refresh technology (synFLASH), synchronization download user code into Flash, and that under that tune. � using the synchronous timing control technology (synTIME), simulation is reliable and stable. � support 32-bit ARM instruction / 16 THUMB instruction mixed debugging. � increase mapped register window, user-friendly view / modify the register values. � micro-volume design, user-friendly flexibility. EasyJTAG emulator appearance Figure 1.20, its driver in http://www.zlgmcu.com/tools/kaifa ban/EasyARM2200.asp Web download or on the product CD (the directory named EasyJTAG_drive A readme.txt file in the directory noted). Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 17 The Figure 1.20 EasyJTAG emulators physical appearance To 1.5.1 installed EasyJTAG emulator First of all, the driver of the EasyJTAG emulator (like product CD EasyJTAG_drive directory all files Pieces) to the ADS BIN directory, such as C: Program Files ARM ADSv1_2 BIN. Then, the EasyJTAG emulator's 25-pin interface connected via a parallel port extension cord with the parallel port of a PC, EasyJTAG emulator, 20-pin interface connection cable 20 PIN received SmartARM2200 development board J2 on Matching transformer (9V) power supply to the development board. Then enter AXD debug environment, open the [Options] -> [Configure Target ...] to pop up the Choose Target Window, shown in Figure 1.12. Click "ADD" to add the emulator driver in the Add File window choose, such as C: Program Files ARM ADSv1_2 BIN directory EasyJTAG.dll, click "Open". Description: Windows system, click [start] -> [Programs] -> [ARM Developer Suite v1.2] -> 【The AXD Debugger】 can run AXD software directly. Note: Add Files window displays DLL file, set the the WINDOWS file browser window "file Folder Options (O) ... "," hidden files "View page items using the" Show All Files ". The 1.5.2 use EasyJTAG emulator Computer parallel port with EasyJTAG of emulator connection and emulator JTAG port connector into SmartARM2200 Development board J2 AXD software is set to simulation debugging. 1 emulator settings AXD debugging environment, open the [Options] -> [Configure Target ...] Choose Target window pops up,
  • 16. "Target Environments" box, select "EasyJTAG ..." item. Click the "Configure" button, enter "EasyJTAG Setup" settings window, as shown in Figure 1.21. "ARMcore" Select the CPU type, select the "Options" item Halt program. Then click "OK", and then click on the "OK" The connection (development board) operation will be carried out at this time EasyJTAG. If the connection is successful, the development board LPC2210 chip EasyJTAG control, the previously running program is stopped. Note: Sometimes, AXD will pop up an error dialog box as shown in Figure 1.23, or a similar dialog box can Click "Connect mode ...", and then select the "ATTACH ..." to determine, and then click "Restart". If EasyJTAG Correctly connected to the development board, AXD code window will display a blank, then you can use [File] -> [Load Image ...] Debug file is loaded, JTAG debug. Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 18 Figure 1.21 "EasyJTAG Setup" settings window EasyJTAG set Option Description: ARMcore items, select CPU model; Tap No. Items, when the CPU for LPC2106/2105/2104, master / slave JTAG debug port, Tap1 main Tap2 from; Connection, hardware connection interface options; Halt Mode, the shutdown mode selection contains Halt program (to stop CPU) and Halt and reset (reset and then stopped Stop CPU) two; Aux. Option, support options, including Step In Interrupt (allows single step into the interrupt) and Erase Flash when need (allow EasyJTAG Erase Flash) two; Flash Type, chip FLASH Model Select two FLASH chip, when ARMcore choose LPC2200 Series CPU this to be effective. When the program needs to be downloaded to the chip FLASH, EasyJTAG emulator will be selected core Model of chip erase / program. Flash 0 Addrss, the first piece of Flash address set contains the Start Address (Flash the start address, such as Bank0 0x80000000) Memory Size (memory capacity when fill in the actual chip capacity, such as The capacity of the SST39VF160 0x200000). When the program do not need to download to the chip FLASH, or the system does not chip When FLASH, Start Address and Memory Size is set to 0. The Flash 1 Addrss, with Flash 0 Addrss. 2 emulator application Press F5 or Debug icon button to ADS1.2 IDE environment directly into AXD, but sometimes appear as
  • 17. Prompt shown in Figure 1.22, the processing method is to click "OK", and then click the "Load Session window pop-up to take Elimination. "Into AXD After, the main debug window without any code, and [File] -> [Load Image ...] menu item without Efficiency, the need to re-open the [Options] -> [Configure Target ...] Click the "OK", and then click [File] Select Load Image ...] to load the debug files. Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 19 Figure 1.22 session file error AXD debug environment, sometimes the Fatal AXD Error window pops up, as shown in Figure 1.23, then you can To click on the "Connect mode ...", and then select the "ATTACH ..." to determine, and then click "Restart". Next on Can use [File] -> [Load Image ...] loaded debug files for JTAG debugging. Note: for some of the PC, EasyJTAG not correctly connected to the development board, always error dialog box pops up, then can be To check the parallel port connection is reliable, check whether the parallel port on the dongle is connected to, or to re-development board under electric. In addition, CMOS settings in the PC parallel port mode is set to SPP mode, set the parallel port of the resources for the 378H to 37FH. Figure 1.23 Fatal AXD error Chip peripheral registers observation. To open in the System Views] -> [Debugger Internals] LPC2000 Series ARM7 microcontroller chip peripheral register window. Some registers are not allowed to deliver the show or read operation will affect The value of other registers, so can not be found in the on-chip peripheral register window, if you need to observe these registers can be Use of the the memory observation window (Memory). JTAG download the program to the FLASH. Enter the AXD debugging environment, open the [Options] -> [Configure Target ...] Choose Target window pops up, click on the "Configure" button to enter the set of "EasyJTAG Setup" Window, select "FLASH" item "Erase Flash when need", then OK to exit. In this way, each loaded FLASH Address debug files, erase the FLASH and download code to FLASH. 1.6 firmware To download the program to the on-chip FLASH FLASH or external JTAG emulator debug through (ie curing Program), before they can run offline. 1.6.1 chip FLASH curing Firmware for LPC2200 series ARM7 microcontroller chips to chip FLASH two parties Style to achieve: JTAG interface to download and use ISP function download. No matter which way the user first set compiled
  • 18. Translation of the address of the link, the code address start from 0x00000000 address, such as using LPC2200 special project templates In to generate target selection RelInChip, scatter-loading description the file mem_c.scf such as shown in the program listing 1.6. , ROM_LOAD loading area behind 0x00000000 the address of the start of the loading area (DPS Put the starting address of the program code), can also be added later in the size of its space, such as "ROM_LOAD 0x00000000 Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 20 0x20000 "loading area starting address 0x00000000, size is 128K bytes; ROM_EXEC describe the execution Line of the address, location defined on the first piece, the starting address of the starting address space size and loading area space Consistent. Placed from the start address to the scale (ie Startup.o (vectors + First) where Startup.o for Startup.s Target file), and then place the other code (* (+ RO)); the variable area IRAM starting address 0x40000000 placed The starting address of the variable area ERAM Startup.o (MyStacks); 0x80000000, placed outside in addition Startup.o file Other variables of the file (ie * (+ RW, + ZI)); close to the the ERAM variable area system heap space (HEAP) is placed Described as Startup.o (Heap); stack area the STACKS using the on-chip RAM, generally full delivery due to the ARM stack Less stack, so the starting address of the stack area is set to 0x40004000, placed be is described as Startup.o (Stacks). Program list 1.6 scatter-loading description file for curing procedures mem_c.scf ROM_LOAD 0x00000000 { ROM_EXEC 0x00000000 { Startup.o (vectors, + First) * (+ RO) } IRAM 0x40000000 { Startup.o (MyStacks) } STACKS_BOTTOM +0 UNINIT { Startup.o (StackBottom)
  • 19. } STACKS 0x40004000 UNINIT { Startup.o (Stacks) } ERAM 0x80000000 { * (+ RW, + ZI) } HEAP +0 UNINIT { Startup.o (Heap) } HEAP_BOTTOM 0x80080000 UNINIT Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 21 { Startup.o (HeapTop) } } 1. Use the JTAG interface to download JTAG interface to download the program to the FLASH JTAG emulator support is required. EasyJTAG emulator support Held LPC2000 series ARM7 micro controller chip FLASH download, so you can use this feature to program To FLASH, in order to run offline. The first set EasyJTAG emulator, see Figure 1.24, note ARMcore must select the correct CPU type Number, otherwise may lead to programming errors. Figure 1.24 the FLASH of EasyJTAG download chip set Then chosen to generate the target of the project RelInChip, compiled and linked AXD debugging environment, and then press the F5 key to enter in To load the the debug image file that will download a program to FLASH. In fact, as long as you load the debug image file and code address is set to FLASH address, EasyJTAG Emulator that the program is downloaded to the specified FLASH. ISP download LPC2200 series ARM7 microcontroller chip with ISP (LPC2210 chip FLASH, can not be The ISP programming), you can download the program via the serial port. First, the current project compiled to generate HEX file, open the engineering DebugRel Settings window, in the Target Post-linker is set in the Settings item selected the ARM fromELF (as shown in Figure 1.25). Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
  • 20. http://www.zlgmcu.com 22 Figure 1.25 Set Post-linker In the ARM formELF items set the output file type, such as the Intel 32 bit Hex, and then set the output text The file name can also be specified directory, If you do not specify a directory, the generated files are stored in the directory of the current project (Figure 1.26 Shown). Recompile connection, compiled by that will generate the specified output file. Figure 1.26 generated file set Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 23 Generate the HEX file, then use the serial port extension cord connected to a PC serial port (COM1) and SmartARM2200 Experiment Board (UART0), and experimental board ISP (JP1) jumper shorted. Open LPC2000 Flash Utility software and Set the serial port, baud rate, system crystal (note that the entry unit of the crystal frequency in kHz), as shown in Figure 1.27. After setting parameters, click the Read Device ID button, read the chip ID number, if the read was successful (status bar displays "Read Part ID Successfully! "), Indicates that the ISP connection is successful. Otherwise, when the error message is reset LPC2000 First by SmartARM2200 development board RST key to reset, and then determine the prompt, as shown in Figure 1.28. After a successful connection, first use the Erase button to erase the selected sectors FLASH, then enter the Filename entry Download the HEX file, click Upload to Flash button to start the download process. Cured of the program, the ISP (JP1) Jumper disconnected, reset the system to run the program again. Description LPC2200 series ARM7 microcontrollers to Scale 32-bit data (machine code instruction 0x00000000 ~ 0x0000001c address) accumulation and zero to Kai Activity user program. Retained by setting the data in the exception vector address 0x14 achieve. Figure 1.27 LPC2000 Flash Utility software settings Figure 1.28 Reset LPC2000 Tip 3 run offline � to JP9 jumper selection INSIDE, JP1 disconnection inhibition ISP; JP10 Jumper � be to choose RAM BANK0 address, FLASH BANK1 address; � reset the system, you can start the program in the chip FLASH. 1.6.2 chip FLASH curing EasyJTAG emulator supports specific chip FLASH programming. The user must first address, set the compiler links Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925
  • 21. http://www.zlgmcu.com 24 Code address 0x80000000 address begins LPC2200 special project templates, such as the use of the election in the target system With RelOutChip, scatter-loading description file mem_a.scf such as the list of procedures 1.7 below. , ROM_LOAD the name of the loading area behind the starting address 0x80000000 said loading zone (due to Chip FLASH allocation Bank0); ROM_EXEC described perform the address position defined on the first piece of Starting address of the start address, size and loading area, the size of the space to be consistent from the start address placed to scale (ie Other Startup.o (vectors, + First), which Startup.o target file Startup.s), then place the code (ie * (+ RO)); the the variable area IRAM start address 0x40000000, to be placed Startup.o (MyStacks); stack area STACKS The use of on-chip RAM, ARM stack is generally full descending stack, so the starting address of the stack area is set to 0x40004000, place described as Startup.o (Stacks); the variable area ERAM starting address 0x81000000 (because Chip RAM allocation BANK1), placed outside Startup.o file file variable (ie, * (+ RW, + ZI)); Close to the the ERAM variable area system heap space (HEAP), placed be is described as Startup.o (Heap); List of procedures for curing procedures 1.7 scatter-loading description file mem_a.scf ROM_LOAD 0x80000000 { ROM_EXEC 0x80000000 { Startup.o (vectors, + First) * (+ RO) } IRAM 0x40000000 { Startup.o (MyStacks) } STACKS_BOTTOM +0 UNINIT { Startup.o (StackBottom) } STACKS 0x40004000 UNINIT { Startup.o (Stacks) } ERAM 0x81000000
  • 22. { * (+ RW, + ZI) } HEAP +0 UNINIT { Startup.o (Heap) Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 25 } HEAP_BOTTOM 0x81080000 UNINIT { Startup.o (HeapTop) } } 1. Use the JTAG interface to download JTAG interface to download the program to the chip FLASH JTAG emulator support is needed. EasyJTAG simulator Support of specific chip FLASH download program, so that you can use this feature of the program is downloaded to the chip FLASH In order to run offline. JP10 jumper select Bank0-Flash, Bank1-Ram; Then to set EasyJTAG emulator, see Figure 1.29; Figure 1.29 download chip the FLASH of EasyJTAG set Final selection will generate the target of the project RelOutChip, compiled and linked AXD debug environment, and then press the F5 key to enter Load debug image file that will download the program to the chip FLASH. In fact, as long as you load the debug image file, and the address of the code is set to address chip FLASH The EasyJTAG emulator that the program is downloaded to the specified FLASH. 2 run offline � to select OUTSIDE, JP1 disconnect prohibit ISP JP9 jumper; JP10 jumper � will be select Bank0-Flash, Bank1-Ram; � reset the system, you can start the program in the chip FLASH. Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 26 Chapter 2 Basic Experiment 2.1 External Interrupt Experiment 2 1. Purpose of the experiment (1) The master vector IRQ interrupt settings and applications; (2) to grasp the external interrupt pin feature set and an external interrupt mode is set; 2. Laboratory equipment
  • 23. � Hardware: PC, a SmartARM2200 teaching a set of experimental development platform � software: Windows98/XP/2000 system, ADS 1.2 integrated development environment 3. Experimental content Setting P0.20 feet for EINT3 functions, initialize the interrupt vector, and is set to falling edge trigger mode, and so on Subject to the external interrupt. Interrupt service routine buzzer control output signal is negated, and then clear the interrupt flag and exit the interrupt. 4. Prelab requirements "ARM based embedded system tutorial carefully read Section 5.4.6, external interrupt input instructions, 5.8 vector Interrupt controller instructions. 5. Experimental Procedure (1) Start ADS 1.2, ARM Executable Image for lpc2200 project template to create a project VICVect_C. (2) the preparation of the main program code in a user group's main.c. (3) In subprogram of Startup.s files InitStack, modify the set system mode stack at code "MSR CPSR_c, # 0x5f ", even if the IRQ interrupt. (4) The selection DebugInExram generate the target, and then compile the connection works. (5) the SmartARM2200 teaching experimental development platform JP2, JP4 jumper shorted, JP7 disconnected. JP9 set Set to OUTSIDE, JP10 jumper settings to as Bank0-RAM, Bank1-Flash. (6) Select [Project] -> [Debug] start AXD JTAG emulator debug. (7) to set a breakpoint in the interrupt service routine, run the program at full speed, so EINT3 low / high, that repeatedly press And release under KEY1. (8) Single-step / full-speed running program to observe the program is properly run, whether the beeper beeps. (9) has been the press the KEY1, observe whether it will continue to generate an interrupt. Note: KEY1 operation jitter may cause multiple interrupts. 6. Experimental reference program External interrupt experiment reference program shown in Listing 2.1. Program Listing 2.1 external interrupt experiment reference program / ************************************************* *************************** * File name: main.c Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 27 * Function: using external interrupt 3 B1 control, whenever there is an interruption that negated B1 control port, to indicate the interrupt input. * Vector interrupt, EINT3 the negative edge. * Note: The jumper JP2, JP4 shorted, JP7 disconnect, then repeatedly press release KEY1.
  • 24. ************************************************** ************************** / # Include "config.h" # Define BEEPCON 1 << 7 / / P0.7 pin control B1, low beep, 1 << 7 equivalent to 0x80 / ************************************************* *************************** * Name: IRQ_Eint3 () * Function: external interrupt service function of EINT3, negated B1 control port. The * entrance parameters: no * Export parameters: None ************************************************** ************************** / void __ irq IRQ_Eint3 (void) { uint32 i; i = IO0SET; / / read the current B1 control value if ((i & BEEPCON) == 0) / / to control B1 output negated { IO0SET = BEEPCON; } else { IO0CLR = BEEPCON; } EXTINT = 1 << 3; / / Clear EINT3 interrupt flag 1 << 3 is equivalent to 0x08 VICVectAddr = 0; / / Vectored Interrupt conclude } / ************************************************* *************************** * Name: main () * Function: Initialize external interrupt 3 (EINT3) interrupt vector, and set to a falling edge trigger mode, and then wait for the external interrupt. * Description: make STARTUP.S file the IRQ interrupts (clear I bit in the CPSR). ************************************************** ************************** / int main (void) { PINSEL1 = 3 << 8; / / set pin connection, P0.20 is set to EINT3 / / 3 << 8 is equivalent to 0x00000180 IO0DIR = BEEPCON; / / set B1 control port for output, and other I / O input EXTMODE = 1 << 3; / / set EINT3 interrupt edge-triggered mode / / 1 << 3 is equivalent to 0x08 Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 28 "EXTPOLAR = 0x00; / / setting EINT3 interrupt for falling edge trigger / * Interrupted open EINT3 (set vector controllers that use vector IRQ) * /
  • 25. VICIntSelect = 0x00000000; / / set all interrupt as IRQ interrupt VICVectCntl0 = 0x20 | 17; / / the allocation EINT3 interrupt to vector interrupt 0 / / 0x20 indicates vector IRQ Enable, 1 << 17 EINT3 No. 17 in the VIC channel VICVectAddr0 = (int) IRQ_Eint3; / / set the interrupt service routine address EXTINT = 1 << 3; / / Clearing the EINT3 interrupt flag VICIntEnable = 1 << 17; / / make capable EINT3 interrupt, EINT3 VIC channel on the 17th while (1); / / wait for interrupt return (0); } 7. Think (1) IRQ interrupt the CPSR I bit is 0 or 1? (2) how to properly understand VIC interrupt priority? (3) The experimental the reference program's EINT3 interrupt setting interrupt for Slot10 vector. 2.2 External Memory Interface Experiment 2 1. Purpose of the experiment Experimental control the settings of the external memory controller (EMC), so that the external memory access speed optimization, to improve External program running speed. 2. Laboratory equipment � Hardware: PC, a SmartARM2200 teaching a set of experimental development platform � software: Windows98/XP/2000 system, ADS 1.2 integrated development environment EasyARM software 3. Experimental content Display control program (using software delay), and use the timer 0 external RAM running LED light water measurement per The time required for one cycle, and the timer value (i.e. the program running time) is sent upward through the serial bit machine. Through more Change EMC storage group configuration, control external RAM access speed, and then observe the running speed of the program. 4. Prelab requirements (1) Carefully read the description of the external memory controller, ARM Embedded Systems Essentials 5.6. (2) Carefully read the contents of Chapter 1 of the book to understand the hardware structure of SmartARM2200 teaching experimental development platform Note that the system memory circuit. Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 29 5. Experimental Procedure (1) Start ADS 1.2, ARM Executable Image for lpc2200 project template to create a project Speed_C.
  • 26. (2) to write the main program code main.c user group, joined the project in config.h file # include <stdio.h>. (3) in the file ResetInit subroutine Startup.s observed the BCFG0 and BCFG1 register setting value, The external memory interface known engineering template default configuration for the slowest speed. (4) The selection DebugInExram generate the target, and then compile the connection works. (5) the SmartARM2200 teaching experimental development platform jumper JP12 shorted. JP9 set to OUTSIDE, JP10 jumper settings to as Bank0-RAM, Bank1-Flash. (6) using the serial port extension cord CZ2 (UART0), SmartARM2200 teaching experimental development platform and PC COM1 connection. PC the machine running EasyARM software, set the serial port is COM1, baud rate of 115200, and then select the [Settings] -> [sending data】, in the pop-up window to send data, click on the "Advanced" to open the receive window. (7) Select [Project] -> [Debug] start AXD JTAG emulator debug. (8) at full speed to run the program, the show's running time in the observation the light water change speed and EasyARM of software Value. (9) Stop to JTAG emulator debugging, Close AXD software. Subfunctions of Startup.s files ResetInit weight The speed of the new configuration Bank0 access, see Listing 2.2. Note: If you enter AXD software is unsuccessful, check whether BCFG0, and BCFG1 parameters to set the bus too fast. Reconfigure the access speed of the memory interface 2.2 in the program list ResetInit ; Initial extenal bus controller. ; The initialization external bus controller, configured according to the target board decided LDR R0, = PINSEL2 IF: DEF: EN_CRP LDR R1, = 0x0f814910 ELSE LDR R1, = 0x0f814914 ENDIF STR R1, [R0] LDR R0, = BCFG0 LDR R1, = 0x1000ffef; the slowest operating parameters of the 16-bit bus STR R1, [R0] .... (10) to recompile the connection works again Kai AXD JTAG emulator debug. (11) full-speed run the program, the show's running time in the observation the light water change speed and EasyARM of software Value.
  • 27. Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 30 6. Experimental reference program External memory interface experiment reference program shown in Listing 2.3. Listing 2.3 External Memory Interface Experiment 2 reference / ************************************************* *************************** * File name: main.c * Function: through I / O control LED1 ~ LED4, the effect of a flowing light, and measuring program running time, * Run-time values and then send to UART0. * Description: jumper JP12 shorted * Communications 115200 baud, 8 data bits, 1 stop bit, no parity. * Please Modify BCFG0 values to achieve the purpose of the test, pay attention to the limits of the parameters of PSRAM otherwise might debugging failed ************************************************** ************************** / # Include "config.h" # Define LEDCON 0xf0000000 # Define UART_BPS 115200 / / Define communication baud rate const uint32 DISP_TAB [8] = {0x1fffffff, 0x2fffffff, 0x4fffffff, 0x8fffffff, 0xffffffff, 0x0fffffff, 0xffffffff, 0x0fffffff}; / ************************************************* *************************** * Name: DelayNS () * Function: long software delay * Entry parameters: dly delay parameter, larger the value, the longer the delay * Export parameters: None ************************************************** ************************** / void DelayNS (uint32 dly) {Uint32 i; for (; dly> 0; dly -) { for (i = 0; i <5000; i + +); } } / ************************************************* *************************** * Name: UART0_Ini () * Function: initialize the serial port 0. Is set to 8 data bits, 1 stop bit, no parity, baud rate is 115200 The * entrance parameters: no * Export parameters: None ************************************************** ************************** / void UART0_Init (void) {Uint16 Fdiv; Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 31
  • 28. U0LCR = 0x83; / / DLAB = 1, set the baud rate Fdiv = (Fpclk / 16) / UART_BPS; / / set the baud rate U0DLM = Fdiv / 256; U0DLL = Fdiv% 256; U0LCR = 0x03; } / ************************************************* *************************** * Name: UART0_SendByte () * Function: send a byte of data to the serial port and waiting to be sent finished. * Entry parameters: data data to be sent * Export parameters: None ************************************************** ************************** / void UART0_SendByte (uint8 data) { U0THR = data; / / send data while ((U0LSR & 0x40) == 0); / / wait until the data has been sent } / ************************************************* *************************** * Name: UART0_SendStr () * Function: send a string to the serial port * Entrance parameters: srt To send a string pointer * Export parameters: None ************************************************** ************************** / void UART0_SendStr (uint8 const * str) { while (1) { if (* str == ' 0') break; UART0_SendByte (* str + +); / / send data } } / ************************************************* *************************** * Name: main () * Functions: According to table DISP_TAB to control the LED display. ************************************************** ************************** / int main (void) {Uint8 i; char disp_buf [30]; PINSEL0 = 0x00000005; / / set the I / O connected to UART0 UART0_Init (); Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 32 / * PINSEL2 startup code default configuration, Never any configuration PINSEL2, otherwise the bus will be disturbed * / IO2DIR = LEDCON;
  • 29. T0PR = 0; while (1) { T0TC = 0; T0TCR = 0x01; for (i = 0; i <8; i + +) { IO2SET = DISP_TAB [i]; / / output LED display data DelayNS (10); / / delay IO2CLR = 0xffffffff; } T0TCR = 0x00; sprintf (disp_buf, "Run time is:% d r n", (uint32) T0TC); UART0_SendStr ((uint8 *) disp_buf); } return (0); } 7. Think (1) In addition to the EMC configuration, which system settings will affect the external program access speed? (2) If the program is on-chip FLASH run, running speed will be raised? Why? 2.3 Timer Experiment 2 1. Purpose of the experiment Familiar with the basic settings and the timing of the LPC2000 series ARM7 microcontroller timer 0 interrupt. 2. Laboratory equipment � Hardware: PC, a SmartARM2200 teaching a set of experimental development platform � software: Windows98/XP/2000 system, ADS 1.2 integrated development environment 3. Experimental content Using timer 0 1 second timing, control the buzzer to buzzer. Using interrupt timing control. 4. Prelab requirements Carefully read the description of the ARM-based embedded system tutorial 5.14 Timer 0 and Timer 1, 5.8 Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 33 Section vectored interrupt controller's instructions. 5. Experimental Procedure (1) Start ADS 1.2, ARM Executable Image for lpc2200 project template to create a project TimeOut_C. (2) the preparation of the main program code in a user group's main.c. (3) In subprogram of Startup.s files InitStack, the code to modify the set system mode stack at MSR CPSR_c, # 0x5f, even if IRQ interrupts. (4) The selection DebugInExram generate the target, and then compile the connection works.
  • 30. (5) development platform SmartARM2200 teaching experiment JP4 jumper shorted, JP7 jumper disconnected. JP9 set OUTSIDE, JP10 jumper settings Bank0-RAM, Bank1-Flash. (6) Select [Project] -> [Debug] start AXD JTAG emulator debug. (6) can be run at full speed program, the buzzer will ring for one second, stop one second, and then loud one second ... turn cycle. 6. Experimental reference program Timer experimental reference program shown in Listing 2.4. The program list 2.4 timer Experiment 2 reference program / ************************************************* *************************** * File name: main.c * Function: Timer 0 1 second timing to control the buzzer beeps. (Interrupt) * Note: JP4 jumper shorted, JP7 jumper disconnected. ************************************************** ************************** / # Include "config.h" # Define BEEPCON 1 << 7 / / P0.7 pin control B1, low level beep / ************************************************* *************************** * Name: IRQ_Time0 () * Function: Timer 0 interrupt service routine, negated BEEPCON control port. The * entrance parameters: no * Export parameters: None ************************************************** ************************** / void __ irq IRQ_Time0 (void) { if ((IO0SET & BEEPCON) == 0) { IO0SET = BEEPCON; } else { IO0CLR = BEEPCON; } Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 34 T0IR = 0x01; / / clear the interrupt flag VICVectAddr = 0x00; / / notice VIC interrupt processing is completed } / ************************************************* *************************** * Name: Time0Init () * Function: Initialize timer 0, timer time 1S, and enable the interrupt. The * entrance parameters: no * Export parameters: None ************************************************** ************************** / void Time0Init (void) {/ * Fcclk = Fosc * 4 = 11.0592MHz * 4 = 44.2368MHz
  • 31. Fpclk = Fcclk / 4 = 44.2368MHz / 4 = 11.0592MHz * / T0PR = 99; / / set timer 0 frequency of 100 divided too 110592Hz T0MCR = 0x03; / / match channel 0 match interrupt and reset T0TC T0MR0 = 110592; / / comparison value (1S-time value) T0TCR = 0x03; / / start and reset T0TC of T0TCR = 0x01; / * Set the timer 0 interrupt IRQ * / VICIntSelect = 0x00; / / all interrupt channel is set to IRQ interrupts VICVectCntl0 = 0x24; / / Timer 0 interrupt the channel assigned highest priority (vector controller 0) VICVectAddr0 = (uint32) IRQ_Time0; / / set interrupt service routine address vector VICIntEnable = 0x00000010; / / enable timer 0 interrupt } / ************************************************* *************************** * Name: main () * Function: Initialize I / O and timer, and then wait for the interrupt. * Description: make STARTUP.S file the IRQ interrupts (clear I bit in the CPSR). ************************************************** ************************** / int main (void) { PINSEL0 = 0x00000000; / / set pin connected to GPIO IO0DIR = BEEPCON; / / set I / O output Time0Init (); / / initialize the timer 0 and enable interrupts while (1); / / wait for the timer 0 interrupt or timer 1 match output return (0); } 7. Think (1) using the Timer 0 and Timer 1 timer interrupt to control the buzzer (to achieve sound 0.5 seconds, 0.5 seconds off), two fixed Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 35 The timer are 1S timing control buzzer beeps when the timer 0 interrupt, Timer 1 interrupt control buzzer stop Please knitting Write programs. (Hint: Timer 0 start 0.5S, and then immediately start the timer) 2.4 UART Experiment 2 1. Purpose of the experiment Through experiments, the master the UART interrupt program design, and be able to understand the function of the transmit FIFO and receive FIFO. 2. Laboratory equipment � Hardware: PC, a SmartARM2200 teaching a set of experimental development platform � software: Windows98/XP/2000 system, ADS 1.2 integrated development environment EasyARM software 3. Experimental content
  • 32. Host computer using the serial port UART0 receive data sent and received eight consecutive data will receive the count is incremented. 1 and outputs LED1 ~ LED4 intact, then the received data is sent back to the host computer. Enable the UART0 FIFO for data transmission / reception, the receiver uses the interrupt handling. UART0 communication baud rate is set to 115200, Data bits, 1 stop bit, no parity. 4. Prelab requirements (1) "ARM based embedded system tutorial 5.10 UART0 description carefully read, pay attention to the FIFO then Closing the case characteristics. (2) Carefully read the contents of Chapter 1 of the book to understand the hardware structure of SmartARM2200 teaching experimental development platform Note that the serial part of the circuit. (3) Carefully read the the SP3232E chip data sheet to understand the role and application of this chip circuit design. 5. Experimental Procedure (1) Start ADS 1.2, ARM Executable Image for lpc2200 project template to create a project DataRet_C. (2) to write the main program code main.c user group, joined the project in config.h file # include <stdio.h>. (3) In subprogram of Startup.s files InitStack, modify the set system mode stack at code "MSR CPSR_c, # 0x5f ", even if the IRQ interrupt. (4) The selection DebugInExram generate the target, and then compile the connection works. (5) experimental development platform of SmartARM2200 teaching JP12 jumper shorted. JP9 set to OUTSIDE, JP10 jumper settings to as Bank0-RAM, Bank1-Flash. (6) using the serial port extension cord CZ2 (UART0), SmartARM2200 teaching experimental development platform and PC COM1 connection. PC the machine running EasyARM software, set the serial port is COM1, baud rate of 115200, and then select the [Settings] -> [sending data】, in the pop-up window to send data, click on the "Advanced" to open the receive window. (7) Select [Project] -> [Debug] start AXD JTAG emulator debug. (8) at full speed to run the program on the PC EasyARM software sends 8 bytes of data, LPC2210 received several According to the control board after LED1 ~ LED4 display, and stores the received data back to the PC. Result of the program such as Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 36 Shown in Figure 2.1. Note 8-byte data must be continuously transmitted. Figure 2.1 UART experimental run results 6. Experimental reference program UART experiment reference program shown in Listing 2.5.
  • 33. Program Listing 2.5 UART Experiment 2 reference / ************************************************* *************************** * File name: main.c * Function: use the serial port UART0 PC to receive the data sent, received eight consecutive data, will receive the count is incremented after transfusion The * out LED1 - LED4 display, and data to be sent back to the host computer. * Description: jumper JP12 shorted. * Communications 115200 baud, 8 data bits, 1 stop bit, no parity. * Interrupt service routine does not respond to single-byte send the total to 8 Bytes, a PC must be sent continuously 8 Bytes. ************************************************** ************************** / # Include "config.h" # Define LEDCON 0xf0000000 / * Define serial mode set data structure * / typedef struct UartMode {Uint8 datab; / / word length, 5/6/7/8 uint8 stopb; / / stop bit, 1/2 Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 37 uint8 parity; / / parity bit, no parity, 1 odd parity, 2 for even parity } UARTMODE; uint8 rcv_buf [8]; / / UART0 receive buffer volatile uint8 rcv_new; / / receive new data flag / ************************************************* *************************** * Name: IRQ_UART0 () * Function: serial port UART0 receive interrupt. The * entrance parameters: no * Export parameters: None ************************************************** ************************** / void __ irq IRQ_UART0 (void) {Uint8 i; if (0x04 == (U0IIR & 0x0F)) rcv_new = 1; / / set to receive new data flag for (i = 0; i <8; i + +) { rcv_buf [i] = U0RBR; / / read FIFO data, and clear the interrupt flag } VICVectAddr = 0x00; / / end of interrupt handling } / ************************************************* *************************** * Name: SendByte () * Function: send a byte of data to the serial port UART0. * Entry parameters: data data to be sent * Export parameters: None ************************************************** ************************** / void SendByte (uint8 data)
  • 34. { U0THR = data; / / send data } / ************************************************* *************************** * Name: ISendBuf () * Function: buffer data sent back to the host (using FIFO) and the wait has been sent. The * entrance parameters: no * Export parameters: None ************************************************** ************************** / void ISendBuf (void) {Uint8 i; for (i = 0; i <8; i + +) SendByte (rcv_buf [i]); Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 38 while ((U0LSR & 0x20) == 0); / / wait for data transmission } / ************************************************* *************************** * Name: UART0_Init () * Function: initialize the serial port 0. Set the work mode and baud rate. * Entrance parameters: baud baud rate * Set mode the set (UARTMODE data structure) * Export parameters: return value of 1 indicates the beginning of the successful, 0 table parameter error ************************************************** ************************** / uint8 UART0_Init (uint32 baud, UARTMODE set) {Uint32 bak; / * The filtering parameters * / if ((0 == baud) | | (baud> 115200)) { return (0); } if ((set.datab <5) | | (set.datab> 8)) { return (0); } if ((0 == set.stopb) | | (set.stopb> 2)) { return (0); } if (set.parity> 4) { return (0); } / * Set the serial port baud rate * / U0LCR = 0x80; / / when DLAB position
  • 35. bak = (Fpclk >> 4) / baud; U0DLM = bak >> 8; U0DLL = bak &0xff; / * Set serial mode * / bak = set.datab-5; / / Set the word length if (2 == set.stopb) { bak | = 0x04; / / determine whether two stop bits } if (0! = set.parity) Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 39 { set.parity = set.parity-1; bak | = 0x08; } bak | = set.parity << 4; / / set the parity U0LCR = bak; return (1); } / ************************************************* *************************** * Name: main () * Function: initialize the serial port, and waiting to receive the serial data. * Description: make STARTUP.S file the IRQ interrupts (clear I bit in the CPSR). ************************************************** ************************** / int main (void) {Uint8 rcv_counter; UARTMODE uart0_set; PINSEL0 = 0x00000005; / / set the I / O connected to UART0 IO2DIR = LEDCON; / / set the I / O connection LED output rcv_new = 0; / / received flag 0 uart0_set.datab = 8; / / 8 data bits uart0_set.stopb = 1; / / 1 stop bit uart0_set.parity = 0; / / no parity UART0_Init (115200, uart0_set); / / initialize serial mode U0FCR = 0x81; / / enable FIFO, and set the trigger point for 8 bytes U0IER = 0x01; / / allow RBR interrupt, that receive interrupt / * Set interrupt enable * / VICIntSelect = 0x00000000; / / set all channels for the IRQ interrupt VICVectCntl0 = 0x26; / / UART0 interrupt channel assigned to IRQ slot 0, the highest priority VICVectAddr0 = (int) IRQ_UART0; / / set UART0 vector address VICIntEnable = 0x00000040; / / Enable UART0 interrupt rcv_counter = 0; IO2SET = 0xffffffff;
  • 36. while (1) / / wait for interrupt { if (1 == rcv_new) / / has received 8 Bytes of data { rcv_new = 0; / / clear the flag Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 40 ISendBuf (); / / the received data is sent back to the host IO2SET = 0xffffffff; / / LED lamp reset IO2CLR = (rcv_counter << 28); / / count value in binary display via LED rcv_counter + +; / / receives the count value plus one } } return (0); } 7. Think (1) Why must send 8-byte data continuously? (Hint: Note the hardware FIFO receive mode) (2) If the character timeout interrupt what should read the received data? (Tip: U0LSR, Send RDR bit register to determine whether there are unread data) (3) If a byte of data received each receive interrupt is generated, how to design the program? 2.5 I2C Interface Experiment 2 1. Purpose of the experiment (1) to master the use of the LPC2000 series ARM7 microcontroller hardware I2C interface. (2) the use of of ZLG7290 keyboard. 2. Laboratory equipment � Hardware: PC, a SmartARM2200 teaching a set of experimental development platform � software: Windows98/XP/2000 system, ADS 1.2 integrated development environment EasyARM software 3. Experimental content Use main mode I2C operation ZLG7290, receive keyboard input, according to the key value in the serial print mentioning Shown to the PC. 4. Prelab requirements (1) Carefully read the instructions in Section 5.12 of the ARM-based embedded system tutorial section I2C interface. (2) Carefully read the contents of Chapter 1 of the book to understand the hardware structure of SmartARM2200 teaching experimental development platform Note that part of the circuit of the keyboard. (3) carefully read ZLG7290 datasheets, understand this chip circuit design. 5. Experimental Procedure (1) Start ADS 1.2, ARM Executable Image for lpc2200 project template to create a project I2cInt_c. (2) main.c user group to write the main program code, and then the zlg7290.c, zlg7290.h and I2cInt.c
  • 37. The I2cInt.h Add to the engineering of the user group, added in the project file config.h "# include" I2CINT.H "" Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 41 And "# include" ZLG7290.H "". (3) In subprogram of Startup.s files InitStack, modify the set system mode stack at code "MSR CPSR_c, # 0x5f ", even if the IRQ interrupt. (4) The selection DebugInExram generate the target, and then compile the connection works. (5) the development platform SmartARM2200 teaching experiment JP6 jumper all shorted. JP9 set to OUTSIDE, JP10 jumper settings to as Bank0-RAM, Bank1-Flash. (6) Select [Project] -> [Debug] start AXD JTAG emulator debug. (7) using the serial port extension cord CZ2 (UART0), SmartARM2200 teaching experimental development platform and PC COM1 connection. PC the machine running EasyARM software, set the serial port is COM1, baud rate of 115200, and then select the [Settings] -> [sending data】, in the pop-up window to send data, click on the "Advanced" to open the receive window. (8) run the program at full speed, LPC2210 through I2C interface control ZLG7290. S1 ~ S16 keys, receiver window The port can be related tips. 6. Experimental reference program I2C interface experiment reference program shown in Listing 2.6. The which ZLG7290 the control interface functions stored in zlg7290.c File, I2C interface function and interrupt handler I2cInt.c file (file code, see the product CD- ROM). Experiment 2 reference program Listing 2.6 I2C interface / ************************************************* *************************** * File name: main.c * Function: Use hardware I2C ZLG7290 operation, interrupt operation. * Description: jumper JP6 shorted. * Main program do not do image stabilization processing ************************************************** ************************** / # Include "config.h" # Define ZLG7290 0x70 / / define the device address / ************************************************* *************************** * Name: UART0_Init () * Function: initialize the serial port 0. Is set to 8 data bits, 1 stop bit, no parity The * entrance parameters: no * Export parameters: None ************************************************** ************************** / void UART0_Init (uint32 bps) {Uint16 Fdiv; PINSEL0 = (PINSEL0 & (~ 0x0F)) | 0x05; / / does not affect the other pins are connected, set the I / O connected to UART0
  • 38. U0LCR = 0x83; / / DLAB = 1, set the baud rate Fdiv = (Fpclk / 16) / bps; / / set the baud rate U0DLM = Fdiv / 256; U0DLL = Fdiv% 256; U0LCR = 0x03; } Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 42 / ************************************************* *************************** * Name: UART0_SendByte () * Function: send a byte of data to the serial port and waiting to be sent finished. * Entry parameters: data data to be sent * Export parameters: None ************************************************** ************************** / void UART0_SendByte (uint8 data) { U0THR = data; / / send data while ((U0LSR & 0x40) == 0); / / wait until the data has been sent } / ************************************************* *************************** * Name: UART0_SendStr () * Function: send a string to the serial port * Entrance parameters: srt To send a string pointer * Export parameters: None ************************************************** ************************** / void UART0_SendStr (char * str) { while (1) { if (* str == ' 0') break; UART0_SendByte (* str + +); / / send data } } / ************************************************* *************************** * Name: I2C_Init () * Function: main mode I2C initialization, including initialization its interrupt is vectored IRQ interrupts. * Entry parameters the: fi2c initialize I2C bus speed, a maximum of 400K * Export parameters: None ************************************************** ************************** / void I2C_Init (uint32 fi2c) { if (fi2c> 400000) fi2c = 400000; PINSEL0 = (PINSEL0 & (~ 0xF0)) | 0x50; / / does not affect the other pins are connected, set the I / O connected to the I2C
  • 39. I2SCLH = (Fpclk/fi2c + 1) / 2; / / set I2C clock for fi2c I2SCLL = (Fpclk/fi2c) / 2; I2CONCLR = 0x2C; I2CONSET = 0x40; / / enable master I2C / * Set I2C interrupt enable * / Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 43 VICIntSelect = 0x00000000; / / set all channels for the IRQ interrupt VICVectCntl0 = 0x29; / / I2C channel assigned to IRQ slot 0, ie the highest priority VICVectAddr0 = (int) IRQ_I2C; / / set I2C interrupt vector address VICIntEnable = 0x0200; / / Enable I2C interrupt } / ************************************************* *************************** * Name: DelayNS () * Function: long software delay * Entry parameters: dly delay parameter, larger the value, the longer the delay * Export parameters: None ************************************************** ************************** / void DelayNS (uint32 dly) {Uint32 i; for (; dly> 0; dly -) { for (i = 0; i <5000; i + +); } } / ************************************************* *************************** * Name: main () * Function: ZLG7290 operate * Description: make STARTUP.S file the IRQ interrupts (clear I bit in the CPSR); * Included in the CONFIG.H files I2CINT.H, ZLG7290.H. ************************************************** ************************** / int main (void) {Uint8 key_buf [8]; char disp_buf [32]; uint8 key; I2C_Init (30000); / / I2C configuration initialization UART0_Init (115200); / / UART0 configuration initialization sprintf (disp_buf, " r nKey testing! r n"); UART0_SendStr (disp_buf); / * Read the key results through a the UART0 distributed PC * / while (1) { DelayNS (5); key = 0; IRcvStr (ZLG7290, 0x01, key_buf, 8);
  • 40. Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 44 if (0 == key_buf [1]) / / validity keystrokes { key = key_buf [0]; / / obtain key } sprintf (disp_buf, "This is key% d! r n", key); UART0_SendStr (disp_buf); } return (0); } 7. Think (1) To improve the speed of the I2C bus, the bus pull-up resistor to increase or to reduce? (2) If the primary function button dithering process, and how to achieve? 2.6 SPI interface experiments (elected to do) 1. Purpose of the experiment Through experiments, the master SPI interface initialization and data input / output control. 2. Laboratory equipment � Hardware: PC, a SmartARM2200 teaching a set of experimental development platform Bring your own LED display SPI interface board is a � software: Windows98/XP/2000 system, ADS 1.2 integrated development environment 3. Experimental content Use hardware SPI interface to connect with the 74HC595, control 74HC595 driven a digital display. 4. Prelab requirements (1) Carefully read the instructions in Section 5.13 of the ARM-based embedded system tutorial section SPI interface. (2) Carefully read the contents of Chapter 1 of the book to understand the hardware structure of SmartARM2200 teaching experimental development platform Identify SPI1 cited export. (3) Carefully read the the 74HC595 data manual to understand how to control the data shift, latch data output. 5. Experimental principle (1) shown in Figure 2.2, SmartARM2210 provides a GPIO connector the SPI1 signal from J5 cited Out to the sub-panel. Note the P.20 (SSLE1) must be pulled up to the high level (3.3V), otherwise SPI1 not work. P0.25_RD1 TD1 P0.29_MAT0.3 P0.24_TD2 P0.17_CAP1.2 P0.18_CAP1.3 P0.19_MAT1.2 P0.20_EINT3 P0.23_RD2 1 2
  • 41. 3 4 56 78 9 10 11 12 13 14 15 16 17 18 19 20 J5 P2.16 P2.18 P2.20 P2.22 P2.17 P2.19 P2.21 P2.23 GND +5 V VDD3.3 P.20 - SSEL1 (3.3V P.19 - MOSI1 P.18 - MISO1 P.17 - SCK1 VDD3.3 R 10K Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 45 The 2.2 SmartARM2210 connector J5 (2) the user can prepare an SPI interface daughter board for LED experiment according to the schematic. Through the SPI interface and The LPC2210 phase connection, as shown in Figure 2.3. 1 QB 2 QC 3 QD 4 QE 5 QF 6 QG 7 QH GND 8 SQH 9 SCLR 10
  • 42. SCK 11 RCK 12 OE 13 SI 14 15 QA VCC 16 U11 74HC595 VDD3.3 nCS MOSI1 SCK1 MISO1 QA QB QC QD QE QF QG QH 470 x 8 R34 - R41 QD QA QB QC QE QF QG QH 12345 6789 10 LED LN3161BS VDD3.3 VDD3.3 P0.19 P0.25 P0.17 P0.18 LPC2210 Figure 2.3 LED display SPI interface board 6. Experimental Procedure
  • 43. (1) Start ADS 1.2, ARM Executable Image for lpc2200 project template to create a project SPIDisp_C. (2) the preparation of the main program code in a user group's main.c. (3) selection of DebugInExram generate the target, and then compile the connection works. (4) using the DuPont line on the J5 SmartARM2200 teaching experiment development platform SPI1 signals and LED daughter board The SPI The interface is connected to 3.3V power supply to the sub-board power supply teaching experimental development platform. (5) Select [Project] -> [Debug] start AXD JTAG emulator debug. (6) full speed to run the program, the observed changes in the LED display. 7. Experimental reference program SPI interface experiment reference program shown in Listing 2.7. Program listing 2.7 SPI interface experiment reference program / ************************************************* *************************** * File name: main.c * Function: use hardware SPI interface output control LED display. (Hardware: 74HC595 output control LED display) * Note: on the J5 SmartARM2200 teaching experiment development platform SPI1 signals and LED daughter board SPI interface ************************************************** ************************** / # Include "config.h" # Define HC595_CS 1 << 25 / / P0.25 chip select lines uint8 const DISP_TAB [16] = {/ / 0 1 2 3 4 5 6 7 8 9 0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8, 0x80, 0x90, / / A b C d E F 0x88, 0x83, 0xC6, 0xA1, 0x86, 0x8E}; uint8 rcv_data; / ************************************************* *************************** * Name: DelayNS () Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 46 * Function: long software delay * Entry parameters: dly delay parameter, larger the value, the longer the delay * Export parameters: None ************************************************** ************************** / void DelayNS (uint32 dly) { uint32 i; for (; dly> 0; dly -) {
  • 44. for (i = 0; i <5000; i + +); } } / ************************************************* *************************** * Name: MSpiInit () * Function: initializing the SPI interface, is set to host. The * entrance parameters: no * Export parameters: None ************************************************** ************************** / void MSpiInit (void) { PINSEL1 = (PINSEL1 & ~ 0x3fc) | 0x2a8; S1PCCR = 0x52; / / set the SPI clock divider S1PCR = (0 << 3) | / / CPHA = 0, the data in the first SCK a clock edge sampling (1 << 4) | / / CPOL = 1, SCK is active low (1 << 5) | / / MSTR = 1, SPI in master mode (0 << 6) | / / LSBF = 0, the SPI data transfer MSB of the (7) prior (0 << 7); / / SPIE = 0, SPI interrupts are disabled } / ************************************************* *************************** * Name: MSendData () * Function: send data to the SPI bus, and receives the data sent back from the machine. * Data the entrance parameters: data to be sent * Export parameters: returns the value of the received data ************************************************** ************************** / uint8 MSendData (uint8 data) { IO0CLR = HC595_CS; / / Chip Select S1PDR = data; while (0 == (S1PSR & 0x80)); / / wait for SPIF is set, that is waiting for data has been sent IO0SET = HC595_CS; return (S1PDR); } Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 47 / ************************************************* *************************** * Name: main () * Function: use the hardware SPI Interface the output DISP_TAB array data, control the LED display. ************************************************** ************************** / int main (void) {Uint8 i;
  • 45. IO0DIR = HC595_CS; MSpiInit (); / / initialize SPI interface while (1) { for (i = 0; i <16; i + +) { rcv_data = MSendData (DISP_TAB [i]); / / send display data DelayNS (10); } } return (0); } 8. Think (1) using the SPI interface to read the data from the machine, the host why send data? (2) Let SPCR register CPOL = 1, CPHA = 1, how the SPI data transfer formats? 2.7 RTC Experiment 2 1. Purpose of the experiment Mastering the RTC points in different system clock frequency set master RTC date and time value set and read. 2. Laboratory equipment � Hardware: PC, a SmartARM2200 teaching a set of experimental development platform � software: Windows98/XP/2000 system, ADS 1.2 integrated development environment EasyARM software 3. Experimental content Initialize and run the RTC, and then every 1 second read time value, and send through the serial the upward-bit machine, Bit using EasyARM software simulation calendar window for display. 4. Prelab requirements (1) Carefully read the "ARM based embedded system tutorial 5.17 real-time clock (RTC) instructions. Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 48 (2) Appendix A to read this book carefully EasyARM software instructions for use, pay attention to the communication part of the agreement. 5. Experimental Procedure (1) Start ADS 1.2, ARM Executable Image for lpc2200 project template to create a project disptimer2. (2) the preparation of the main program code in a user group's main.c. (3) selection of DebugInExram generate the target, and then compile the connection works. (4) the SmartARM2200 teaching experimental development platform JP9 set to OUTSIDE, JP10 jumper settings
  • 46. For Bank0-RAM Bank1-Flash. (5) using the serial port extension cord CZ2 (UART0), SmartARM2200 teaching experimental development platform and the PC's COM1 connection. PC the machine running EasyARM software, set the serial port is COM1, baud rate of 115200, and then select the [Function] -> [calendar, open emulation calendar window. (6) Select [Project] -> [Debug] start AXD JTAG emulator debug. (7) at full speed to run the program, the PC on EasyARM software will continue to display the time value of the RTC. 6. Experimental reference program RTC experiment reference program shown in Listing 2.8. Program in Listing 2.8 RTC Experiment 2 reference / ************************************************* *************************** * File name: main.c * Function: run RTC timing, and the time value constantly sent through the serial the upward-bit machine. The use EasyARM of the host computer * Software, the results observed in the simulation of the calendar display. * Communications 115200 baud, 8 data bits, 1 stop bit, no parity. * Description: ************************************************** ************************** / # Include "config.h" uint8 const SHOWTABLE [10] = {0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F}; / ************************************************* *************************** * Name: UART0Init () * Function: initialize the serial port 0. Is set to 8 data bits, 1 stop bit, no parity * Entrance parameter: bps communication baud rate * Export parameters: None ************************************************** ************************** / void UART0Init (uint32 bps) { uint16 Fdiv; PINSEL0 = (PINSEL0 & (~ 0x0F)) | 0x05; / / does not affect the other pins are connected, set the I / O connected to UART0 U0LCR = 0x83; / / DLAB = 1, set the baud rate Fdiv = (Fpclk / 16) / bps; / / set the baud rate U0DLM = Fdiv / 256; U0DLL = Fdiv% 256; U0LCR = 0x03; Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 49 }
  • 47. / ************************************************* *************************** * Name: UART0SendByte () * Function: send a byte of data to the serial port and waiting to be sent finished. * Entry parameters: data data to be sent * Export parameters: None ************************************************** ************************** / void UART0SendByte (uint8 data) { U0THR = data; / / send data while ((U0LSR & 0x40) == 0); / / wait until the data has been sent } / ************************************************* *************************** * Name: PC_DispChar () * Function: sent to PC display characters. * Entrance parameters: no display position * Chr displayed character, not to 0xff * Export parameters: None ************************************************** ************************** / void PC_DispChar (uint8 no, uint8 chr) { UART0SendByte (0xff); UART0SendByte (0x81); UART0SendByte (no); UART0SendByte (chr); UART0SendByte (0x00); } / ************************************************* *************************** * Name: SendTimeRtc () * Function: read the RTC time value, and read out the hour, minute, and second values sent by the serial port to the PC. The * entrance parameters: no * Export parameters: None ************************************************** ************************** / void SendTimeRtc (void) {Uint32 datas; uint32 times; uint32 bak; times = CTIME0; / / read the complete clock register datas = CTIME1; Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 50
  • 48. bak = (datas >> 16) &0xFFF; / / obtain annual value PC_DispChar (0, SHOWTABLE [bak/1000]); bak = bak% 1000; PC_DispChar (1, SHOWTABLE [bak/100]); bak = bak% 100; PC_DispChar (2, SHOWTABLE [bak/10]); PC_DispChar (3, SHOWTABLE [bak% 10]); bak = (datas >> 8) &0x0F; / / get month value PC_DispChar (4, SHOWTABLE [bak/10]); PC_DispChar (5, SHOWTABLE [bak% 10]); bak = datas &0x1F; / / obtain date values PC_DispChar (6, SHOWTABLE [bak/10]); PC_DispChar (7, SHOWTABLE [bak% 10]); bak = (times >> 24) &0x07; / / get day of the week PC_DispChar (8, SHOWTABLE [bak]); bak = (times >> 16) &0x1F; / / obtain value PC_DispChar (9, SHOWTABLE [bak/10]); PC_DispChar (10, SHOWTABLE [bak% 10]); bak = (times >> 8) &0x3F; / / obtain the value of sub- PC_DispChar (11, SHOWTABLE [bak/10]); PC_DispChar (12, SHOWTABLE [bak% 10]); bak = times &0x3F; / / get second value PC_DispChar (13, SHOWTABLE [bak/10]); PC_DispChar (14, SHOWTABLE [bak% 10]); } / ************************************************* *************************** * Name: RTCInit () * Function: Initialize the real-time clock. The * entrance parameters: no * Export parameters: None ************************************************** ************************** / void RTCInit (void) { PREINT = Fpclk / 32768 - 1; / / set the reference clock divider PREFRAC = Fpclk - (Fpclk / 32768) * 32768; YEAR = 2005; / / initial of years MONTH = 5; / / early of January Luminary Micro Development Co., Ltd. Tel: (020) 38,730,976 38,730,977 Fax: 38,730,925 http://www.zlgmcu.com 51 DOM = 01; / / early of the day HOUR = 8;