COP888EB
8-Bit CMOS ROM Based Microcontrollers with 8k
Memory, CAN Interface, 8-Bit A/D, and USART
General Description
The COP888EB ROM based microcontrollers are highly integrated COP8
advanced features including a CAN 2.0B (passive) interface,
A/D and USART. These single-chip CMOS devices are
suited for applications requiring a full featured controller with
a CAN interface, low EMI, and versatile communications interfaces. COP87L8EB/RB devices are pin and software
compatible 16k or 32k OTP (One Time Programmable) versions for pre-production, and for use with a range of COP8
software and hardware development tools.
™
Feature core devices with 8k memory and
September 1999
Features include an 8-bit memory mapped architecture, 10
MHz CKI with 1µs instruction cycle, two multi-function 16-bit
timer/counters, WATCHDOG
2.0B (passive) interface, MICROWIRE/PLUS
SPI master/slave interface, fully buffered USART, 8-bit A/D
with 8 channels, two power saving HALT/IDLE modes,
MIWU, idle timer, software selectable I/O options, low EMI
4.5V to 5.5V operation, and 44/68 pin packages.
Note: A companion device with CAN interface, less I/O and
memory, and PWM timer is the COP888BC.
Devices included in this datasheet are:
™
and Clock Monitor, CAN
™
serial I/O,
COP888EB 8–Bit CMOS ROM Based Microcontrollers with 8k Memory, CAN Interface, 8–Bit A/D,
COP688EB8k ROM1923144 PLCC-55 to +125˚C
COP888EB8k ROM1923144 PLCC-40 to +85˚C
COP689EB8k ROM1925868 PLCC-55 to +125˚C
COP889EB8k ROM1925868 PLCC-40 to +85˚C
Key Features
n CAN bus interface, with Software Power save mode
n 8-bit A/D Converter with 8 channels
n Fully buffered USART
n Multi-input wake up (MIWU) on both Port L and M
n SPI Compatible Master/Slave Interface
n Quiet Design (Low Radiated Emissions)
n 8096 bytes of on-board ROM
n 192 bytes of on-board RAM
Additional Peripheral Features
n Idle timer (programmable)
n Two 16-bit timer, with two 16-bit registers supporting
n Port I—8-bit input port combining either digital input, or
up to eight A/D input channels
n Port L—8-bit bidirectional I/O port, including alternate
functions for:
— USART Transmit/Receive I/O
— Multi-input-wake up (MIWU on all pins)
n Port M—8-bit I/O port, with the following alternate
function
— SPI Interface
— MIWU
™
Input and Output
— CAN Interface Wake-up (MSB)
— Timer 2 Input or Output (Depending on mode
selected)
n Port N—8-bit bidirectional I/O
— SPI Slave Select Expander
n Two 16-bit multi-function Timer counters (T1 and T2)
plus supporting registers
— (I/P Capture, PWM and Event Counting)
n Idle timer—Provides a basic time-base counter, (with
interrupt) and automatic wake up from IDLE mode
programmable
n MICROWIRE/PLUS—MICROWIRE serial peripheral
interface, supporting both Master and Slave operation
n HALT and IDLE—Software programmable low current
modes
— HALT—Processor stopped, Minimum current
— IDLE — Processor semi-active more than 60%power
saving
n 8 kBytes ROM and 192 bytes of on board static RAM
n SPI Master/Slave interface includes 12 bytes Transmit
and 12 bytes Receive FIFO Buffers. Operates up to 1M
Bit/S
n On board programmable WATCHDOG and CLOCK
Monitor
Applications
n Automobile Body Control and Comfort System
n Integrated Driver Informaiton Systems
n Steering Wheel Control
n Car Radio Control Panel
n Sensor/Actuator Applications in Automotive and
If Military/Aerospace specified devices are required,
please contact the National Semiconductor Sales Office/
Distributors for availability and specifications.
Supply Voltage (V
Voltage at Any Pin−0.3V to V
)6V
CC
+0.3V
CC
Total Current into V
Pins (Source)90 mA
CC
Total Current out of GND Pins (Sink)100 mA
Storage Temperature Range−65˚C to +150˚C
Note 1:
Absolute maximum ratings indicate limits beyond which damage to
the device may occur. DC and AC electrical specifications are not ensured
when operating the device at absolute maximum ratings.
DC Electrical Characteristics COP88xEB
−40˚C ≤ TA≤ +85˚C
ParameterConditionsMinTypMaxUnits
Operating Voltage4.55.5V
Power Supply Ripple (Note 2)Peak-to-Peak0.1 V
Supply CurrentV
= 5.5V, tc=1µs16mA
CC
CC
CKI = 10 MHz (Note 3)
HALT Current (Notes 4, 5)V
IDLE Current (Note 5)V
D Outputs (sink)15mA
Tx0 (Sink) (Note 8)30mA
Tx1 (Source) (Note 8)30mA
All Other3mA
Maximum Input CurrentRoom Temp
±
100mA
without Latchup (Notes 6, 8)
RAM Retention Voltage, V
(Note 7)500 ns Rise and Fall Time2.0V
r
Input Capacitance(Note 8)7pF
Load Capacitance on D21000pF
Note 2: Maxiumum rate of voltage change must be<0.5V/ms
V
V
V
V
V
V
www.national.com5
DC Electrical Characteristics COP88xEB (Continued)
Note 3: Supply current is measured after running 2000 cycles with a square wave CKI input, CKO open, inputs at VCCor GND, and outputs open.
Note 4: TheHALT mode will stop CKI from oscillating in the Crystal configurations. Halt test conditions: All inputs tied to V
figured as outputs and programmed low; D outputs programmed high. Parameter refers to HALT mode entered via setting bit 7 of the Port G data register. Part will
pull up CKI during HALT in crystal clock mode. Both CAN main comparator and the CAN Wakeup comparator need to be disabled.
Note 5: HALT and IDLE current specifications assume CAN block comparators are disabled.
Note 6: PinsG6 and RESET are designed with a high voltage input network. These pins allow input voltages greater than V
to VCCwhen biased at voltages greater than VCC(the pins do not have source current when biasedatavoltagebelowVCC). The effective resistancetoVCCis 750Ω
(typical). These two pins will not latch up. The voltage at the pins must be limited to less than 14V.
Note 7: Condition and parameter valid only for part in HALT mode.
Note 8: Parameter characterized but not tested.
; Port C, G, E, F, L, M and N I/Os con-
CC
and the pins will have sink current
CC
www.national.com6
Absolute Maximum Ratings (Note 9)
If Military/Aerospace specified devices are required,
please contact the National Semiconductor Sales Office/
Distributors for availability and specifications.
Supply Voltage (V
Voltage at Any Pin−0.3V to V
)7V
CC
+0.3V
CC
Total Current into V
Pins (Source)100 mA
CC
Total Current out of GND Pins (Sink)110 mA
Storage Temperature Range−65˚C to +150˚C
Note 9:
Absolute maximum ratings indicate limits beyond which damage to
the device may occur. DC and AC electrical specifications are not ensured
when operating the device at absolute maximum ratings.
DC Electrical Characteristics COP68xEB
−55˚C ≤ TA≤ +125˚C
ParameterConditionsMinTypMaxUnits
Operating Voltage4.55.5V
Power Supply Ripple (Note 10)Peak-to-Peak0.1 V
Supply CurrentV
= 5.5V, tc=1µs16mA
CC
CKI = 10 MHz (Note 11)
HALT Current (Notes 12, 13)V
IDLE Current (Note 13)V
= 5.5V, CKI = 0 MHz10µA
CC
= 5.5V, tc= 1 µs5.5mA
CC
CKI = 10 MHz
Input Levels (V
IH,VIL
)
Reset, CKI
Logic High0.8V
CC
Logic Low0.2V
All Other Inputs
Logic High0.7V
CC
Logic Low0.2V
Hi-Z Input LeakageV
Input Pull-Up CurrentV
Port G, L and M Input Hysteresis(Note 16)0.05V
All Other2.5mA
Maximum Input CurrentRoom Temp
without Latchup (Notes 14, 16)
RAM Retention Voltage, V
(Note 15)500 ns Rise and Fall Time2.0V
r
Input capacitance(Note 16)7pF
Load Capacitance on D21000pF
Note 10: Maxiumum rate of voltage change must be<0.5V/ms
CC
CC
CC
±
5µA
±
5.0µA
±
100mA
V
V
V
V
V
V
www.national.com7
DC Electrical Characteristics COP68xEB (Continued)
Note 11: Supply current is measured after running 2000 cycles with a square wave CKI input, CKO open, inputs at VCCor GND, and outputs open.
Note 12: TheHALT mode will stop CKI from oscillating in the Crystal configurations. Halt test conditions: All inputs tied to V
figured as outputs and programmed low; D outputs programmed high. Parameter refers to HALT mode entered via setting bit 7 of the Port G data register. Part will
pull up CKI during HALT in crystal clock mode. Both CAN main comparator and the CAN Wakeup comparator need to be disabled.
Note 13: HALT and IDLE current specifications assume CAN block comparators are disabled.
Note 14: PinsG6 and RESET are designed with a high voltage input network. These pins allow input voltages greater than V
to VCCwhen biased at voltages greater than VCC(the pins do not have source current when biasedatavoltagebelowVCC). The effective resistancetoVCCis 750Ω
(typical). These two pins will not latch up. The voltage at the pins must be limited to less than 14V.
Note 15: Condition and parameter valid only for part in HALT mode.
Note 16: Parameter characterized but not tested.
; Port C, G, E, F,L,MandNI/Oscon-
CC
and the pins will have isnk current
CC
AC Electrical Characteristics COP68xEB and COP88xEB
−55˚C ≤ TA≤ +125˚C
ParameterConditionsMinTypMaxUnits
Instruction Cycle Time (t
Crystal/ResonatorV
Inputs
t
SETUP
t
HOLD
Output Propagation Delay (t
SK, SOV
All othersV
MICROWIRE
Setup Time (t
Hold Time (t
UWH
Output Pop Delay (t
Input Pulse Width
Interrupt High Time1t
Interrupt Low Time1t
Timer 1, 2 High Time1t
Timer 1, 2 Low Time1t
Reset Pulse Width (Note 20)1.0µs
tc= Instruction Cycle Time
Note 17: Themaximum bus speed achievable with the CAN interface is a function of crystal frequency, message length and software overhead. The device can sup-
port a bus speed of up to 1 Mbit/S with a 10 MHz oscillator and 2 byte messages. The 1M bus speed refers to the rate at which protocol and data bits are transferred
on the bus. Longer messages require slower bus speeds due to the time required for software intervention between data bytes. The device will support a maximum
of 125k bits/s with eight byte messages and a 10 MHz oscillator.
Note 18: For device testing purpose of all AC parameters, V
Note 19: The output propagation delay is referenced to the end of the instruction cycle where the output change occurs.
Note 20: Parameter not tested.
)
c
≥ 4.5V1.0DCµs
CC
VCC≥ 4.5V200ns
VCC≥ 4.5V60ns
) (Note 19)CL= 100 pF, RL= 2.2 kΩ
PD1,tPD0
) (Note 20)20ns
UWS
≥ 4.5V0.7µs
CC
≥ 4.5V1µs
CC
) (Note 20)56ns
)220ns
UPD
will be tested at 0.5*VCC.
OH
c
c
c
c
On-Chip Voltage Reference
−55˚C ≤ TA≤ +125˚C
ParameterConditionsMinMaxUnits
<
Reference VoltageI
V
REF
Reference SupplyI
Current, I
DD
Note 21: Reference supply IDDis supplied for information purposes only, it is not tested.
Non-Linearity
Deviation from the Best Straight Line
Differential Non-Linearity
Common Mode Input Range (Note 24)GNDV
DC Common Mode Error
Off Channel Leakage Current12.0µA
On Channel Leakage Current12.0µA
A/D Clock Frequency (Note 23)0.11.67MHz
Conversion Time (Note 22)17A/D Clock Cycles
Internal Reference Resistance Turn-On Time (Note 25)1µs
Note 22: ConversionTime includes sample and hold time.
Note 23: See Prescaler description.
Note 24: ForV
input voltages below ground or above the V
to conduct — especially at elevated temperatures, and cause errors for analog inputs near full-scale. The spec allows 50 mV forward bias of either diode. This means
that as long as the analog V
voltage range will therefore require a minimum supply voltage of 4.950 V
Note 25: Time for internal reference resistance to turn on after coming out of Halt or Idle Mode.
(−)>=VIN(+) the digital output code will be 0000 0000. Twoon-chip doides are ties to each analog input. The diodes will forward conduct for analog
IN
does not exceed the supply voltage by more than 50 mV, the output code will be correct. To achieve an absolute 0 VDCto 5 VDCinput
IN
supply.Be careful, during testing at low VCClevels (4.5V), as high level analog inputs (5V) can cause this input diode
CC
over temperature variations, initial tolerance and loading.
DC
±
2LSB
±
1LSB
±
1LSB
CC
±
0.5LSB
V
DS012837-4
FIGURE 3. MICROWIRE/PLUS Timing Diagram
www.national.com9
A/D Converter Specifications (Continued)
FIGURE 4. SPI Timing Diagram
Typical Performance Characteristics (−55˚C ≤ T
A
=
+125˚C)
DS012837-5
DS012837-57DS012837-58
DS012837-59DS012837-60
www.national.com10
Typical Performance Characteristics (−55˚C ≤ T
DS012837-61
Pin Description
VCCand GND are the power supply pins.
CKI is the clock input. The clock can come from a crystal os-
cillator (in conjunction with CKO). See Oscillator Description
section.
RESET is the master resetinput. See Reset Description section.
The device contains seven bidirectional 8-bit I/O ports (C, E,
F, G, L, M, N) where each individual bit may be independently configured as an input (Schmitt trigger inputs on all
ports), output or TRI-STATE under program control. Three
data memory address locations are allocated for each of
these I/O ports. Each I/O port has two associated 8-bit
memory mapped registers, the CONFIGURATION register
and the output DATA register.A memory mapped address is
also reserved for the input pins of each I/O port. (See the
memory map for the various addresses associated with the
I/O ports.)
device. The DATA and CONFIGURATION registers allow for
each port bit to be individually configured under software
control as shown below:
Port L and M are 8-bit I/O ports, they support Multi-Input
Wake-up (MIWU) on all eight pins. All L-pins and M-pins
have Schmitt triggers on the inputs.
Port L and M only have one (1) interrupt vector.
Figure 5
shows the I/O port configurations for the
ConfigurationDataPort Set-Up
RegisterRegister
00Hi-Z Input
(TRI-STATE Output)
01Input with Weak Pull-Up
10Push-Pull Zero Output
11Push-Pull One Output
Port L has the following alternate features:
L7 MIWU
L6 MIWU
L5 MIWU
L4 MIWU
L3 MIWU or RDX
L2 MIWU or TDX
L1 MIWU or CKX
L0 MIWU
Port G is an 8-bit port with 5 I/O pins (G0–G5), an input pin
(G6), and one dedicated output pin (G7). Pins G0–G6 all
have Schmitt Triggers on their inputs. G7 serves as the dedicated output pin for the CKO clock output. There are two registers associated with the G Port, a data register and a configuration register. Therefore, each of the 6 I/O bits (G0–G5)
can be individually configured under software control.
Since G6 is an input only pin and G7 is the dedicated CKO
clock output pin the associated bits in the data and configuration registers for G6 and G7 are used for special purpose
functions as outlined below. Reading the G6 and G7 data
bits will return zeroes.
Note that the chip will be placed in the HALTmode by wirting
a ’’1” to bit 7 of the Port G Data Register. Similarly the chip
will be placed in the IDLE mode by writing a “1” to bit 6 of the
Port G Data Register.
=
+125˚C) (Continued)
A
FIGURE 5. I/O Port Configurations
DS012837-6
www.national.com11
Pin Description (Continued)
Writing a “1” to bit 6 of the Port G Configuration Register enables the MICROWIRE/PLUS to operate with the alternate
phase of the SK clock
Config. Reg.Data Reg.
G7CLKDLYHALT
G6Alternate SKIDLE
Port G has the following alternate features:
G6 SI (MICROWIRE Serial Data Input)
G5 SK (MICROWIRE Serial Clock)
G4 SO (MICROWIRE Serial Data Output)
G3 T1A (Timer I/O)
G2 (Timer T1 Capture Input)
G1 Dedicated WATCHDOG output
G0 INTR (External Interrupt Input)
Port G has the following dedicated function:
G7 CKO Oscillator dedicated output
Port M is a bidirectional I/O, it may be configured in software
as Hi-Z input, weak pull-up, or push-pull output. These pins
may be used as general purpose input/output pins or for selected altlernate functions.
Port M pins have optional alternate functions. Each pin
(M0–M5) has been assigned an alternate data, configuration, or wakeup source. If the respective alternate function is
selected the content of the associated bits in the configuration and/or data register are ignored. If an alternate wakeup
source is selected the input level at the respective pin will be
ignored for the purpose of triggering a wakeup event, however it will still be possible to read that pin by accessing the
input register. The SPI (Serial Peripheral Interface) block, for
example, uses four of the Port M pins to automatically reconfigure its MISO (Master Input, Slave Output), MOSI
(Master Output, Slave Input), SCK (Serial Clock) and SlaveSelect pins as inputs or outputs, depending on whether the
interface has been configured as a Master or Slave. When
the SPI interface is disabled those pins are available as general purpose I/O pins configurable by user software writing to
the associated data and configuration bits. The CAN interface on the device makes use of one of the Port M’s alternate wake-ups, to trigger a wakeup if such a condition has
been detected on the CAN’s dedicated receive pins.
Port M has the following alternate pin functions:
M7 Multi-input Wakeup or CAN
M6 Multi-input Wakeup
M5 Multi-input Wakeup or T2B
M4 Multi-input Wakeup or T2A
M3 Multi-input Wakeup or SS
M2 Multi-input Wakeup or SCK
M1 Multi-input Wakeup or MOSI
M0 Multi-input Wakeup or MISO
Ports C, E, F and N are general-purpose, bidirectional I/O
ports.
Any device package that has Port C, E, F,M, N but has fewer
than eight pins, contains unbonded, floating pads internally
on the chip. For these types of devices, the software should
writea1totheconfiguration register bits corresponding to
the non-existent port pins. This configures the port bits as
outputs, thereby reducing leakage current of the device.
Port N is an 8-bit wide port with alternate function capability
used for extending the slave select (SS) lines of the on SPI
interface. The SPI expander block provides mutually exclusive slave select extension signals (ESS0 to ESS7) according to the state of the SS line and specific contents of the SPI
shift register. These slave select extension lines can be
routed to the Port N I/O pins by enabling the alternate function of the port in the PORTNX register. If enabled, the internal signal on the ESSx line causes the ports state to change
exactly like a change to the PORTND register. It is the user’s
responsibility to switch the port to an output when enabling
the alternate function.
CAN pins: For the on-chip CAN interface this device has five
dedicated pins with the following features:
V
On-chip reference voltage with the value of VCC/2
REF
Rx0CAN receive data input pin.
Rx1CAN receive data input pin.
Tx0CAN transmit data output pin. This pin may be put in
the TRI-STATE mode with the TXEN0 bit in the CAN
Bus control register.
Tx1CAN transmit data output pin. This pin may be put in
the TRI-STATE mode with the TXEN1 bit in the CAN
Bus control register.
ALTERNATE PORT FUNCTIONS
Many general-purpose pins have alternate functions. The
software can program each pin to be used either for a
general-purpose or for a specific function.The chiphardware
determines which of the pins have alternate functions, and
what those functions are. This section lists the alternate
functions available on each of the pins.
Port D is an 8-bit output port that is preset high when RESET
goes low. The user can tie two or more port D outputs (except D2) together in order to get a higher drive.
Note: Care must be exercised with D2 pin operation. At RESET, the external
loads on this pin must ensure that the output voltages stay above 0.8
to prevent the chip from entering special modes.Also keep the ex-
V
CC
ternal loading on D2 to
<
1000 pF.
Port I is an 8-bit Hi-Z input port, and also provides the analog
inputs to the A/D converter. If unterminated, Port I pins will
draw power only when addressed.
Functional Description
The architecture of the device utilizes a modified Harvard architecture. With the Harvard architecture, the control store
program memory (ROM) is separated from the data store
memory (RAM). Both ROM and RAM have their own separate addressing space with separate address buses. The architecture, though based on Harvard architecture, permits
transfer of data from ROM to RAM.
www.national.com12
Functional Description (Continued)
CPU REGISTERS
The CPU can do an 8-bit addition, subtraction, logical or shift
operation in one instruction (t
There are five CPU registers:
A is the 8-bit Accumulator Register
PC is the 15-bit Program Counter Register
PU is the upper 7 bits of the program counter (PC)
PL is the lower 8 bits of the program counter (PC)
B is an 8-bit RAM address pointer, which can be optionally
post auto incremented or decremented.
X is an 8-bit alternate RAM address pointer, which can be
optionally post auto incremented or decremented.
SP is the 8-bit stack pointer, which points to the subroutine/
interrupt stack (in RAM). The SP is initialized to RAM address 02F with reset.
All the CPU registers are memory mapped with the exception of the Accumulator (A) and the Program Counter (PC).
PROGRAM MEMORY
Program memory for the device consists of 8 kbytes of ROM.
These bytes may hold program instructions or constant data
(data tables for the LAID instruction, jump vectors for the JID
instruction and interrupt vectors for the VIS instruction). The
program memory is addressed by the 15-bit program
counter (PC). All interrupts in the device vector to program
memory location 0FF Hex.
DATA MEMORY
The data memory address space includes the on-chip RAM
and data registers, theI/O registers (Configuration, Data and
Pin), the control registers, the MICROWIRE/PLUS SIO shift
register, and the various registers, and counters associated
with the timers (with the exception of the IDLE timer). Data
memory is addressed directly by the instruction or indirectly
by the B, X and SP pointers.
The device has 192 bytes of RAM. Sixteen bytes of RAM are
mapped as “registers” at addresses 0F0 to 0FF Hex. These
registers can be loaded immediately, and also decremented
and tested with the DRSZ (decrement register and skip if
zero) instruction. The memory pointer registers X, SP,and B
are memory mapped into this space at address locations
0FC to 0FE Hex respectively, with the other registers (other
than reserved register 0FF) being available for general usage.
The instruction set permits any bit in memory to be set, reset
or tested. All I/O and registers (except A and PC) are
memory mapped; therefore I/O bits and register bits can be
directly and individually set, reset and tested. The accumulator (A) bits can also be directly and individually tested.
Note: RAM contents are undefined upon power-up.
RESET
The RESET input when pulled low initializes the microcontroller. Initialization will occur whenever the RESET input is
pulled low. Upon initialization, the data and configuration
registers for Ports L and G, are cleared, resulting in these
Ports being initialized to the TRI-STATE mode. Port D is initialized high with RESET. The PC, CNTRL, and INCTRL
control registers are cleared. The Multi-Input Wakeup registers WKEN, WKEDG, and WKPND are cleared. The Stack
Pointer, SP, is initialized to 06F Hex.
The following initializations occur with RESET:
) cycle time.
c
SPI:
SPICNTRL: Cleared
SPISTAT: Cleared
STBE Bit: Set
T1CNTRL & T2CNTRL: Cleared
ITMR: Cleared and IDLE timer period is reset to 4k Instr.
CLK
ENAD: Cleared
ADDSLT: Random
SIOR: Unaffected after RESET with power already ap-
plied.
Random after RESET at power on.
Port L: TRI-STATE
Port G: TRI-STATE
Port D: HIGH
PC: CLEARED
PSW, CNTRL and ICNTRL registers: CLEARED
Accumulator and Timer 1:
RANDOM after RESET with power already applied
RANDOM after RESET at power-on
SP (Stack Pointer): Loaded with 6F Hex
B and X Pointers:
UNAFFECTED after RESET with power already applied
RANDOM after RESET at power-up
RAM:
UNAFFECTED after RESET with power already applied
RANDOM after RESET at power-up
CAN: The CAN Interface comes out of external reset in the
“error-active” state and waits until the user’s software sets either one or both of the TXEN0, TXEN1
bits to “1”. After that, the device will not start transmission or reception of a frame util eleven consecutive “recessive” (undriven) bits have been received.
This is done to ensure that the output drivers are not
enamble during an active message on the bus.
CSCAL, CTIM, TCNTL, TEC, REC: CLEARED
RTSTAT: CLEARED with the exception of the TBE bit which
is set to 1
RID, RIDL, TID, TDLC: RANDOM
WATCHDOG: The device comes out of reset with both the
WATCHDOG logic and the Clock Monitor
detector armed, with the WATCHDOG service window bits set and the Clock Monitor
bit set. The WATCHDOG and Clock Monitor
circuits are inhibited during reset. The
WATCHDOG service window bits being initialized high default to the maximum
WATCHDOG service window of 64k t
cycles. The Clock Monitor bit being initial-
c
clock
ized high will cause a Clock Monitor bit being initialized high will cause a Clock Monitor error following reset if the clock has not
reached the minimum specified frequency
at the termination of reset. A Clock Monitor
error will cause an active low error output on
pin G1. This error output will continue until
16 t
–32 tcclock cycles following the clock
c
frequency reaching the minimum specified
value, at which time the G1 output will enter
the TRI-STATE mode.
www.national.com13
Functional Description (Continued)
The RESET signal goes directly to the
HALT latch to restart a halted chip.
When using external reset, the external RC network shown
in
Figure 6
should be used to ensure that the RESET pin is
held low until the power supply to the chip stabilizes. Under
no circumstances should the RESET pin be allowed to float.
RC>5 x Power Supply Rise Time
DS012837-7
FIGURE 6. Recommended Reset Circuit
Oscillator Circuits
The chip can be driven by a clock input on the CKI input pin
which can be between DC and 10 MHz. The CKO output
clock is on pin G7. The CKI input frequency is divided by 10
to produce the instruction cycle clock (1/t
Figure 7
shows the Crystal diagram.
).
c
CRYSTAL OSCILLATOR
CKI and CKO can be connected to make a closed loop crystal (or resonator) controlled oscillator.
DS012837-8
FIGURE 7. Crystal Oscillator Diagram
Table 1 shows the component values required for various
standard crystal values.
The Half-Carry flag is also affected by all the instructions that
affect the Carry flag. The SC (Set Carry) and R/C (Reset
Carry) instructions will respectively setor clear both the carry
flags. In addition to the SC and R/C instructions, ADC,
SUBC, RRC and RLC instructions affect the Carry and Half
Carry flags.
ICNTRL Register (Address X'00E8)
Reserved LPEN T0PND T0EN µWPND µWEN T1PNDB T1ENB
Bit 7Bit 0
www.national.com14
Control Registers (Continued)
The ICNTRL register contains the following bits:
Reserved This bit is reserved and should be zero
The T2CNTRL control register contains the following bits:
T2C3Timer T2 mode control bit
T2C2Timer T2 mode control bit
T2C1Timer T2 mode control bit
T2C0Timer T2 Start/Stop control in timer
modes 1 and 2, T2 Underflow Interrupt Pending Flag in timer mode 3
T2PNDA Timer T2 Interrupt Pending Flag (Autoreload
RA in mode 1, T2 Underflow in mode 2, T2A
capture edge in mode 3)
T2ENATimer T2 Interrupt Enable for Timer Underflow
or T2A Input capture edge
T2PNDB Timer T2 Interrupt Pending Flag for T2B cap-
ture edge
T2ENBTimer T2 Interrupt Enable for Timer Underflow
or T2B Input capture edge
Timers
The device contains a very versatile set of timers (T0, T1 and
T2). All timers and associated autoreload/capture registers
power up containing random data.
TIMER T0 (IDLE TIMER)
The device supports applications that require maintaining
real time and low power with the IDLE mode. This IDLE
mode support is furnished by the IDLE timer T0, which is a
16-bit timer. The Timer T0 runs continuously at the fixed rate
of the instruction cycle clock, t
write to the IDLE Timer T0, which is a count down timer.
The Timer T0 supports the following functions:
Exit out of the Idle Mode (See Idle Mode description)
•
WATCHDOG logic (See WATCHDOG description)
•
Start up delay out of the HALT mode
•
Figure 8
is a functional block diagram showing the structure
of the IDLE Timer and its associated interrupt logic.
Bits 11 through 15 of the ITMR register can be selected for
triggering the IDLE Timer interrupt. Each time the selected
bit underflows (every 4k, 8k, 16k, 32k or 64k instruction
cycles), the IDLE Timer interrupt pending bit T0PND is set,
thus generating an interrupt (if enabled), and bit 6 of the Port
G data register is reset, thus causing an exit from the IDLE
mode if the device is in that mode.
. The user cannot read or
c
In order for an interrupt to be generated, the IDLE Timer interrupt enable bit T0EN must be set, and the GIE (Global Interrupt Enable) bit must also be set. The T0PND flag and
T0EN bit are bits 5 and 4 of the ICNTRL register, respectively.The interrupt can be used for any purpose. Typically,it
is used to perform a task upon exit from the IDLE mode. For
more information on the IDLE mode, refer to the Power Save
Modes section.
DS012837-9
FIGURE 8. Functional Block Diagram for Idle Timer T0
The Idle Timer period is selected by bits 0–2 of the ITMR
register Bits 3–7 of the ITMR Register are reserved and
should not be used as software flags.
ITMR Register (Address X’0xCF)
ReservedITSEL2 ITSEL1 ITSLE0
Bit 7Bit 0
TABLE 2. Idle Timer Window Length
ITSEL2ITSEL1ITSEL0Idle Timer Period
(Instruction Cycles)
0004,096
0018,192
01016,384
01132,768
1XX65,536
The ITMR register is cleared on Reset and the Idle Timer period is reset to 4,096 instruction cycles.
Any time the IDLE Timer period is changed there is the possibility of generating a spurious IDLE Timer interrupt by setting the T0PND bit. The user is advised to disable IDLE
Timer interrupts prior to changing the value of the ITSEL bits
of the ITMR Register and then clear theT0PND bit before attempting to synchronize operation to the IDLE Timer.
TIMER T1 and TIMER T2
The device has a set of three powerful timer/counter blocks,
T1 and T2. The associated features and functioning of a
timer block are described by referring to the timer block Tx.
Since the three timer blocks, T1 and T2 are identical, all
comments are equally applicable to either of the three timer
blocks.
Each timer block consists of a 16-bit timer, Tx, and two supporting 16-bit autoreload/capture registers, RxA and RxB.
Each timer block has two pins associated with it, TxA and
www.national.com15
Timers (Continued)
TxB. The pin TxA supports I/O required by the timer block,
while the pin TxB is an input to the timer block. The powerful
and flexible timer block allows the device to easily perform all
timer functions with minimal software overhead. The timer
block has three operating modes: Processor Independent
PWM mode, External Event Counter mode, and Input Capture mode.
The control bits TxC3,TxC2, and TxC1 allow selection of the
different modes of operation.
Mode 1. Processor Independent PWM Mode
As the name suggests, this mode allows the device to generate a PWM signal with very minimal user intervention.
The user only has to define the parameters of the PWM signal (ON time and OFF time).Once begun, the timer block will
continuously generate the PWM signal completely independent of the microcontroller. The user software services the
timer block only when the PWM parameters require updating.
In this mode the timer Tx counts down at a fixed rate of t
Upon every underflow the timer is alternately reloaded with
the contents of supporting registers, RxA and RxB. The very
first underflow of the timer causes the timer to reload from
the register RxA. Subsequent underflows cause the timer to
be reloaded from the registers alternately beginning with the
register RxB.
The Tx Timer control bits, TxC3, TxC2 and TxC1 set up the
timer for PWM mode operation.
Figure 9
shows a block diagram of the timer in PWM mode.
per PWM period on either the rising or falling edge of the
PWM output. Alternatively, the user may choose to interrupt
on both edges of the PWM output.
Mode 2. External Event Counter Mode
This mode is quite similar to the processor independent
PWM mode described above. The main difference is that the
timer,Tx, is clocked by the input signal from theTxA pin. The
Tx timer control bits, TxC3, TxC2 andTxC1 allow the timer to
be clocked either on a positive or negative edge from the
TxA pin. Underflows from the timer are latched into the TxPNDA pending flag. Setting the TxENA control flag will cause
an interrupt when the timer underflows.
In this mode the input pin TxB can be used as an independent positive edge sensitive interrupt input if the TxENB control flag is set. The occurrence of the positive edge on the
TxB input pin is latched to the TxPNDB flag.
Figure 10
shows a block diagram of the timer in External
Event Counter mode.
.
c
DS012837-10
FIGURE 9. Timer in PWM Mode
The underflows can be programmed to toggle the TxAoutput
pin. The underflows can also be programmed to generate interrupts.
Underflows from the timer are alternately latched into two
pending flags, TxPNDA and TxPNDB. The user must reset
these pending flags under software control. Two control enable flags, TxENA and TxENB, allow the interrupts from the
timer underflow to be enabled or disabled. Setting the timer
enable flag TxENA will cause an interrupt when a timer underflow causes the RxA register to be reloadedinto the timer.
Setting the timer enable flag TxENB will cause an interrupt
when a timer underflow causes the RxB register to be reloaded into the timer. Resetting the timer enable flags will
disable the associated interrupts.
Either or both of the timer underflow interrupts may be enabled. This gives the user the flexibility of interrupting once
Note: The PWM output is not available in this mode since the TxA pin is
being used as the counter input clock.
DS012837-11
FIGURE 10. Timer in External Event Counter Mode
Mode 3. Input Capture Mode
The device can precisely measure external frequencies or
time external events by placing the timer block, Tx, in the input capture mode.
In this mode, the timer Tx is constantly running at the fixed t
rate. The two registers, RxA and RxB, act as capture registers. Each register acts inconjunction with a pin. The register
RxAacts in conjunction with the TxApin and the register RxB
acts in conjunction with the TxB pin.
The timer value gets copied over into the register when a
trigger event occurs on its corresponding pin. Control bits,
TxC3, TxC2 and TxC1, allow the trigger events to be specified either as a positive or a negative edge. The trigger condition for each input pin can be specified independently.
The trigger conditions can also be programmed to generate
interrupts. The occurrence of the specified trigger condition
on the TxA and TxB pins will be respectively latched into the
pending flags, TxPNDA and TxPNDB. The control flag
TxENA allows the interrupt on TxA to be either enabled or
disabled. Setting the TxENA flag enables interrupts to be
generated when the selected trigger condition occurs on the
TxA pin. Similarly, the flag TxENB controls the interrupts
from the TxB pin.
Underflows from the timer can also be programmed to generate interrupts. Underflows are latched into the timer TxC0
pending flag (the TxC0 control bit serves as the timer underflow interrupt pending flag in the Input Capture mode). Con-
c
www.national.com16
Timers (Continued)
sequently, the TxC0 control bit should be reset when entering the Input Capture mode. The timer underflow interrupt is
enabled with the TxENA control flag. When a TxA interrupt
occurs in the Input Capture mode, the user must check both
whether a TxA input capture or a timer underflow (or both)
caused the interrupt.
FIGURE 11. Timer in Input Capture Mode
TIMER CONTROL FLAGS
The control bits and their functions are summarized below.
TxC3Timer mode control
TxC2Timer mode control
TxC1Timer mode control
TxC0Timer Start/Stop control in Modes 1 and 2 (Pro-
cessor Independent PWM and External Event
Counter), where 1 = Start, 0 = Stop
Timer Underflow Interrupt Pending Flag in
Mode 3 (Input Capture)
TxPNDA Timer Interrupt Pending Flag
TxENATimer Interrupt Enable Flag
1 = Timer Interrupt Enabled
0 = Timer Interrupt Disabled
TxPNDB Timer Interrupt Pending Flag
TxENBTimer Interrupt Enable Flag
1 = Timer Interrupt Enabled
0 = Timer Interrupt Disabled
Figure 11
ture mode.
shows a block diagram of the timer in Input Cap-
DS012837-12
www.national.com17
Timers (Continued)
The timer mode control bits (TxC3, TxC2 and TxC1) are detailed below:
ModeTxC3TxC2TxC1Description
Interrupt A
Source
101PWM: TxA ToggleAutoreload RAAutoreload RBt
1
100PWM: No TxA
Autoreload RAAutoreload RB
Toggle
000External Event
2
001External Event
Counter
Counter
Timer
Underflow
Timer
Underflow
Pos. TxB EdgePos. TxA
Pos. TxB EdgePos. TxA
010Captures:Pos. TxA EdgePos. TxB Edget
TxA Pos. Edgeor Timer
TxB Pos. EdgeUnderflow
110Captures:Pos. TxANeg. TxBt
TxA Pos. EdgeEdge or TimerEdge
3
011Captures:Neg. TxANeg. TxBt
TxB Neg. EdgeUnderflow
TxA Neg. EdgeEdge or TimerEdge
TxB Neg. EdgeUnderflow
111Captures:Neg. TxANeg. TxBt
TxA Neg. EdgeEdge or TimerEdge
TxB Neg. EdgeUnderflow
Power Save Modes
The device offer the user two power save modes of operation: HALT and IDLE. In the HALT mode, all microcontroller
activities are stopped. In the IDLE mode, the on-board oscillator circuitry and timer T0 are active but all other microcontroller activities are stopped. In either mode, all on-board
RAM, registers, I/O states, and timers (with the exception of
T0) are unaltered.
HALT MODE
The device is placed in the HALTmode by writing a ’’1” to the
HALT flag (G7 data bit). All microcontroller activities, including the clock, and timers, are stopped. In the HALT mode,
the power requirements of the device are minimal and the
applied voltage (V
without altering the state of the machine.
) may be decreased to Vr (Vr = 2.0V)
CC
CAN HALT/IDLE mode:
In order to reduce the device overall current consumption in
HALT/IDLE mode a two step power save mechanism is
implemented on the device:
Step 1: Disable main receive comparator. This is done by
resetting both the TxEN0 and TxEN1 bits in the
CBUS register. Note: These bits should always be
reset before entering HALT/IDLE mode to allow
proper resynchronization to the CAN bus after exiting HALT/IDLE mode.
Step 2: Disable the CAN wake-up comparators, this is
done by resetting bit 7 in the port-m wakeup enable register (MWKEN) a transition on the CAN
bus will then not wake the device up.
Note: If both the main receive comparator and the wake-up comparator are
disabled the on chip CAN voltage reference is also disabled. The CAN-
output is then High-Z
V
REF
The following table shows the two CAN power save modes and the active CAN transceiver blocks:
Interrupt B
Source
Timer
Counts On
C
t
C
Edge
Edge
C
C
C
C
Step 1Step 2Main-CompWake-Up-CompCAN-V
00onononV
01onoffonV
10offononV
11offoffoffHigh-Z
The device supports two different ways of exiting the HALT
mode. The first method of exiting the HALTmode is with the
Multi-Input Wakeup feature on the L & M port. The second
method of exiting the HALT mode is by pulling the RESET
pin low.
Since a crystal or ceramic resonator may be selected as the
oscillator, the Wakeup signal is not allowed to start the chip
www.national.com18
running immediately since crystal oscillators and ceramic
resonators have a delayed start up time to reach full amplitude and frequency stability. The IDLE timer is used to generate a fixed delay to ensure that the oscillator has indeed
stabilized before allowing instruction execution. In this case,
upon detecting a valid Wakeup signal, only the oscillator circuitry is enabled. The IDLE timer is loaded with a value of
REF
V
Pin
REF
/2
CC
/2
CC
/2
CC
Power Save Modes (Continued)
256 and is clocked with the t
clock is derived by dividing theoscillator clock down by a factor of 10. The Schmitt trigger following the CKI inverter on
the chip ensures that the IDLEtimer is clocked only when the
oscillator has a sufficiently large amplitude to meet the
Schmitt trigger specifications. This Schmitt trigger is not part
of the oscillator closed loop. The start-up time-out from the
IDLE timer enables the clock signals to be routed to the rest
of the chip.
The device has two mask options associated with the HALT
mode. The first mask option enablesthe HALTmode feature,
while the second mask option disables the HALTmode. With
the HALT mode enable mask option, the device will enter
and exit the HALT mode as described above. With the HALT
disable mask option, the device cannot be placed in the
HALTmode (writing a “1” to the HALT flag will have to effect).
IDLE MODE
The device is placed in the IDLE mode by writing a “1” to the
IDLE flag (G6 data bit). In this mode, all activity, except the
associated on-board oscillator circuitry, ad the IDLE Timer
T0, is stopped. The power supply requirements of the microcontroller in this mode of operation are typically around 30
of normal power requirement of the microcontroller.
As with the HALT mode, the device can be returned to normal operation with areset, or with a Multi-Input Wakeup from
the Port L or CAN Interface. Alternately, the microcontroller
resumes normal operation from the IDLE mode when the
thirteenth bit (representing 4.096 ms at internal clock frequency of 1 MHz, t
c
This toggle condition of the thirteenth bit of the IDLE Timer
T0 is latched into the T0PND pending flag.
The user has the option of being interrupted with a transition
on the thirteenth bit of the IDLE Timer T0. The interrupt can
be enabled or disabled via the T0EN control bit. Setting the
T0EN flag enables the interrupt and vice versa.
The user can enter the IDLE mode with the Timer T0 interrupt enabled. In this case, when the T0PND bit gets set, the
device will first execute the Timer T0 interrupt service routine
and then return to the instruciton following the “Enter Idle
Mode” instruction.
Alternatively, the user can enter the IDLE mode with the
IDLE Timer T0 interrupt disabled. In this case, the device will
resume normal operation with the instruction immediately
following the “Enter IDLE Mode” instruction.
Note: It is necessary to program two NOP instructions following both the set
HALT mode and set IDLE mode instructions. These NOP instructions
are necessary to allow clock resynchronization following the HALT or
IDLE modes.
instruction cycle clock. The t
c
= 1 µs) of the IDLE Timer toggles.
Multi-Input Wakeup
The Multi-Input Wakeup feature is used to return (wakeup)
c
the device from either the HALT or IDLE modes. Alternately,
the Multi-Input Wakeup/Interrupt feature may also be used to
generate up to 7 edge selectable external interrupts.
Note: The following description is for both the Port L and the M port. When
the document refers to the registers WKEGD, WKEN or WKPND, the
user will have to put either M (for M port) or L (for port) in front of the
register, i.e., LWKEN (Port L WKEN), MWKEN (Port M WKEN).
Figures 12, 13
microcontroller.The Multi-Input Wakeupfeature utilizes the L
Port. The user selects which particular Port L bit (or combination of Port L bits) will cause the device to exit the HALT or
IDLE modes. The selection is done through the Reg: WKEN.
The Reg: WKEN is an 8-bit read/write register, which contains a control bit for every Port L bit. Setting a particular
WKEN bit enables a Wakeupfrom the associated Port L pin.
The user can select whether the trigger condition on the selected Port L pin is going to be either a positive edge (low to
high transition) or a negative edge (high to low transition).
This selection is made via the Reg: WKEDG, which is an
8-bit control register with a bit assigned to each Port L pin.
Setting the control bit will select the trigger condition to be a
%
negative edge on that particular Port L pin. Resetting the bit
selects the trigger condition to be a positive edge. Changing
an edge select entails several steps in order to avoid a
pseudo Wakeup condition as a result of the edge change.
First, the associated WKEN bit should be reset, followed by
the edge select change in WKEDG. Next, the associated
WKPND bit should be cleared, followed by the associated
WKEN bit being re-enabled.
An example may serve to clarify this procedure. Suppose we
wish to change the edge select from positive (low going high)
to negative (high going low) for Port L bit 5, where bit 5 has
previously been enabled for an input interrupt. The program
would be as follows:
If the Port L bits have been used as outputs and then
changed to inputs with Multi-InputWakeup/Interrupt, a safety
procedure should also be followed to avoid inherited pseudo
wakeup conditions. After the selected Port L bits have been
changed from output to input but before the associated
WKEN bits are enabled, the associated edge select bits in
WKEDG should be set or reset for the desired edge selects,
followed by the assoicated WKPND bits being cleared.
shows the Multi-Input Wakeup logic for the
www.national.com19
Multi-Input Wakeup (Continued)
FIGURE 12. Port M Multi-Input Wake-up Logic
This same procedure should be used following reset, since
the Port L inputs are left floating as a result of reset. The occurrence of the selected trigger condition for Multi-Input
Wakeup is latched to a pending register called WKPND. The
respective bits of the WKPND register will be set on the occurrence of the selected trigger edge on the corresponding
Port L and Port M pin. The user has the responsibility of
clearing these pending flags. Since WKPND is a pending
register for the occurrence of selected wakeup conditions,
the device will not enter the HALT mode if any wakeup bit is
both enabled and pending. Consequently, the user has the
responsibility of clearing the pending flags before attempting
to enter the HALT mode.
The WKEN, WKPND and WKEDG are all read/write registers, and are cleared at reset.
PORTS L AND PORT M INTERRUPTS
Ports L and M provides the user with additional fifteen fully
selectable, edge sensitive interrupts which are all vectored
into the same service subroutine.
The interrupt from Ports L and M shares logic with the wake
up circuitry. The register WKEN allows interrupts from Port L
to be individually enabled or disabled. The registers LWKEN
and MWKEN specifies the trigger condition to be either a
positive or a negative edge. Finally, the registers LWKEN
and MWKEN latches in the pending trigger conditions.
The GIE (global interrupt enable) bit enables the interrupt
function. A control flag, LPEN, functions as a global interrupt
enable for Port Linterrupts. Setting the LPEN flag will enable
DS012837-13
interrupts and vice versa. A separate global pending flag is
not needed since the registers LWKEN and MWKEN are adequate.
Since Ports L and M are also used for waking the device out
of the HALT or IDLE modes, the user can elect to exit the
HALT or IDLE modes either with or without the interrupt enabled. If he elects todisable the interrupt, then thedevice will
restart execution from the instruction immediately following
the instruction that placed the microcontroller in the HALT or
IDLE modes. In the other case, the device will first execute
the interrupt service routine and then revert to normal operation.
The Wakeup signal will not start the chip running immediately since crystal oscillators orceramic resonators have a finite start up time. The IDLE Timer (T0) generates a fixed delay to ensure that the oscillator has indeed stabilized before
allowing the device to execute instructions. In this case,
upon detecting a valid Wakeup signal, only the oscillator circuitry and the IDLE Timer T0 are enabled.The IDLE Timer is
loaded with a value of 256 and is clocked from the t
tion cycle clock. The t
oscillator clock by a factor of 10. A Schmitt trigger following
clock is derived by dividing down the
c
instruc-
c
the CKI on-chip inverter ensures that the IDLE timer is
clocked only when the oscillator has a sufficiently large amplitude to meet the Schmitt trigger specifications. This
Schmitt trigger is not part of the oscillator closed loop. The
start-up time-out from the IDLE timer enables the clock signals to be routed to the rest of the chip.
www.national.com20
Multi-Input Wakeup (Continued)
FIGURE 13. Port L Multi-Input Wake-Up Logic
PORT M INTERRUPTS
Port M provides the user with seven fully selectable, edge
sensitive interrupts which are all vectored into the same service subroutine.
The interrupt from Port M shares logic with the wake up circuitry.The MWKEN register allows interrupts from Port M to
be individually enabled or disabled. The MWKEDG register
specifies the trigger condition to be either a positive or a
negative edge. The MWKPND register latches in the pending trigger conditions.
The LPEN control flag in the ICNTRL register functions as a
global interrupt enable for Port M interrupts. Setting the
LPEN flag enables interrupts. Note that the GIE bit in the
PSW register must also be set to enable these Port L interrupts.A global pending flag is not needed since each pin has
a corresponding pending flag in the MWKPND register.
Since Port M is also used for exiting the device from the
HALT or IDLE mode, the user can elect to exit the HALT or
IDLE mode either with or without the interrupt enabled. If the
user elects to disable the interrupt, then the device restarts
execution from the point at which it was stopped (first instruction cycle of the instruction following the enter HALT or
IDLE mode instruction). In theother case, the device finishes
the instruction which was being executed when the part was
stopped (the NOP(Note 26) instruction following the enter
HALT or IDLE mode instruction), and then branches to the
interrupt service routine. The device then reverts to normal
operation.
Note 26: Theuser must place two NOPs after an enter HALT or IDLE mode
instruction.
To prevent erroneous clearing of the SPI receive FIFO when
entering HALT/IDLE mode, the user needs to enable the
MIWU on port M3. (SS) by setting bit 3 in the MWKEN register.
DS012837-14
CAN RECEIVE WAKEUP
The CAN Receive Wakeup source can be enabled or disabled. There is no specific enable bit for the CAN Wakeup
feature. Although the wakeup feature on pins L0..17 and
M0..M7 can be programmed to generate an interrupt (Port L
or Port M interrupt), nointerrupt is generated upon aCAN receive wakeup condition. The CAN block has it’s own, dedicated receiver interrupt upon receive buffer full (see CAN
Section).
CAN Wake-Up:
The CAN interface can be programmed to wake the device
from HALT/IDLE mode. This is done by setting bit 7 in the
Port M wake-up enable register (MWKEN). A transition on
the bus will cause the bit 7 of the Port M wake-up pending
(MWKPND) to be set and thereby waking up the device. The
frame on the CAN bus will be lost. The MWEDG (m port
wake-up edge) register bit 7 can be programmed high or low
(high will wake-up on the first falling edge on Rx0).
Resetting bit 7 in the MWKEN will disable the CAN wake-up.
The following sequence should be executed before entering
HALT/IDLE mode:
RBIT 7, MWKPND ;clear CAN wake-up pending
LDA, CBUS
AND A, #0CF;resetTxEN0 and TxEN1
XA, CBUS;disable main receive
;comparator
After the device wake-up, the CBUS bits TxEN0 and/or
TxEN1 need be set to allow synchronization on the bus and
to enable transmission/reception of CAN frames.
CAN Block Description *
This device contains a CAN serial bus interface as described
in the CAN Specification Rev. 2.0 part B.
*Patents Pending.
www.national.com21
CAN Interface Block
This device supports applications which require a low speed
CAN interface. It is designed to be programmed with two
transmit and two receive registers. The user’s program may
check the status bytes in order to get information of the bus
state and the received or transmitted messages. The device
has the capability to generate an interrupt as soon as one
byte has been transmitted or received. Care must be taken if
more than two bytes in a message frame are to be
transmitted/received. In this case the user’s program must
poll the transmit buffer empty (TBE)/receive buffer full (RBF)
bits or enable their respective interrupts and perform a data
exchange between the user data and the Tx/Rx registers.
Fully automatic transmission on error is supported for messages not longer than two bytes. Messages which are longer
than two bytes have to be processed by software.
The interface is compatible with CAN Specification 2.0 part
B, without the capability to receive/transmit extended
frames. Extended frames on the bus are checked and acknowledged according to the CAN specification.
The maximum bus speed achievable with the CAN interface
is a function of crystal frequency, message length and software overhead. The device can support a bus speed of up to
1 Mbit/s with a 10 MHz oscillator and 2 byte messages. The
1 Mbit/s bus speed refers to the rate at which protocol and
data bits are transferred on the bus. Longer messages require slower bus speeds due to the time required for software intervention between data bytes. The device will support a maximum of 125k bit/s with eight byte messages and
a 10 MHz oscillator.
FIGURE 14. CAN Interface Block Diagram
www.national.com22
DS012837-16
Functional Block Description of
the CAN Interface
Interface Management Logic (IML)
The IML executes the CPU’s transmission and reception
commands and controls the data transfer between CPU,
Rx/Tx and CAN registers. It provides the CAN Interface with
Rx/Tx data from the memory mapped Register Block. It also
sets and resets the CAN status information and generates
interrupts to the CPU.
Bit Stream Processor (BSP)
The BSP is a sequencer controlling the data stream between
The Interface Management Logic (parallel data) and the bus
line (serial data). It controls the transceive logic with regard
to reception and arbitration, and creates error signals according to the bus specification.
Transceive Logic (TCL)
The TCL is a state machine which incorporates the bit stuff
logic and controls the output drivers, CRC logic and the
Rx/Tx shift registers. It also controls the synchronization to
the bus with the CAN clock signal generated by the BTL.
Error Management Logic (EML)
The EML is responsible for the fault confinement of the CAN
protocol. It is also responsible for changing the error
counters, setting the appropriate error flag bits and interrupts
and changing the error status (passive, active and bus off).
Cyclic Redundancy Check (CRC)
Generator and Register
The CRC Generator consists of a 15-bit shift register and the
logic required to generate the checksum of the destuffed bitstream. It informs the EML about the result of a receiver
checksum.
The checksum is generated by the polynomial:
Receive/Transmit (Rx/Tx) Registers
The Rx/Tx registers are 8-bit shift registers controlled by the
TCL and the BSP. They are loaded or read by the Interface
Management Logic, which holds the data to be transmitted
or the data that was received.
15
14
10
8
7
4
χ
+
χ
+
χ
+
χ
+
χ
3
+
χ
+
χ
−1
Bit Time Logic (BTL)
The bit time logic divider divides the CKI input clock by the
value defined in the CAN prescaler (CSCAL) and bus timing
register (CTIM). The resultig bit time (tcan) can be computed
by the formula:
Where
divider
is the value of the clock prescaler,PSis the
programmable value of phase segment 1 and 2 (1..8) and
PPS
the programmed value of the propagation segment
(1..8) (located in CTIM).
Bus Timing Considerations
The internal architecture of the CAN interface has been optimized to allow fast software response times within messages of more than two data bytes. The TBE (Transmit
Buffer Empty) bit is set on the last bit of odd data bytes when
CAN internal sample points are high.
It is the user’s responsibility to ensure that the time between
setting TBE and a reload of TxD2 is longer than the length of
phase segment 2 as indicated in the following equation:
Table 3
shows examples of the minimum required t
different CSCAL settings based on a clock frequency of
LOAD
for
10 MHz. Lower clock speeds require recalculation of the
CAN bit rate and the mimimum t