close

Вход

Забыли?

вход по аккаунту

?

TUTORIAL How to download and verify the code in 68HC12 By

код для вставки
TUTORIAL
How to download and verify the code in 68HC12 By using MiniIDE
1. Create a Folder on the hard drive named it 68HC12. We will use this folder to save our codes
and other related programs and files
2. You can download the program from the following link. It is free.
www.mgtek.com/miniide and select the SAVE option and select the 68HC12 Folder .
3. The self extracting program have this ICON
Miniide.msi
Double Click on the Icon the Installation will started. Once the program installed place the
shortcut on the DESKTOP for frequent use.
The ICON on the Program is like one shown
Miniide.lnk
4. Use NOTEPAD to write your program
( Windows XP >> Start >> Programs >> Accessories >> Notepad)
Prepared By:
Turab Talib , Lab. Instructor
1
5. Typed the following TEST program in the Notepad and SAVE AS test.asm in the 68HC12
folder. You must typed the extension i.e. asm
PROGRAM
org
start: equ
ldaa
ldab
aba
bra
$800
*
#$4
#$5
;(RAM start location
for user program)
; Start the program from the beginning)
; # represent immediate,
$ represent Hex
; Add b to a then store
result in a
; Branch to the beginning of program
*
end
6. To connect the uC with your computer, use BD9 cable (female end goes in the COM1 or
COM2 port of your computer and other end with male DB9 connector in the Hardware ( UC
Board).
Prepared By:
Turab Talib , Lab. Instructor
2
7. Apply 5V DC to the uC Positive lead is toward the BD 9 connector.
9.Fire MiniIDE program from the DeskTop
Miniide.lnk
7.
8. Press File from the tool bar, select your file i.e. test.asm, DO Not forget to type .asm
Prepared By:
Turab Talib , Lab. Instructor
3
The file will appear on the Top position of the MiniIDE.
9. Press the Build from the tool bar, Click on the “Set Project File” if not selected. Then, Again
press Build and click on the “Build test.asm”.
Some messages will appears on the second position of the screen, read the message and if you
have reported an error/s correct them on the top window, then select the Build again and click on
the “Set project file” if already selected then use the “Release project “ and again select the ”Set
project”.
Build your program again as per step 9.
If no error are reported , Its mean that your program is successfully assembled.
10. Print the test.lst file. It is store in the 68HC12 folder. Use the Note Pad to open this File
Prepared By:
Turab Talib , Lab. Instructor
4
11. To make the communication set up between the your Desktop and uC Board, Select the
Terminal Tag in the OPTION of TERMINAL Tool Bar of MiniIDE
You can change the COM port 2, if you are using it.
11. Press the TERMINAL CONNECT/DICONNECT Icon
to connect your computer with the uC Board
on the MiniIDE Tool Bar
11. Press the RESET BUTTON of the uC Board and see the last window for the following
message
D-Bug12 v2.1.0b15
Copyright 1996 - 1998 Motorola Semiconductor
For Commands type "Help"
It shows that you have successfully connected.
11. Type help and press enter
Prepared By:
Turab Talib , Lab. Instructor
5
The help will show the commands of D-Bug12 Commands that you can use them to do a lot of
useful thing.
Press Any Key For More
Prepared By:
Turab Talib , Lab. Instructor
6
12. Type the LOAD COMMAND on the Prompt of the D-Bug12
>load (then select the download icon
the file
FILENAME.s19)
on the MINIIDE , Pop Up window appears, select
( * will appear, If the file is successfully loaded in the uC.
>rd ( register display command can be used to see the contents loaded in the uC.) Before that
change the PC ( program counter to 800 location as our program is loaded from that position)
PC
SP
X
Y
D = A:B
0000 0A00 0000 0000
00:00
0000 E00F
SUBB 15,X
>rm
location)
CCR = SXHI NZVC
1001 0000
(register modified command will be used to change the PC from 0000 to 0800
PC=0000
SP=0A00
IX=0000
IY=0000
Prepared By:
Turab Talib , Lab. Instructor
7
A=00
B=00
CCR=90
PC=0000 0800
SP=0A00
IX=0000
IY=0000
A=00
B=00
CCR=90 .
( . can be used to terminate rm command)
>rd 0800
( Again
PC SP X Y D = A:B CCR = SXHI NZVC
0800 0A00 0000 0000 00:00
1001 0000
0800 860A
LDAA #$0A
>t
( TRACE COMMAND t will be used for next step by step operation)
PC SP X Y D = A:B CCR = SXHI NZVC
0802 0A00 0000 0000 0A:00
1001 0000
0802 7A0821
STAA $0821
>t
PC SP X Y D = A:B CCR = SXHI NZVC
0805 0A00 0000 0000 0A:00
1001 0000
0805 C6CD
LDAB #$CD
>t
PC SP X Y D = A:B CCR = SXHI NZVC
0807 0A00 0000 0000 0A:CD
1001 1000
0807 7B0822
STAB $0822
>t
PC SP X Y D = A:B CCR = SXHI NZVC
080A 0A00 0000 0000 0A:CD
1001 1000
080A 86A5
LDAA #$A5
>
>t
PC SP X Y D = A:B CCR = SXHI NZVC
080C 0A00 0000 0000 A5:CD
1001 1000
080C B6081E
LDAA $081E
>t
PC SP X Y D = A:B CCR = SXHI NZVC
080F 0A00 0000 0000 0A:CD
1001 0000
Prepared By: Turab Talib , Lab. Instructor
8
080F F6081F
LDAB $081F
>t
PC SP X Y D = A:B CCR = SXHI NZVC
0812 0A00 0000 0000 0A:0C
1001 0000
0812 1806
ABA
>t
PC SP X Y D = A:B CCR = SXHI NZVC
0814 0A00 0000 0000 16:0C
1011 0000
0814 8B01
ADDA #$01
>t
PC SP X Y D = A:B CCR = SXHI NZVC
0816 0A00 0000 0000 17:0C
1001 0000
0816 BB0820
ADDA $0820
>t
PC SP X Y D = A:B CCR = SXHI NZVC
0819 0A00 0000 0000 19:0C
1001 0000
0819 7A0823
STAA $0823
>t
PC SP
X
Y
D = A:B CCR = SXHI NZVC
081C 0A00 0000 0000
19:0C
1001 0000
081C 20FE
BRA $081C
13. By using the mm ( memory modify) command insert the following number . At the cursor
type
>mm 0800
(press enter)
>0800 XX YY ( XX are any random alphanumeric number will be displayed actually these
are the previous stored values at this memory location and you can insert the following new
number at YY, one by one, where the cursor in blinking, press enter)
45 , 4C , 54 , 4E , 20 , 32 , 33 , 31 , 38 , 20 , 4C , 61 , 62 , 20 , 20 , 20
for example
I am modifying the 0800 to onward memory location by 54 , 75 , 72 , 61 ,62
>0800 42 54 ( Press Enter)
>0801 4C 75 ( Press Enter)
>0802 5E 72 ( Press Enter)
>0803 2E 61 ( Press Enter)
>0804 01 62 ( Press Enter)
>0804 01 . ( insert dot to terminate the mm command then Press Enter)
Prepared By: Turab Talib , Lab. Instructor
9
Enter the md (memory display command) as follow
> md 0800 ( press Enter)
Look at the right hand side of the screen
md
14. Turn Off the power of the uC and Turn On again
press the reset button of the uC
Type the md command
> md 0800
What happens to the data you stored at these location, Any Clue??????
15. Display the memory content of location 0D00 by using md command
> md 0D00 0D0F
md ( Start Address) (End address)
These memory location will be filled with some contents . NOW
Type
> BULK ( Press Enter)
Again
> md 0D00 0D0F
What happened?
Repeat the step 13 & 14, But your memory location will 0D00 instead of 0800.
What happened after step 14. Any Clue ?.
16. By using the ASM command load the Accumalator A at location 0800 by immediate
addressing with 09 then decrement this register 9 times. Set the Program counter PC to
address of 0800 by using the Register modify command rm .Run your program. Watch what is
happened after address 080C. The value in the A register ?.
example for ASM Command
D-Bug12 v2.1.0b15
Copyright 1996 - 1998 Motorola Semiconductor
For Commands type "Help"
For Commands type "Help"
>asm 0800
0800 8609
LDAA
#$09
Prepared By:
Turab Talib , Lab. Instructor
10
0802
0803
0804
0805
0806
0807
0808
0809
080A
080B
43
43
43
43
43
43
43
43
43
01
DECA
DECA
DECA
DECA
DECA
DECA
DECA
DECA
DECA
MEM
>RM
>.
( Changing the PC to 0800)
PC=0000 0800
SP=0A00
IX=0000
IY=0000 .
>RD
(Register Display)
PC
0800
0800
>T
SP
0A00
8609
PC
0802
0802
SP
0A00
43
0000
X
0000
LDAA
Y
D = A:B
00:00
CCR = SXHI NZVC
1001 0000
#$09
( Trace command )
0000
X
0000
DECA
Y
D = A:B
09:00
CCR = SXHI NZVC
1001 0000
Keep using the Trace command until you reach the address 080B on the PC Register
>T
PC
080A
080A
SP
0A00
43
X
0000
Y
0000
DECA
SP
0A00
01
X
0000
Y
0000
MEM
SP
0A00
8400
X
0004
Y
0001
ANDA
D = A:B
01:00
CCR = SXHI NZVC
1001 0000
>T
PC
080B
080B
D = A:B
00:00
CCR = SXHI NZVC
1001 0100
>T
PC
080C
080C
D = A:B
00:00
CCR = SXHI NZVC
1001 0100
#$00
At PC 080C you are start getting the values which you have not entered and your program is not
ending. Again use the D-bug command and at this location insert the Break point command
(BR). And rum your program by using G command .
>BR 080C
>G 0800
You will see that your program is end nicely.
To remove the Break point type NOBR. And run your program again. See the difference???.
Prepared By:
Turab Talib , Lab. Instructor
11
Prepared By:
Turab Talib , Lab. Instructor
12
Документ
Категория
Без категории
Просмотров
5
Размер файла
287 Кб
Теги
1/--страниц
Пожаловаться на содержимое документа