AN-852 - Matthieu Benoit

Sep 8, 1981 - If the letter is present, the bit is 1. If a” .': is can enter short programs into the on-chip ~. 'Wkecute them via the monitor. A description of the rn,~~.
2MB taille 4 téléchargements 492 vues
AN-852

M070ROLA @

Application Note

Semiconductor Products Inc.

INTRODUCTION

.~4* “~!it,t,.

,,,+%i,-’;DlsPlaythe Register

The MC146805G2 is a fu~y static single-chip CMOS ~. ‘!~y,,,l *he processor registers are displayed as they appear on the Microcomputer. It has 112 bytes of RAM, 2106 bytes of user,t~~~~$,,Stack. The format of the register print is: ROM, four 8-bit input/output ports, a timer, and an on-chip ~ “ HINZC AA XX PP osci~ator. The MC146805G2L1 ROM contains a rn~nitoF The first field shows the sate of the condition code register routine which provides the user with the abifity to ,w~uate bits. Each bit in the register has a single letter corresponding the MC 146805G2 using a standard RS232 termin@.~Je%er to the bit name. If the letter is present, the bit is 1. If a” .’: is can enter short programs into the on-chip ~ ‘Wkecute printed in place of the letter, that bit is O. For example, them via the monitor. A description of the rn,~~.@peration “H..ZC” means that the H, Z, and C bits are 1 and that the I follows along with an assembled Esting, d~$~~~f~ctud pro,.;}t,,, , q$>.i,,, and N bits are O. The remainder of the ~ie shows the status .:,,+!,++,\, ~,~ gram. “’:$ ‘flr\,i‘,’ of the accumulator, index register, and program counter, .,,.,,> ,!.:.). ~~~$,. respectively. The stack pointer is always at a fixed address on ~,\\,,&.:!> ,~{s::” .& MONITOR MODE ,y this case $7A). The values shown are the values loaded into In this mode the MC1468Q,~~~;hcrocomputer is conthe CPU when a “C” or “E” command is executed. Ml netted to a terminal capable $’fr~ning at 300, 1200,4800, or register vrdues except the condhion code register can be 9600 baud. Figure 1 c-~~~d schematic diagram of the changed with other commands. To change the condition monitor mode connect~~j&d a table showing CO and Cl code register, it is necessary to use the memory change comswitch settings to #8~@n a baud rate that matches the termand and modify location $7B. minrd. Be sure th~dwxlor frequency is 3.579545 MHz. Any area of wJ@~ocation $18-to $7A maybe used for proA — Examine/Change the Accumulator gram storaa;’~~wever, upper locations may be needed for This command begins by printing the current value of the ~si:~~r.. user S@QRi*4? ..:.. accumulator and then waits for more input. In order to W*’~~.microcomputer is reset, a power-up message is change the current vrdue, type in a new vrdue (two hex digits). pm&&Fdlloting the message, the prompt character “ .“ is To leave the accumulator unchanged, type any non-hex digit p&Wk&and the monitor waits for a response, The response (a space is a good choice). ‘~%#konsist of single letter commands with some commands ‘t&&quifing ad~tiond input. Unrecognized commands respond ... x —Examine/Change the Index Register by printing “?”. Vtid commands are: This procedure is the same as the “A” command, but afR — Display the Register, fects the index register instead. A — Display/Change the Accumulator X — Display/Change the Index Register M— Examine/Change Memory M - Display/Change Memory Any memory location may be examined or changed with C — Continue Program Execution this command (except of course, ROM). To begin, type “M” E — Execute Program at Address followed by a hexadecimal address in the range s —Display State of 1/0 and Tmer $0000-$ lFFF. The monitor responds by beginning a new line

@MOTOROLA INC., 1%1

& OM

m

3.579W5 MHz

—20pF I

) Terminal lee I aule #co

27 k I K

?i,!k,,J: and printing the memory addre~~+;mo~ed by the current contents of that location. At @:~~~@@ltyou may type: 1. ‘‘,” and re-examine th&:~a@ byte. (Try this with loca,,* $*. ,,~ ,> tion $0008.) .. .. 2. ‘CA”and go to ~~!~r~ious byte. Typing “~’ at location $~ =* .,i,,>j, tt$ monitor to go to $lFFF. 3. “CR” an&~~$$~’’the next byte. “CR” is the carriage retur~~$.%~~r. The byte after $lFFF is $~.

1111

C — Continue Program Execution The “C” command merely executes an RTI jnstructjon, This means that rdl the registers are reloaded exactly as they are shown in the register display. Execution continues until the reset switch is depressed or the processor executes an SWI. Upon executing an SWI, the monitor regains control and prints the prompt character. This feature can be used for an elementary form of breakpoints. Since there is really no way to know where the stack pointer is after an SWI, the monitor assumes that it is at $7A, This will not be the case if an SWI is part of a subroutine. In this case, the monitor will be recentered but the stack pointer wtil point to $78. This is perfectly valid and typing “C” will pick up the program from where it left off. However, the A, X, R, and E commands ~ assume the stack starts at $7A and will not function properly. If the stick location is known, it is still possible to examine the retisters bv.- using the M command.

4. “D@\ ,:..’x‘> to the end of Mls apphcation note. ,/,.

Q Ptint CR, LF Print Prompt Get Character Print Space

rrlnt be Ptint Memory ibex)

&

Err

A= Get 2 Hex

Memorv

[Get)=

A

Sep

8

15:10

0000 0000 0000 0000 Oooo

00 00 00 00 ~o

00 01. 02 03 04

0000 0000 0000 0000 0000 0000

00 00 00 00 01 20

08 09 10 80 00 00

0000 0000 0000 0000

00 00 00 00

Od Oa 20 00

1981

146805G2

ROM Monitor

Listing

Page

1

* * MC146805G2 ROM P A T TER N * * The MCA805G2 single-chip microcomputer is a 40-pin CMOS * with device 2096 bytes of ROM, 112 bytes of RAM, four * 8-bit 1/0 ports, a timer and an external interrupt * The ROM contains two separate programs. input Either&~ * of these programs may be selected on reset by wiring poR~,~J *P,>i\~:>i!.:!*,, , :,,,,.:,:..$< \,i\.)\, !,\;,,+.. * ,x~) 100 monitor (300 baud) ...,..~t.}~ ‘ ,..:~.,, ,.:?.”,\ * 101 monitor (1200 baud) u: .*’ , s.! * ~?c.~ ‘ .t,:i$: “’+:,3 110 monitor (4800 baud) * 111 monitor (9600 baud) ~ ‘~~~x,j} ., .~t} “~:., * Oxx bicycle odometer !~: * and serial output is C3. ,.. .~~. * .”?$ ~,)l,\... .* I/o pt~ft ‘@~ ports equ $000 poTtb equ $001 I/O,.@o WS~ 1 portc equ $002 I/@’’~&rt 2 poTkd equ $003 &,~~mx..:i * * Q~~~~> * . .#;’: ..,$+~”,$ ROM MONITOR 146805G2 ‘i ,>;3?1., \ * ‘*?j\., ,?, .>~s, * ,i.:.:-f.?‘~,:~,.> !, $:, ‘> * The monitor has the following commands: ,,,,,X :?8.$, :., .},.\,~*, .. ,*\,>& .,. ..>$ ..\\.,Jy.t, .$t:.>? ‘** :?.,$~tb, ‘,,,b,#?. ~,,.,,.,.J\,& *.i$, .,.

reset.

put

in out * * * * *. getc

getc3 getc2

fc 02 02

should be in the middle of the start bit

brset tst

in, ,x

tst tst

,x lx

put,

main loop for bsr brc lr tst

getc4 more

false

start

bit

test

timing delays

getc

delay (6) common delay routine inlput, getc~ (5) test input and set c-bit ,x (4) timing equalizer

12

Se p

e 15: lC

07ee 07e9 07+0 07fl O?f> 07f3 07f4

9d 9d 9d 9d Td ?d 36

1981

146805G2

ROM P[onitor

Listing

nop nop nop nop nop nop

Ik

TOT

char

Page

10

(2) CMOS equalization (2) CMOS equalization (2) CMOS equalization (2) CMOS equalization (2) CMOS equalization (2)”CMOS equalization (5) add this bit to

the

bute

*,\ *.,,

Se p

8

15:10

0832

a4

03

0834 0835 0838

97

0S3a

de a6 ab

083c 083c 083d

9d 4a

083e

2b fc

0840 0841 0843 0845 084b 084S 0849

5d

9d ?d

084a

81

1981

146805G2

08 4b f8

09

de13 de12

ROM Monitor

and tax ldx Ida add

Listing

Page

Ii

#zll

what

the

delays, #$F8

x

loop funny

baud

constant Adjustment

rate from for

is table subroutine

overhead

#%09

14 02 14 02 5a

2& f2

* * * * * * 084b 084c 084d 084e

20 08 02 01

delays

* * * * * 084f 084f

reset

0852

be

0855 0855 0857 0859

put put+ddr sign-on

085b 085c Ossf 0061

0863 0866 0867 0869 0869

msg, restart putt

incx bra

babble

bicycle

setup port set output set ddr to

odometer

for serial io to mark level have one output

message

x

#Eos Jsr

a

get next character last char? yes, start monitor and print it advance to next char more message

restart swi bra

08&a

push loop

reset

*

14

machine around

state

and

go

to

monitor

routine

se p

086c 08&e 0876

8

15:10

Od Ua 31 34 47 32 00

198i

i46805G2

* * msg 36

38

30

35

ROM Monitor

Listing

Page

ms g ---

power

up

fcb fcc

CR, LF /i4&005G2/

TLU

C.ua

12

message

* .

or desian. Motorola does not assume any IiabilitVarising Motorola reserves therightto makechanges toanVproducts herein toimpIrnve . . . . reliability. . . ... . .... . . function . ..” lnder its patent rights nor the rights of others. out of the application or use of any product or circuit described herein; neither does it convey anv license UI

I

1

MOrOROLA

Semiconductor Products Inc. 3501 ED BLUESTEIN BLVD., AUSTIN, TEXAS 78721

A14957

PRINTEO

IN USA

11-81

IMPER1&L LITW

C01419

18,000



A SUBSIDIARY OF MOTOROU

INC.

M

852