ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 14.06.2025

Просмотров: 3136

Скачиваний: 0

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

A.3 HC11 Instruction Set

217

Mnemonic

Operation

Description

Flags

LSR(opr)

Logical shift right

0

→ b7 → b6 . . . b0 → C

N,Z,V,C

LSRA

Logical shift right A

0

→ b7 → b6 . . . b0 → C

N,Z,V,C

LSRB

Logical shift right B

0

→ b7 → b6 . . . b0 → C

N,Z,V,C

LSRD

Logical shift right Double

0

→ b15 → . . . → b0 → C

N,Z,V,C

MUL

Multiply A by B

A × B → D

C

NEG(opr)

Tow’s complement memory byte

0

− M → M

N,Z,V,C

NEGA

Tow’s complement A

0

− A → A

N,Z,V,C

NEGB

Tow’s complement B

0

− B → B

N,Z,V,C

NOP

No operation

No operation

ORAA (opr)

OR Accumulator A

A M → A

N,Z,V

ORAB (opr)

OR Accumulator B

B M → B

N,Z,V

PSHA

Push A onto Stack

A → Stk, SP = SP − 1

PSHB

Push B onto Stack

B → Stk, SP = SP − 1

PSHX

Push X onto Stack(Lo First)

IX → Stk, SP = SP − 2

PSHY

Push Y onto Stack(Lo First)

IY → Stk, SP = SP − 2

PULA

Pull A from Stack

SP = SP + 1, A ← Stk

PULB

Pull B from Stack

SP = SP + 1, B ← Stk

PULX

Pull X from Stack (Hi First)

SP = SP + 2, IX ← Stk

PULY

Pull Y from Stack (Hi First)

SP = SP + 2, IY ← Stk

ROL (opr)

Rotate Left Memory

b0 ← C ← b7 ← b6

N,Z,V,C

. . . ← b0

ROLA

Rotate Left A

b0 ← C ← b7 ← b6

N,Z,V,C

. . . ← b0

ROLB

Rotate Left B

b0 ← C ← b7 ← b6

N,Z,V,C

. . . ← b0

ROR (opr)

Rotate Right Memory

b7 → b6 . . . b0 → C → b7

N,Z,V,C

RORA

Rotate Right A

b7 → b6 . . . b0 → C → b7

N,Z,V,C

RORB

Rotate Right B

b7 → b6 . . . b0 → C → b7

N,Z,V,C

RTI

Return from Interrupt

N,Z,V,C

RTS

Return from Subroutine

A − B → A

SBA

Subtract B from A

N,Z,V,C

SBCA (opr)

Subtract with Carry from A

A − M − C → A

N,Z,V,C

SBCB (opr)

Subtract with Carry from B

B − M − C → B

N,Z,V,C

SEC

Set Carry

1

→ C

C

SEI

Set Interrupt Mask

1

→ I

I

SEV

Set Overflow Flag

1

→ V

V

STAA (opr)

Store Accumulator A

A → M

N,Z,V

STAB (opr)

Store Accumulator B

B → M

N,Z,V

STD (opr)

Store Accumulator D

A → M, B → M + 1

N,Z,V

STOP

Stop Internal Clocks

SP → M : M + 1

STS (opr)

Store Stack Pointer

N,Z,V

STX (opr)

Store Index Register X

IX → M : M + 1

N,Z,V

STY (opr)

Store Index Register Y

IY → M : M + 1

N,Z,V

SUBA (opr)

Subtract Memory from A

A − M → A

N,Z,V,C

SUBB (opr)

Subtract Memory from B

B − M → B

N,Z,V,C

SUBD (opr)

Subtract Memory from D

D − (M : M + 1) → D

N,Z,V,C

SWI

Software Interrupt

I


218

Appendices

Mnemonic

Operation

Description

Flags

TAB

Transfer A to B

A → B

N,Z,V

TAP

Transfer A to CC Register

A → CCR

All

TBA

Transfer B to A

B → A

N,Z,V

TEST

TEST (Only in Test Modes)

Address Bus Counts

TPA

Transfer CC Register to A

CCR → A

TST (opr)

Test for Zero or Minus

M − 0

N,Z,V,C

TSTA

Test A for Zero or Minus

A − 0

N,Z,V,C

TSTB

Test B for Zero or Minus

B − 0

N,Z,V,C

TSX

Transfer Stack Pointer to X

SP + 1 → IX

TSY

Transfer Stack Pointer to Y

SP + 1 → IY

TXS

Transfer X to Stack Pointer

IX − 1 → SP

TYS

Transfer Y to Stack Pointer

IY − 1 → SP

WAI

Wait for Interrupt

Stack Regs & WAIT

XGDX

Exchange D with X

IX → D, D → IX

XGDY

Exchange D with Y

IY → D, D → IY


A.4 An Example of Expanded Structure with HC11

The example presented below is an illustration of a typical structure with 68HC11E9 operating in expanded multiplexed mode (MODA = 1, MODB = 1).

Figure A4.1 shows the microcontroller and the bus demultiplexer, implemented with the latch 74LS573, controlled by the Address Strobe (AS) signal. Note that the unused MCU pins are not represented in this figure.

Y1

8

IC1

XTAL

7

C1

EXTAL

C2

RESET 17

ADDRESS BUS

RESET

GND GND

MODB

PB0

42

A8

VCC

2

MODB PB1

41

A9

PB2

40

A10

PB3

39

A11

PB4

38

A12

J1

R3

PB5

37

A13

PB6

36

A14

C3

PB7

35

IC2

A15

T1

PC0

9

2

1D

1Q

19 A0

10

3

2D

18 A1

R2

PC1

11

4

3D

2Q

17 A2

PC2

3Q

R1

PC3

12

5

4D

4Q

16 A3

13

6

5D

15 A4

PC4

14

7

6D

5Q

14 A5

GND GND

PC5

15

8

7D

6Q

13 A6

PC6

16

9

8D

7Q

12 A7

PC7

AS

8Q

11

C

1

VCC

R4

0C

74S573

GND

AD0

J2

AD1

GND

AD2

MODA

3

MODA

AD3

AD4

R5

E

5 E

AD5

AD6

VCC

AS

4 AS

AD7

J3

R/W\

6 R/W\

GND

DATA BUS

Fig. A4.1. MCU 68HC11E9 and the bus demultiplexer

Figure A4.2 shows the external memory circuits and the address decoder. The external ROM is an 8-kilobyte, 2764 EPROM (ICx), selected with CSE000H. ICy is a 6264 8-kilobyte RAM selected with CS2000H. Besides chip select, the 6264 circuit requires an additional control signal for the OE (Output Enable) input. This is OERAM, obtained by inverting the signal R/W\ with the gate IC7A.

IC4

A13 1

A

Y0

15 CS0000H

A14 2

B

Y1

14 CS2000H

IC5

IC6

A15 3

13 CS4000H

C

Y2

12 CS6000H

A0 10

A0

O0

11 AD0

A0 10

A0

I/O0

11 AD0

Y3

F 6

G1

Y4

11 CS8000H

A1

9

A1

O1

12 AD1

A1

9

A1

I/O1

12 AD1

Y5

10 CSA000H

A2

8

A2

O2

13 AD2

A2

8

A2

I/O2

13 AD2

4

G2A

Y6

9 CSC000H

A3

7

A3

O3

15 AD3

A3

7

A3

I/O3

15 AD3

5

G2B

Y7

7 CSE000H

A4

6

A4

O4

16 AD4

A4

6

A4

I/O4

16 AD4

74LS138

A5

5

A5

O5

17 AD5

A5

5

A5

I/O5

17 AD5

A6

4

A6

O6

18 AD6

A6

4

A6

I/O6

18 AD6

GND

A7

3

A7

O7

19 AD7

A7

3

A7

I/O7

19 AD7

A8 25

A8 25

A9 24

A8

A9 24

A8

A9

A9

A10

21

A10

A10

21

A10

IC7A

A11

23

A11

A11

23

A11

A12 2

A12

A12 2

A12

VCC

28

R/W\

1

2 OERAM

GND

20

CE\

R/W\

27

WE\

VCC

74LS04

CSE0000H

22

OERAM 22

27

OE\

CS2000H 20

OE\

VCC

1

PGM\

26

CS1\

VSS

14

VPP

CS2

2764

VCC

6264

GND

Fig. A4.2. External memory and address decoder


220 Appendices

IC7B

CS4000H 3

4

74LS04

DATA BUS

IC8

AD0 2

1D

1Q

19 OUTP0

AD1 3

2D

2Q

18 OUTP1

AD2 4

3D

3Q

17 OUTP2

AD3 5

4D

4Q

16 OUTP3

AD4 6

5D

5Q

15 OUTP4

AD5 7

6D

6Q

14 OUTP5

AD6 8

7D

7Q

13 OUTP6

AD7 9

8D

8Q

12 OUTP7

11

C

1

OC

74LS573

GND

AD0 19

IC9

1Q

1D

2 INP0

AD1 18

3 INP1

AD2 17

2Q

2D

4 INP2

AD3 16

3Q

3D

5 INP3

AD4 15

4Q

4D

6 INP4

AD5 14

5Q

5D

7 INP5

AD6 13

6Q

6D

8 INP6

AD7 12

7Q

7D

9 INP7

8Q

8D

VCC

11

C

1 CS6000H

OC

74LS573

Fig. A4.3. External I/O ports

Two additional selection signals CS4000H and CS6000H are used to control the external input and output ports, shown in Fig. A4.3.


A.5 Using HC11 in Bootstrap Mode

If the input lines MODA and MODB are grounded during RESET, HC11 enters a special operating mode, called bootstrap. In bootstrap mode, the microcontroller executes a program, called bootloader, located in a small ROM, invisible in the memory map in normal modes.

The bootloader allows user programs to be loaded into the MCU RAM, via the serial communication interface SCI, and, when the transmission completes, the user program is automatically launched.

In principle, the user program loaded this way can use any of the MCU resources, but the most common use of the bootstrap mode is for writing the CONFIG register and EEPROM constants. Some members of the HC11 family have internal EPROM or OTPROM (One Time Programmable ROM), which can also be programmed in bootstrap mode.

The first action of the bootloader is to send a break (a long zero) character on the serial line. If the answer of the host is another break, then the bootloader passes the control to a program located in the EEPROM, by executing an unconditional jump to the first address of the EEPROM. If the host sends a $FF, this is used by the bootloader of 68HC11E9 to determine the baud rate, by selecting one of the two possible baud rates (1200 or 7812 baud). Note that other versions of HC11 allow different baud rates. See the specific data sheets for details.

Once the baud rate is selected, the bootloader starts receiving the binary characters from the serial line, echoes each received character to the host, and stores them in RAM. If the end of RAM is reached, or no character is received for four character times, the bootloader abandons the communication process and executes a jump to the first address of RAM, passing control to the user program.

A complete description of the HC11 bootloader is available in the Motorola application note AN1060, available on the internet.

The development board described in Chap. 9 is provided with two jumpers (JP2, JP3) that control the MODA, MODB inputs and allow the MCU to enter the special bootstrap operating mode. To facilitate testing this operating mode, the accompanying CD contains a small utility program, called BLT11.EXE (Bootloader terminal for HC11).

BLT11 does not require any installation procedure, and may be run from the CDROM. It allows the user to select the COM port to use, configures it for 1200 baud, loads a binary at the user’s choice and sends its contents to the selected communication port, preceded by $FF.

The binary characters echoed by the MCU are displayed in the terminal window as pairs of two hex digits separated by a space. When the download completes, the user program is automatically launched. This program waits for a character from the SCI and compares it to CR ($0D) and SP (Space $20). If SP is detected, the program reads the current value of the CONFIG register and sends it to the host through the SCI. If CR is detected, the program writes the constant NEWCFG in CONFIG, and sends it to the host to acknowledge the operation.

Below is the full listing of a program that modifies the CONFIG register.

222

Appendices

TITLE PROGRAMMING THE CONFIG REGISTER

INCLUDE 68HC11F1.DEF

NEWCFG

EQU

$0F

*EEPGM

EQU

$01

*EELAT

EQU

$02

*ERASE

EQU

$04

BYTE

EQU

$20

ENDRAM

EQU

$1FF

;valid for E9 too

CR

EQU

$0D

SP

EQU

$20

CODE

;no ORG!!

START

LDS

#ENDRAM

;init SP

LDAA

SCSR

;clear SCI flags if any

LDAA

SCDR

CLR

BPROT

REC05

LDAA

SCSR

;wait a character from SCI

ANDA

#$20

BEQ

REC05

REC10

LDAA

SCDR

;get character

CMPA

#CR

BEQ

E2W

;if CR write new value

CMPA

#SP

BEQ

SENDC

;if SP send current value

BRA

REC05

;endless loop

E2W

LDY

#CONFIG

BSR

E2BE

;erase it first

LDAB

#EELAT

STAB

PPROG

LDAA

#NEWCFG

STAA

CONFIG

;latch the address

ORAB

#EEPGM

STAB

PPROG

BSR

DLY10

;wait about 10ms

SENDC

LDAA

SCSR

ANDA

#$80

;transmit complete?

BEQ

SENDC

LDAA

CONFIG

STAA

SCDR

BRA

REC05

;back to start

*LOCAL SUBROUTINES

E2BE

LDAB

#$16

;BYTE=1,ERASE=1,EELAT=1

STAB

PPROG

STAB

0,Y

;latch address

LDAB

#$17

;make EEPGM=1

STAB

PPROG

;start Vpp (charge pump)

BSR

DLY10

CLR

PPROG

;stop Vpp and return to read

RTS

DLY10

LDX

#$3000