The ST7DALIF2 device is a member of the ST7 microcontroller family designed for DALI
applications running from 2.4 to 5.5 V. Different package options offer up to 15 I/O pins.
All devices are based on a common industry-standard 8-bit core, featuring an enhanced
instruction set and are available with Flash or ROM program memory. The ST7 family
architecture offers both power and flexibility to software developers, enabling the design of
highly efficient and compact application code.
The on-chip peripherals include a DALI communication interface and an SPI. For power
economy, the microcontroller can switch dynamically into, Slow, Wait, Active-halt, Auto
Wakeup from Halt or Halt mode when the application is in idle or stand-by state.
Typical applications include consumer, home, office, lighting and industrial products.
10/171
ST7DALIF2Device summary
2 Device summary
Table 1.Device summary
FeaturesST7DALIF2
Program memory 8 Kbytes
RAM (stack) 384 (128) bytes
Data EEPROM256 bytes
Peripherals
Operating supply2.4V to 5.5V
CPU frequency
Operating temperature-40°C to +85°C
PackagesSO20 300”
Lite Timer with Watchdog, Autoreload Timer with 32 MHz input clock, SPI,
10-bit ADC with Op-Amp, DALI
Up to 8 MHz (with external OSC up to 16 MHz and internal 1 MHz RC 1%
PLLx8/4 MHz)
11/171
Block diagramST7DALIF2
8-BIT CORE
ALU
ADDRESS AND DATA BUS
OSC1
OSC2
RESET
PORT A
Internal
CLOCK
CONTROL
RAM
(384 Bytes)
PA7:0
(8 bits)
V
SS
V
DD
POWER
SUPPLY
PROGRAM
(8K Bytes)
LVD
MEMORY
PLL x 8
Ext.
1MHz
PLL
Int.
1MHz
8-Bit
LITE TIMER 2
PORT B
SPI
PB6:0
(7 bits)
DATA EEPROM
(256 Bytes)
1% RC
OSC
to
16MHz
ADC
+ OpAmp
12-Bit
Auto-Reload
TIMER 2
CLKIN
/ 2
or PLL X4
8MHz -> 32MHz
WATCHDOG
DALI
3 Block diagram
Figure 1.General block diagram
12/171
ST7DALIF2Pin description
20
19
18
17
16
15
14
13
1
2
3
4
5
6
7
8
V
SS
V
DD
AIN5/PB5
CLKIN/AIN4/PB4
MOSI/AIN3/PB3
MISO/AIN2/PB2
SCK/AIN1/PB1
SS
/AIN0/PB0
OSC1/CLKIN
OSC2
PA 5 (HS)/ATPWM3/ICCDATA
PA 4 (HS)/ATPWM2
PA 3 (HS)/ATPWM1
PA 2 (HS)/ATPWM0
PA 1 (HS)/ATIC
PA 0 (HS)/LTIC
12
11
9
10
DALIIN/AIN6/PB6
PA7(HS)/DALIOUT
PA6/MCO/ICCCLK/BREAK
RESET
ei3
ei2
ei0
ei1
eixassociated external interrupt vector
(HS) 20mA high sink capability
4 Pin description
Figure 2.20-pin SO package pinout
13/171
Pin descriptionST7DALIF2
Legend / Abbreviations for Ta b le 2:
Type: I = input, O = output, S = supply
In/Output level:C
Output level: HS = 20mA high sink (on N-buffer only)
Port and control configuration:
●Input:float = floating, wpu = weak pull-up, int = interrupt, ana = analog
●Output: OD = open drain, PP = push-pull
The RESET configuration of each pin is shown in bold which is valid as long as the device is
in reset state.
Table 2.Device pin description
Pin
no.
1V
2V
3RESET
4PB0/AIN0/SS
5PB1/AIN1/SCKI/O C
Pin name
SS
DD
I/O C
LevelPort / control
Type
Input
Output
S Ground
S Main power supply
T
I/O C
T
T
= CMOS 0.3VDD/0.7VDD with input trigger
T
Main
InputOutput
int
float
wpu
ana
OD
function
reset)
PP
(after
Alternate function
XXTop priority non maskable interrupt (active low)
ADC Analog Input 0 or SPI Slave
Select (active low)
X
XX XPort B0
Caution: No negative current injection
allowed on this pin. For details, refer to
Section 20.2 on page 128
ei3
XXXXPort B1
ADC Analog Input 1 or SPI Serial
Clock
Caution: No negative current injection
allowed on this pin. For details, refer to
Section 20.2 on page 128
6PB2/AIN2/MISOI/O C
7PB3/AIN3/MOSII/O C
8PB4/AIN4/CLKINI/O C
9PB5/AIN5I/O C
10 PB6/AIN6/DALIIN I/O C
XXXXPort B2
T
X
T
XXXXPort B4
T
XXXXPort B5ADC Analog Input 5
T
XXXXPort B6ADC Analog Input 6 or DALI Input
T
XX XPort B3
ei2
14/171
ADC Analog Input 2 or SPI Master In/
Slave Out Data
ADC Analog Input 3 or SPI Master Out
/ Slave In Data
ADC Analog Input 4 or External clock
input
ST7DALIF2Pin description
Table 2.Device pin description (continued)
Pin
no.
Pin name
Type
11 PA7/DALIOUTI/O C
LevelPort / control
InputOutput
Input
T
Output
HS X
float
int
wpu
ana
XXPort A7DALI Output
OD
function
reset)
PP
Main
(after
Alternate function
Main Clock Output or In Circuit
Communication Clock
or External BREAK
Caution: During normal operation this
pin must be pulled- up, internally or
PA6 /M C O/
12
ICCCLK/BREAK
I/O C
XXXPort A6
T
ei1
externally (external pull-up of 10k
mandatory in noisy environment). This
is to avoid entering ICC mode
unexpectedly during a reset. In the
application, even if the pin is
configured as output, any reset will put
it back in input pull-up.
PA5 /ATPWM3/
13
ICCDATA
I/O C
HS XXX Port A5
T
Auto-Reload Timer PWM3 or In Circuit
Communication Data
14 PA 4/ AT PW M 2I/ O CTHS XXX Port A4Auto-Reload Timer PWM2
15 PA 3/ AT PW M 1I/ O C
16 PA 2/ AT PW M 0I/ O C
17 PA1/ATICI/O C
18 PA0 /LTICI/O C
HS X
T
HS XXX Port A2Auto-Reload Timer PWM0
T
HS XXX Port A1Auto-Reload Timer Input Capture
T
HS XXX Port A0Lite Timer Input Capture
T
ei0
XXPort A3Auto-Reload Timer PWM1
19 OSC2OResonator oscillator inverter output
20 OSC1/CLKINI
Resonator oscillator inverter input or External
clock input
15/171
Register and memory mapST7DALIF2
0000h
RAM
Flash Memory
(8K)
Interrupt & Reset Vectors
HW Registers
0080h
007Fh
0FFFh
(see Ta bl e 3 )
1000h
10FFh
FFE0h
FFFFh
(see Ta bl e 1 5)
0200h
Reserved
01FFh
Short Addressing
RAM (zero page)
128 Bytes Stack
0180h
01FFh
0080h
00FFh
(384 Bytes)
Data EEPROM
(256 Bytes)
E000h
1100h
DFFFh
Reserved
FFDFh
16-bit Addressing
RAM
0100h
017Fh
1 Kbyte
7 Kbytes
SECTOR 1
SECTOR 0
8K FLASH
FFFFh
FC00h
FBFFh
E000h
PROGRAM MEMORY
1000h
1001h
RCCR0
RCCR1
see Section 9.2 on page 32
FFDEh
FFDFh
RCCR0
RCCR1
see Section 9.2 on page 32
5 Register and memory map
As shown in Figure 3, the MCU is capable of addressing 64K bytes of memories and I/O
registers.
The available memory locations consist of 128 bytes of register locations, 384 bytes of
RAM, 256 bytes of data EEPROM and 8 Kbytes of user program memory. The RAM space
includesup to 128 bytes for the stack from 180h to 1FFh.
The highest address bytes contain the user reset and interrupt vectors.
The Flash memory contains two sectors (see Figure 3) mapped in the upper part of the ST7
addressing space so the reset and interrupt vectors are located in Sector 0 (F000h-FFFFh).
The size of Flash Sector 0 and other device options are configurable by Option byte (refer to
Section 22.1 on page 161).
Note:IMPORTANT: memory locations marked as “Reserved” must never be accessed. Accessing
a reserved area can have unpredictable effects on the device.
AT CS R
CNTRH
CNTRL
AT RH
AT RL
PWMCR
PWM0CSR
PWM1CSR
PWM2CSR
PWM3CSR
DCR0H
DCR0L
DCR1H
DCR1L
DCR2H
DCR2L
DCR3H
DCR3L
ATICRH
ATICRL
TRANCR
BREAKCR
Register name
Port A Data Register
Port A Data Direction Register
Port A Option Register
Port B Data Register
Port B Data Direction Register
Port B Option Register
Reserved Area (2 bytes)
Lite Timer Control/Status Register 2
Lite Timer Auto-reload Register
Lite Timer Counter Register
Lite Timer Control/Status Register 1
Lite Timer Input Capture Register
Timer Control/Status Register
Counter Register High
Counter Register Low
Auto-Reload Register High
Auto-Reload Register Low
PWM Output Control Register
PWM 0 Control/Status Register
PWM 1 Control/Status Register
PWM 2 Control/Status Register
PWM 3 Control/Status Register
PWM 0 Duty Cycle Register High
PWM 0 Duty Cycle Register Low
PWM 1 Duty Cycle Register High
PWM 1 Duty Cycle Register Low
PWM 2 Duty Cycle Register High
PWM 2 Duty Cycle Register Low
PWM 3 Duty Cycle Register High
PWM 3 Duty Cycle Register Low
Input Capture Register High
Input Capture Register Low
Transfer Control Register
Break Control Register
DALI Clock Register
DALI Forward Address Register
DALI Forward Data Register
DALI Backward Data Register
DALI Control Register
DALI Control/Status Register
1. The contents of the I/O port DR registers are readable only in output configuration. In input configuration,
the values of the I/O pins are returned instead of the DR register contents.
2. The bits associated with unavailable pins must always keep their reset value.
3. For a description of the Debug Module registers, see ST7 ICC Protocol Reference Manual.
DM Control Register
DM Status Register
DM Breakpoint Register 1 High
DM Breakpoint Register 1 Low
DM Breakpoint Register 2 High
DM Breakpoint Register 2 Low
Reserved area (47 bytes)
00h
00h
00h
00h
00h
00h
R/W
R/W
R/W
R/W
R/W
R/W
Legend: x=undefined, R/W=read/write
18/171
ST7DALIF2Flash program memory
6 Flash program memory
6.1 Introduction
The ST7 single voltage extended Flash (XFlash) is a non-volatile memory that can be
electrically erased and programmed either on a byte-by-byte basis or up to 32 bytes in
parallel.
The XFlash devices can be programmed off-board (plugged in a programming tool) or onboard using In-Circuit Programming or In-Application Programming.
The array matrix organization allows each sector to be erased and reprogrammed without
affecting other sectors.
6.2 Main features
●ICP (In-Circuit Programming)
●IAP (In-Application Programming)
●ICT (In-Circuit Testing) for downloading and executing user application test patterns in
RAM
●Sector 0 size configurable by option byte
●Readout and write protection
6.3 Programming modes
The ST7 can be programmed in three different ways:
●Insertion in a programming tool. In this mode, FLASH sectors 0 and 1, option byte row
and data EEPROM (if present) can be programmed or erased.
●In-Circuit Programming. In this mode, FLASH sectors 0 and 1, option byte row and data
EEPROM (if present) can be programmed or erased without removing the device from
the application board.
●In-Application Programming. In this mode, sector 1 and data EEPROM (if present) can
be programmed or erased without removing the device from the application board and
while the application is running.
6.3.1 In-circuit programming (ICP)
ICP uses a protocol called ICC (In-Circuit Communication) which allows an ST7 plugged on
a printed circuit board (PCB) to communicate with an external programming device
connected via cable. ICP is performed in three steps:
Switch the ST7 to ICC mode (In-Circuit Communications). This is done by driving a specific
signal sequence on the ICCCLK/DATA pins while the RESET pin is pulled low. When the
ST7 enters ICC mode, it fetches a specific RESET vector which points to the ST7 System
Memory containing the ICC protocol routine. This routine enables the ST7 to receive bytes
from the ICC interface.
●Download ICP Driver code in RAM from the ICCDATA pin
●Execute ICP Driver code in RAM to program the FLASH memory
19/171
Flash program memoryST7DALIF2
Depending on the ICP Driver code downloaded in RAM, FLASH memory programming can
be fully customized (number of bytes to program, program locations, or selection of the
serial communication interface for downloading).
6.3.2 In application programming (IAP)
This mode uses an IAP Driver program previously programmed in Sector 0 by the user (in
ICP mode).
This mode is fully controlled by user software. This allows it to be adapted to the user
application, (user-defined strategy for entering programming mode, choice of
communications protocol used to fetch the data to be stored etc.).
IAP mode can be used to program any memory areas except Sector 0, which is write/erase
protected to allow recovery in case errors occur during the programming operation.
6.4 ICC interface
ICP needs a minimum of 4 and up to 6 pins to be connected to the programming tool. These
pins are:
●RESET: device reset
●V
●ICCCLK: ICC output serial clock pin
●ICCDATA: ICC input serial data pin
●CLKIN/PB4: main clock input for external source
●V
Note:1If the ICCCLK or ICCDATA pins are only used as outputs in the application, no signal
isolation is necessary. As soon as the Programming Tool is plugged to the board, even if an
ICC session is not in progress, the ICCCLK and ICCDATA pins are not available for the
application. If they are used as inputs by the application, isolation such as a serial resistor
has to be implemented in case another device forces the signal. Refer to the Programming
Tool documentation for recommended resistor values.
2During the ICP session, the programming tool must control the RESET
conflicts between the programming tool and the application reset circuit if it drives more than
5mA at high level (push pull output or pull-up resistor<1K). A schottky diode can be used to
isolate the application RESET circuit in this case. When using a classical RC network with
R>1K or a reset management IC with open drain output and pull-up resistor>1K, no
additional components are needed. In all cases the user must ensure that no external reset
is generated by the application during the ICC session.
3The use of Pin 7 of the ICC connector depends on the Programming Tool architecture. This
pin must be connected when using most ST Programming Tools (it is used to monitor the
application power supply). Please refer to the Programming Tool manual.
4Pin 9 has to be connected to the CLKIN/PB4 pin of the ST7 when the clock is not available
in the application or if the selected clock option is not programmed in the option byte. ST7
devices with multi-oscillator capability need to have OSC1 and OSC2 grounded in this case.
5With any programming tool, while the ICP option is disabled, the external clock has to be
provided on PB4.
: device power supply ground
SS
: application board power supply (optional, see Note 3)
DD
pin. This can lead to
Caution:During normal operation the ICCCLK pin must be pulled- up, internally or externally
(external pull-up of 10k mandatory in noisy environment). This is to avoid entering ICC
20/171
ST7DALIF2Flash program memory
ICC CONNECTOR
ICCDATA
ICCCLK
RESET
V
DD
HE10 CONNECTOR TYPE
APPLICATION
POWER SUPPLY
1
246810
975 3
PROGRAMMING TOOL
ICC CONNECTOR
APPLICATION BOARD
ICC Cable
(See Note 3)
ST7
OPTIONAL
See Note 1 and Caution
See Note 2
APPLICATION
RESET SOURCE
APPLICATION
I/O
(See Note 4)
(See Note 5)
CLKIN/PB4
mode unexpectedly during a reset. In the application, even if the pin is configured as output,
any reset will put it back in input pull-up.
Figure 4.Typical ICC interface
6.5 Memory protection
There are two different types of memory protection: Read Out Protection and Write/Erase
Protection which can be applied individually.
6.5.1 Readout protection
Readout protection, when selected provides a protection against program memory content
extraction and against write access to Flash memory. Even if no protection can be
considered as totally unbreakable, the feature provides a very high level of protection for a
general purpose microcontroller. Both program and data E
In flash devices, this protection is removed by reprogramming the option. In this case, both
program and data E
2
memory are automatically erased and the device can be
reprogrammed.
Readout protection selection depends on the device type:
●In Flash devices it is enabled and removed through the FMP_R bit in the option byte.
●In ROM devices it is enabled by mask option specified in the Option List.
6.5.2 Flash write/erase protection
Write/erase protection, when set, makes it impossible to both overwrite and erase program
memory. It does not apply to E
applications and prevent any change being made to the memory content.
Caution:Once set, Write/erase protection can never be removed. A write-protected flash device is no
longer reprogrammable.
Write/erase protection is enabled through the FMP_W bit in the option byte.
2
data. Its purpose is to provide advanced security to
21/171
2
memory are protected.
Flash program memoryST7DALIF2
6.6 Related documentation
For details on Flash programming and ICC protocol, refer to the ST7 Flash Programming
Reference Manual and to the ST7 ICC Protocol Reference Manual
.
6.7 Register description
6.7.1 Flash control/status register (FCSR)
This register is reserved for programming using ICP, IAP or other programming methods. It
controls the XFlash programming and erasing operations.
When an EPB or another programming tool is used (in socket or ICP mode), the RASS keys
are sent automatically.
Table 4.Flash control/status register address and reset value
Address (Hex)Register label76543210
002FhFCSR reset value00000000
22/171
ST7DALIF2Data EEPROM
EECSR
HIGH VOLTAGE
PUMP
0 E2LAT00000E2PGM
EEPROM
MEMORY MATRIX
(1 ROW = 32 x 8 BITS)
ADDRESS
DECODER
DATA
MULTIPLEXER
32 x 8 BITS
DATA LATCHES
ROW
DECODER
DATA BUS
4
4
4
128128
ADDRESS BUS
7 Data EEPROM
7.1 Introduction
The Electrically Erasable Programmable Read Only Memory can be used as a non volatile
back-up for storing data. Using the EEPROM requires a basic access protocol described in
this chapter.
7.2 Main features
■ Up to 32 Bytes programmed in the same cycle
■ EEPROM mono-voltage (charge pump)
■ Chained erase and programming cycles
■ Internal control of the global programming cycle duration
■ Wait mode management
■ Readout protection
Figure 5.EEPROM block diagram
7.3 Memory access
The Data EEPROM memory read/write access modes are controlled by the E2LAT bit of the
EEPROM Control/Status register (EECSR). The flowchart in Figure 6 describes these
different memory access modes.
Read operation (E2LAT=0)
The EEPROM can be read as a normal ROM location when the E2LAT bit of the EECSR
register is cleared.
23/171
Data EEPROMST7DALIF2
READ MODE
E2LAT=0
E2PGM=0
WRITE MODE
E2LAT=1
E2PGM=0
READ BYTES
IN EEPROM AREA
WRITE UP TO 32 BYTES
IN EEPROM AREA
(with the same 11 MSB of the address)
START PROGRAMMING CYCLE
E2LAT=1
E2PGM=1 (set by software)
E2LAT
01
CLEARED BY HARDWARE
On this device, Data EEPROM can also be used to execute machine code. Take care not to
write to the Data EEPROM while executing from it. This would result in an unexpected code
being executed.
Write operation (E2LAT=1)
To access the write mode, the E2LAT bit has to be set by software (the E2PGM bit remains
cleared). When a write access to the EEPROM area occurs, the value is latched inside the
32 data latches according to its address.
When PGM bit is set by the software, all the previous bytes written in the data latches (up to
32) are programmed in the EEPROM cells. The effective high address (row) is determined
by the last EEPROM write sequence. To avoid wrong programming, the user must take care
that all the bytes written between two programming sequences have the same high address:
only the five Least Significant Bits of the address can change.
At the end of the programming cycle, the PGM and LAT bits are cleared simultaneously.
Note:Care should be taken during the programming cycle. Writing to the same memory location
will over-program the memory (logical AND between the two write access data result)
because the data latches are only cleared at the end of the programming cycle and by the
falling edge of the E2LAT bit.
It is not possible to read the latched data.
This note is illustrated by Figure 8.
Figure 6.Data EEPROM programming flowchart
24/171
ST7DALIF2Data EEPROM
Byte 1 Byte 2Byte 32
PHASE 1
Programming cycle
Read operation impossible
PHASE 2
Read operation possible
E2LAT bit
E2PGM bit
Writing data latchesWaiting E2PGM and E2LAT to fall
Set by USER application
Cleared by hardware
⇓ Row / Byte ⇒ 0 1 2 3... 30 31Physical address
000h...1Fh
120h...3Fh
...
NNx20h...Nx20h+1Fh
ROW
DEFINITION
Figure 7.Data EEPROM write operation
Note:If a programming cycle is interrupted (by a reset action), the integrity of the data in memory
is not guaranteed.
7.4 Power saving modes
Wait mode
The data EEPROM can enter Wait mode on execution of the WFI instruction of the
microcontroller or when the microcontroller enters Active-Halt mode.The data EEPROM will
immediately enter this mode if there is no programming in progress, otherwise the data
EEPROM will finish the cycle and then enter Wait mode.
Active-halt mode
Refer to Wait mode.
Halt mode
The data EEPROM immediately enters Halt mode if the microcontroller executes the HALT
instruction. Therefore the EEPROM will stop the function in progress, and data may be
corrupted.
7.5 Access error handling
If a read access occurs while E2LAT=1, then the data bus will not be driven.
If a write access occurs while E2LAT=0, then the data on the bus will not be latched.
25/171
Data EEPROMST7DALIF2
LAT
ERASE CYCLEWRITE CYCLE
PGM
t
PROG
READ OPERATION NOT POSSIBLE
WRITE OF
DATA LATCHES
READ OPERATION POSSIBLE
INTERNAL
PROGRAMMING
VOLTAGE
If a programming cycle is interrupted (by a RESET action), the memory data will not be
guaranteed.
7.6 Data EEPROM readout protection
The readout protection is enabled through an option bit (see Section 22.1 on page 161).
When this option is selected, the programs and data stored in the EEPROM memory are
protected against readout (including a re-write protection). In Flash devices, when this
protection is removed by reprogramming the Option Byte, the entire Program memory and
EEPROM is first automatically erased.
Note:Both Program Memory and data EEPROM are protected using the same option bit.
Figure 8.Data EEPROM programming cycle
26/171
ST7DALIF2Data EEPROM
7.7 Register description
7.8 EEPROM control/status register (EECSR)
Read/Write
Reset Value: 0000 0000 (00h)
70
000000E2LATE2PGM
Bits 7:2 = Reserved, forced by hardware to 0.
Bit 1 = E2LAT Latch Access Transfer
This bit is set by software. It is cleared by hardware at the end of the programming cycle. It
can only be cleared by software if the E2PGM bit is cleared.
0: Read mode
1: Write mode
Bit 0 = E2PGM Programming control and status
This bit is set by software to begin the programming cycle. At the end of the programming
cycle, this bit is cleared by hardware.
0: Programming finished or not yet started
1: Programming cycle is in progress
Note:If the E2PGM bit is cleared during the programming cycle, the memory data is not
guaranteed
Table 5.Data EEPROM register map and reset values
Address
(Hex.)
0030h
Register
label
EECSR
Reset
Valu e
76543210
E2LAT0E2PGM
000000
0
27/171
Central processing unit (CPU)ST7DALIF2
Accumulator
X index register
Y index register
Stack pointer
Condition code register
Program counter
70
1C1I1HI0NZ
Reset value = reset vector @ FFFEh-FFFFh
70
70
70
0
7
158
PCH
PCL
15
870
Reset value = stack higher address
Reset value = 1X11X1XX
Reset value = XXh
Reset value = XXh
Reset value = XXh
X = undefined value
8 Central processing unit (CPU)
8.1 Introduction
This CPU has a full 8-bit architecture and contains six internal registers allowing efficient 8bit data manipulation.
8.2 Main features
●Enable executing 63 basic instructions
●Fast 8-bit by 8-bit multiply
●17 main addressing modes (with indirect addressing mode)
●Two 8-bit index registers
●16-bit stack pointer
●Low power Halt and Wait modes
●Priority maskable hardware interrupts
●Non-maskable software/hardware interrupts
8.3 CPU registers
The six CPU registers shown in Figure 9 are not present in the memory mapping and are
accessed by specific instructions.
Figure 9.CPU registers
28/171
ST7DALIF2Central processing unit (CPU)
8.3.1 Accumulator (A)
The Accumulator is an 8-bit general purpose register used to hold operands and the results
of the arithmetic and logic calculations and to manipulate data.
8.3.2 Index registers (X and Y)
These 8-bit registers are used to create effective addresses or as temporary storage areas
for data manipulation. (The Cross-Assembler generates a precede instruction (PRE) to
indicate that the following instruction refers to the Y register.)
The Y register is not affected by the interrupt automatic procedures.
8.3.3 Program counter (PC)
The program counter is a 16-bit register containing the address of the next instruction to be
executed by the CPU. It is made of two 8-bit registers PCL (Program Counter Low which is
the LSB) and PCH (Program Counter High which is the MSB).
8.3.4 Condition code register (CC)
The 8-bit Condition Code register contains the interrupt masks and four flags representative
of the result of the instruction just executed. This register can also be handled by the PUSH
and POP instructions. These bits can be individually tested and/or controlled by specific
instructions.
CCReset value: 111x1xxx
76543210
11I1HI0NZC
R/WR/WR/WR/WR/WR/WR/WR/W
Table 6.Arithmetic management bits
BIt NameFunction
Half carry
This bit is set by hardware when a carry occurs between bits 3 and 4 of the ALU
during an ADD or ADC instructions. It is reset by hardware during the same
4H
2N
instructions.
0: No half carry has occurred.
1: A half carry has occurred.
This bit is tested using the JRH or JRNH instruction. The H bit is useful in BCD
arithmetic subroutines.
Negative
This bit is set and cleared by hardware. It is representative of the result sign of the last
arithmetic, logical or data manipulation. It is a copy of the result 7th bit.
0: The result of the last operation is positive or null.
1: The result of the last operation is negative (that is, the most significant bit is a logic
1.
This bit is accessed by the JRMI and JRPL instructions.
29/171
Central processing unit (CPU)ST7DALIF2
Table 6.Arithmetic management bits (continued)
BIt NameFunction
Zero (Arithmetic Management bit)
This bit is set and cleared by hardware. This bit indicates that the result of the last
1Z
0C
Table 7.Software interrupt bits
BIt NameFunction
5I1
3I0
Table 8.Interrupt software priority selection
arithmetic, logical or data manipulation is zero.
0: The result of the last operation is different from zero.
1: The result of the last operation is zero.
This bit is accessed by the JREQ and JRNE test instructions.
Carry/borrow
This bit is set and cleared by hardware and software. It indicates an overflow or an
underflow has occurred during the last arithmetic operation.
0: No overflow or underflow has occurred.
1: An overflow or underflow has occurred.
This bit is driven by the SCF and RCF instructions and tested by the JRC and JRNC
instructions. It is also affected by the ‘bit test and branch’, shift and rotate instructions.
Software Interrupt Priority 1
The combination of the I1 and I0 bits determines the current interrupt software priority
(see Ta b le 8 ).
Software Interrupt Priority 0
The combination of the I1 and I0 bits determines the current interrupt software priority
(see Ta b le 8 ).
Interrupt software priorityLevelI1I0
Level 0 (main)
Low
10
Level 101
Level 200
Level 3 (= interrupt disable)11
High
These two bits are set/cleared by hardware when entering in interrupt. The loaded value is
given by the corresponding bits in the interrupt software priority registers (ISPRx). They can
be also set/cleared by software with the RIM, SIM, IRET, HALT, WFI and PUSH/POP
instructions.
See Section 10: Interrupts on page 45 for more details.
30/171
Loading...
+ 141 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.