Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
8XC196Kx,8XC196Jx,87C196CA microcontroller family user's manual.1995.pdf
Скачиваний:
68
Добавлен:
23.08.2013
Размер:
3.97 Mб
Скачать

8XC196Kx, Jx, CA USER’S MANUAL

INT_PEND1

Address:

12H

 

Reset State:

00H

When hardware detects a pending interrupt, it sets the corresponding bit in the interrupt pending (INT_PEND or INT_PEND1) registers. When the vector is taken, the hardware clears the pending bit. Software can generate an interrupt by setting the corresponding interrupt pending bit.

 

7

 

 

 

 

 

 

 

 

 

 

 

8

87C196CA

 

NMI

 

EXTINT

CAN

 

RI

 

 

TI

SSIO1

SSIO0

 

 

 

7

 

 

 

 

 

 

 

 

 

 

 

0

8XC196Jx

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

EXTINT

 

RI

I

TI

SSIO1

SSIO0

 

 

 

7

 

 

 

 

 

 

 

 

 

 

 

0

8XC196Kx

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

NMI

 

EXTINT

 

RI

I

TI

SSIO1

SSIO0

 

CBF

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Bit

 

 

 

 

 

 

Function

 

 

 

 

 

Number

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

7:0

When set, this bit indicates that the corresponding interrupt is pending. The interrupt bit is

 

cleared when processing transfers to the corresponding interrupt vector.

 

 

The standard interrupt vector locations are as follows:

 

 

 

 

 

 

Bit Mnemonic Interrupt

 

 

 

 

Standard Vector

 

 

 

NMI

Nonmaskable Interrupt

 

 

 

203EH

 

 

 

 

 

EXTINT

EXTINT Pin

 

 

 

 

203CH

 

 

 

 

 

CAN (CA)††

CAN Peripheral

 

 

 

 

203AH

 

 

 

 

 

RI

SIO Receive

 

 

 

 

2038H

 

 

 

 

 

TI

SIO Transmit

 

 

 

 

2036H

 

 

 

 

 

SSIO1

SSIO 1 Transfer

 

 

 

 

2034H

 

 

 

 

 

SSIO0

SSIO 0 Transfer

 

 

 

 

2032H

 

 

 

 

 

CBF (Kx)

Slave Port Command Buffer Full

2030H

 

 

 

 

†† All CAN-controller interrupts are multiplexed into the single CAN interrupt input

 

 

(INT13). The interrupt service routine associated with INT13 must read the CAN interrupt

 

pending register (CAN_INT) to determine the source of the interrupt request.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Bit 7 is reserved on the 8XC196Jx devices, bit 5 is reserved on the 8XC196Jx, Kx devices, and bit 0 is reserved on the 87C196CA, 8XC196Jx devices. For compatibility with future devices, always write zeros to these bits.

Figure 5-8. Interrupt Pending 1 (INT_PEND1) Register

5.6INITIALIZING THE PTS CONTROL BLOCKS

Each PTS interrupt requires a block of data called the PTS control block (PTSCB). The PTSCB identifies which PTS microcode routine will be invoked and sets up the specific parameters for the routine. You must set up the PTSCB for each interrupt source before enabling the corresponding PTS interrupts.

5-18

STANDARD AND PTS INTERRUPTS

Each PTS control block (PTSCB) requires eight data bytes in register RAM. The address of the first (lowest) byte is stored in the PTS vector table in special-purpose memory (see “Special-pur- pose Memory” on page 4-3). Figure 5-9 shows the PTSCB for each PTS mode. Unused PTSCB bytes can be used as extra RAM.

NOTE

The PTSCB must be located in register RAM. The location of the first byte of the PTSCB must be aligned on a quad-word boundary (an address evenly divisible by 8).

 

Single

 

Block

 

A/D Scan

 

PWM Toggle

 

PWM Remap

 

Transfer

 

Transfer

 

Mode

 

Mode

 

Mode

 

 

 

 

 

 

 

 

 

 

 

Unused

 

Unused

 

Unused

 

PTSCONST2 (H)

 

Unused

 

 

 

 

 

 

 

 

 

 

 

Unused

 

PTSBLOCK

 

Unused

 

PTSCONST2 (L)

 

Unused

 

 

 

 

 

 

 

 

 

 

 

PTSDST(H)

 

PTSDST (H)

 

PTSPTR2 (H)

 

PTSCONST1 (H)

 

PTSCONST1 (H)

 

 

 

 

 

 

 

 

 

 

 

PTSDST (L)

 

PTSDST (L)

 

PTSPTR2 (L)

 

PTSCONST1 (L)

 

PTSCONST1 (L)

 

 

 

 

 

 

 

 

 

 

 

PTSSRC (H)

 

PTSSRC (H)

 

PTSPTR1 (H)

 

PTSPTR1 (H)

 

PTSPTR1 (H)

 

 

 

 

 

 

 

 

 

 

 

PTSSRC (L)

 

PTSSRC (L)

 

PTSPTR1 (L)

 

PTSPTR1 (L)

 

PTSPTR1 (L)

 

 

 

 

 

 

 

 

 

 

 

PTSCON

 

PTSCON

 

PTSCON

 

PTSCON

 

PTSCON

 

 

 

 

 

 

 

 

 

 

PTSVECT

PTSCOUNT

 

PTSCOUNT

 

PTSCOUNT

 

Unused

 

Unused

Figure 5-9. PTS Control Blocks

5.6.1Specifying the PTS Count

For single transfer, block transfer, and A/D scan routines, the first location of the PTSCB contains an 8-bit value called PTSCOUNT. This value defines the number of interrupts that will be serviced by the PTS routine. The PTS decrements PTSCOUNT after each PTS cycle. When PTSCOUNT reaches zero, hardware clears the corresponding PTSSEL bit and sets the PTSSRV bit (Figure 5-10), which requests an end-of-PTS interrupt. The end-of-PTS interrupt service routine should reinitialize the PTSCB, if required, and set the appropriate PTSSEL bit to re-enable PTS interrupt service.

5-19

8XC196Kx, Jx, CA USER’S MANUAL

PTSSRV

Address:

06H

 

Reset State:

0000H

The PTS service (PTSSRV) register is used by the hardware to indicate that the final PTS interrupt has been serviced by the PTS routine. When PTSCOUNT reaches zero, hardware clears the corresponding PTSSEL bit and sets the PTSSRV bit, which requests the end-of-PTS interrupt. When the end-of-PTS interrupt is called, hardware clears the PTSSRV bit. The PTSSEL bit must be set manually to re-enable the PTS channel.

 

15

 

 

 

 

 

 

 

 

 

 

 

8

87C196CA

 

 

 

EXTINT

CAN

 

RI

 

 

TI

SSIO1

SSIO0

 

 

7

 

 

 

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

AD

 

EPA0

 

 

EPA1

EPA2

EPA3

EPAx

 

 

15

 

 

 

 

 

 

 

 

 

 

 

8

8XC196Jx

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

EXTINT

 

RI

 

 

TI

SSIO1

SSIO0

 

7

 

 

 

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

AD

 

EPA0

 

 

EPA1

EPA2

EPA3

EPAx

 

 

15

 

 

 

 

 

 

 

 

 

 

 

8

8XC196Kx

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

EXTINT

 

RI

 

 

TI

SSIO1

SSIO0

CBF

 

 

7

 

 

 

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

IBF

 

OBE

AD

 

EPA0

 

 

EPA1

EPA2

EPA3

EPAx

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Bit

 

 

 

 

 

 

 

Function

 

 

 

 

Number

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

14:0

This bit is set by hardware to request an end-of-PTS interrupt for the corresponding

(Note 1)

interrupt through its standard interrupt vector.

 

 

 

 

 

The standard interrupt vector locations are as follows.

 

 

 

 

 

Bit Mnemonic Interrupt

 

 

 

 

Standard Vector

 

 

 

EXTINT

External

 

 

 

 

203CH

 

 

 

 

CAN (CA)

CAN Peripheral

 

 

 

 

203AH

 

 

 

 

RI

SIO Receive

 

 

 

 

2038H

 

 

 

 

TI

SIO Transmit

 

 

 

 

2036H

 

 

 

 

SSIO1

SSIO1 Transfer

 

 

 

 

2034H

 

 

 

 

SSIO0

SSIO0 Transfer

 

 

 

 

2032H

 

 

 

 

CBF (Kx)

Slave Port Command Buffer Full

2030H

 

 

 

 

IBF (Kx

Slave Port Input Buffer Full

 

200EH

 

 

 

 

OBE (Kx)

Slave Port Output Buffer Empty

200CH

 

 

 

 

AD

A/D Conversion Complete

 

200AH

 

 

 

 

EPA0

EPA Capture/Compare Channel 0

2008H

 

 

 

 

EPA1

EPA Capture/Compare Channel 1

2006H

 

 

 

 

EPA2

EPA Capture/Compare Channel 2

2004H

 

 

 

 

EPA3

EPA Capture/Compare Channel 3

2002H

 

 

 

 

EPAx

Multiplexed EPA

 

 

 

 

2000H

 

 

 

This bit is cleared when all EPA interrupt pending bits (EPA_PEND and EPA_PEND1)

 

are cleared.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1.Bit 13 is reserved on the 8XC196Jx, Kx devices and bits 6–8 are reserved on the 87C196CA, 8XC196Jx devices. For compatibility with future devices, write zeros to these bits.

Figure 5-10. PTS Service (PTSSRV) Register

5-20

STANDARD AND PTS INTERRUPTS

5.6.2Selecting the PTS Mode

The second byte of each PTSCB is always an 8-bit value called PTSCON. Bits 5–7 select the PTS mode (Figure 5-11). The function of bits 0–4 differ for each PTS mode. Refer to the sections that describe each routine in detail to see the function of these bits. Table 5-4 on page 5-10 lists the execution times for each PTS mode.

PTSCON

 

 

 

 

 

 

 

 

 

 

Address: PTSPCB + 1

The PTS control (PTSCON) register selects the PTS mode and sets up control functions for that

mode.

 

 

 

 

 

 

 

 

 

 

 

 

 

7

 

 

 

 

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

M2

M1

 

M0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Bit

Bit

 

 

 

 

 

 

Function

 

 

 

Number

Mnemonic

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

7:5

M2:0

PTS Mode

 

 

 

 

 

 

 

 

 

 

 

These bits select the PTS mode:

 

 

 

 

 

 

 

M2

M1

M0

 

 

 

 

 

 

 

 

 

 

0

0

 

0

block transfer

 

 

 

 

 

 

 

0

0

 

1

reserved

 

 

 

 

 

 

 

0

1

 

0

PWM toggle or remap

 

 

 

 

 

 

0

1

 

1

reserved

 

 

 

 

 

 

 

1

0

 

0

single transfer

 

 

 

 

 

 

 

1

0

 

1

reserved

 

 

 

 

 

 

 

1

1

 

0

A/D scan

 

 

 

 

 

 

 

1

1

 

1

reserved

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The function of this bit depends upon which mode is selected. See the PTS control block description in each PTS mode section.

Figure 5-11. PTS Mode Selection Bits (PTSCON Bits 7:5)

5.6.3Single Transfer Mode

In single transfer mode, an interrupt causes the PTS to transfer a single byte or word (selected by the BW bit in PTSCON) from one memory location to another. This mode is typically used with serial I/O, or synchronous serial I/O, or slave port interrupts. It can also be used with the EPA to move captured time values from the event-time register to internal RAM for further processing. See AP-445, 8XC196KR Peripherals: A User’s Point of View, for application examples with code. Figure 5-12 shows the PTS control block for single transfer mode.

5-21

8XC196Kx, Jx, CA USER’S MANUAL

PTS Single Transfer Mode Control Block

In single transfer mode, the PTS control block contains a source and destination address (PTSSRC and PTSDST), a control register (PTSCON), and a transfer count (PTSCOUNT).

 

7

 

 

 

 

 

 

 

 

0

Unused

 

0

0

0

 

0

 

0

0

0

0

 

 

7

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

 

 

 

 

Unused

 

0

0

0

 

0

 

0

0

0

0

 

15

 

 

 

 

 

 

 

 

8

 

 

 

 

 

 

 

 

 

 

 

PTSDST (HI)

 

 

 

PTS Destination Address (high byte)

 

 

 

 

7

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

 

 

 

PTSDST (LO)

 

 

 

PTS Destination Address (low byte)

 

 

 

 

15

 

 

 

 

 

 

 

 

8

 

 

 

 

 

 

 

 

 

 

 

 

PTSSRC (HI)

 

 

 

 

PTS Source Address (high byte)

 

 

 

 

7

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

 

 

 

 

PTSSRC (LO)

 

 

 

 

PTS Source Address (low byte)

 

 

 

 

7

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

 

 

 

 

PTSCON

 

M2

M1

M0

 

BW

 

SU

DU

SI

DI

 

 

7

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

 

 

 

PTSCOUNT

 

 

 

Consecutive Byte or Word Transfers

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Register

Location

 

 

 

 

 

Function

 

 

 

 

 

 

 

 

 

 

PTSDST

PTSCB + 4

PTS Destination Address

 

 

 

 

 

 

 

Write the destination memory location to this register. A valid address is

 

 

 

any unreserved memory location; however, it must point to an even

 

 

 

address if word transfers are selected.

 

 

 

 

 

 

 

 

 

 

PTSSRC

PTSCB + 2

PTS Source Address

 

 

 

 

 

 

 

Write the source memory location to this register. A valid address is any

 

 

 

unreserved memory location; however, it must point to an even address

 

 

 

if word transfers are selected.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Figure 5-12. PTS Control Block – Single Transfer Mode

5-22

 

 

 

 

 

 

 

 

STANDARD AND PTS INTERRUPTS

 

 

 

 

 

PTS Single Transfer Mode Control Block (Continued)

 

 

 

 

 

 

 

 

 

 

 

 

 

Register

Location

 

 

 

 

 

Function

 

 

 

 

 

 

 

 

 

PTSCON

PTSCB + 1

PTS Control Bits

 

 

 

 

 

 

 

 

 

 

 

 

 

 

M2:0

PTS Mode

 

 

 

 

 

 

 

M2

M1

M0

 

 

 

 

 

 

1

 

0

0

single transfer mode

 

 

 

 

 

 

 

 

 

 

 

BW

Byte/Word Transfer

 

 

 

 

 

 

0

= word transfer

 

 

 

 

 

 

1

= byte transfer

 

 

 

 

 

 

 

 

 

 

 

 

SU

Update PTSSRC

 

 

 

 

 

 

0

=

reload original PTS source address after each byte or word

 

 

 

 

 

 

 

transfer

 

 

 

 

 

 

 

1

=

retain current PTS source address after each byte or word

 

 

 

 

 

 

 

transfer

 

 

 

 

 

 

 

 

 

 

 

 

 

DU

Update PTSDST

 

 

 

 

 

 

0

=

reload original PTS destination address after each byte or

 

 

 

 

 

 

 

word transfer

 

 

 

 

 

 

1

=

retain current PTS destination address after each byte or

 

 

 

 

 

 

 

word transfer

 

 

 

 

 

 

 

 

 

 

 

SI

PTSSRC Autoincrement

 

 

 

 

 

0

=

do not increment the contents of PTSSRC

 

 

 

 

 

1

=

increment the contents of PTSSRC after each byte or word

 

 

 

 

 

 

 

transfer

 

 

 

 

 

 

 

 

 

 

 

 

DI

PTSDST Autoincrement

 

 

 

 

 

0

=

do not increment the contents of PTSDST

 

 

 

 

 

1

=

increment the contents of PTSDST after each byte or word

 

 

 

 

 

 

 

transfer

 

 

 

 

 

 

 

 

 

 

PTSCOUNT

PTSCB + 0

Consecutive Word or Byte Transfers

 

 

 

 

Defines the number of words or bytes that will be transferred during the

 

 

 

 

single transfer routine. Each word or byte transfer is one PTS cycle.

 

 

 

 

Maximum value is 255.

 

 

 

 

 

 

 

 

 

 

 

 

In single transfer mode, the DU and SU bits and DI and SI bits are paired. Each pair must be set or cleared together. However, the two pairs, DU/SU and DI/SI, need not be equal.

Figure 5-12. PTS Control Block – Single Transfer Mode (Continued)

The PTSCB in Table 5-5 defines nine PTS cycles. Each cycle moves a single word from location 20H to an external memory location. The PTS transfers the first word to location 6000H. Then it increments and updates the destination address and decrements the PTSCOUNT register; it does not increment the source address. When the second cycle begins, the PTS moves a second word from location 20H to location 6002H. When PTSCOUNT equals zero, the PTS will have filled locations 6000H–600FH, and an end-of-PTS interrupt is ge nerated.

5-23

Соседние файлы в предмете Электротехника