Rabbit RIO
User's Manual
PREV INDEX NEXT


3. Block-Level Features

3.1 Overview

The Rabbit RIO has eight identical I/O blocks. Although these I/O blocks can operate in a number of different modes, the core of each I/O block is a 16-bit counter that can be clocked by the master clock for the device, by the 8-bit Master Prescaler, or by an external source. This counter is accompanied by a number of registers that are updated with control register values each time the counter rolls over. This buffering allows the control register to be updated during the current count cycle with values to be used during the next count cycle. The registers that are buffered this way are the 16-bit reload register and the four 16-bit match registers. The four 16-bit match registers each generate an output pulse when the count is equal to the value programmed into that register. These pulses can be used to set or reset any of the outputs from the I/O block. The 16-bit limit register determines when the counter will be reloaded. Some of the different operating modes that are possible are described in more detail in the later chapters.

3.1.1 Simplified Block Diagram


3.2 Internal Block Registers

Register Name

Mnemonic

Address

R/W

Reset

Pointer Register
PR
External
R/W
00000000
Indirect Register
IR
External
R/W
xxxxxxxx
Command Register
CR
PR=0x00
W
11111111
Mode Register
MR
PR=0x01
R/W
00000000
Interrupt Enable Register
IER
PR=0x02
R/W
00000000
Status Register
SR
PR=0x03
R/W
00000000
Counter Toggle Register
CTR
PR=0x04
W
00000000
Synch Control Register
SCR
PR=0x05
W
00000000
Increment/In-Phase/Begin Control Register
ICR
PR=0x06
W
00000000
Decrement/Quadrature/End Control Register
DCR
PR=0x07
W
00000000
Status 0 Control Register
S0CR
PR=0x08
W
00000000
Status 1 Control Register
S1CR
PR=0x09
W
00000000
Status 2 Control Register
S2CR
PR=0x0A
W
00000000
Status 3 Control Register
S3CR
PR=0x0B
W
00000000
Pin 0 Control Register
P0CR
PR=0x0C
R/W
00000000
Pin 1 Control Register
P1CR
PR=0x0D
R/W
00000000
Pin 2 Control Register
P2CR
PR=0x0E
R/W
00000000
Pin 3 Control Register
P3CR
PR=0x0F
R/W
00000000
Match 0 LSB Register
M0LR
PR=0x10
W
00000000
Match 0 MSB Register
M0MR
PR=0x11
W
00000000
Match 1 LSB Register
M1LR
PR=0x12
W
00000000
Match 1 MSB Register
M1MR
PR=0x13
W
00000000
Match 2 LSB Register
M2LR
PR=0x14
W
00000000
Match 2 MSB Register
M2MR
PR=0x15
W
00000000
Match 3 LSB Register
M3LR
PR=0x16
W
00000000
Match 3 MSB Register
M3MR
PR=0x17
W
00000000
Count Limit LSB Register
CLLR
PR=0x18
W
00000000
Count Limit MSB Register
CLMR
PR=0x19
W
00000000
Count Begin LSB Register
CBLR
PR=0x1A
R
00000000
Count Begin MSB Register
CBMR
PR=0x1B
R
00000000
Count End LSB Register
CELR
PR=0x1C
R
00000000
Count End MSB Register
CEMR
PR=0x1D
R
00000000
Count Value LSB Register
CVLR
PR=0x1E
R
00000000
Count Value MSB Register
CVMR
PR=0x1F
R
00000000


3.3 Block Control

Each I/O block is controlled through a set of registers, listed in Section 3.2. Only the Pointer Register and the Indirect Register are accessible directly from the external interface. All the other registers within the I/O block are accessed by first writing the register address to the Pointer Register and then reading from or writing to the Indirect Register. Reading from or writing to the Indirect Register can increment the Pointer Register automatically to address the next sequential register in the I/O block if bit 7 of the Pointer Register is set.. This feature can reduce the number of address writes required when accessing multi-byte values.

3.4 Register Descriptions

3.4.1 Pointer and Indirect Registers

Each I/O block can only be accessed through the block's Pointer Register and Indirect Register. The Pointer Registers specify the addresses of the internal registers, and the Indirect Registers access the data for that internal register. When the most significant bit of the Pointer Register is set by writing the internal register address, the Pointer Register will increment automatically after each read or write to the Indirect Register.

Pointer Register x (PR0) (External Address = 0x00)
(PR1) (External Address = 0x02)
(PR2) (External Address = 0x04)
(PR3) (External Address = 0x06)
(PR4) (External Address = 0x08 )
(PR5) (External Address = 0x0A)
(PR6) (External Address = 0x0C)
(PR7) (External Address = 0x0E)

Bit(s)

Value

Description

7
0
Disable pointer auto-increment.
1
Enable pointer auto-increment.
6:5
These bits are ignored during writes and always return zero when read.
4:0
These five bits hold the block register address for indirect access.


Indirect Register x (IR0) (External Address = 0x01)
(IR1) (External Address = 0x03)
(IR2) (External Address = 0x05)
(IR3) (External Address = 0x07)
(IR4) (External Address = 0x09)
(IR5) (External Address = 0x0B)
(IR6) (External Address = 0x0D)
(IR7) (External Address = 0x0F)

Bit(s)

Value

Description

7:0
Read
Data from the register addressed by the Pointer Register are returned.
Write
Data is written to the register addressed by the Pointer Register.


3.4.2 Command Register

The Command Register can internally generate a signal that would otherwise come from an external source. For example, it can force a synch signal that would normally come from the GSYNC pin or from any of the I/O block's pins.

Command Register (CR) (Pointer = 0x00)

Bit(s)

Value

Description

7
0
No operation. This bit always reads a zero.
1
Reset counter to all zeros.
6
0
No operation. This bit always reads a zero.
1
Force a synch signal.
5
0
No operation. This bit always reads a zero.
1
Force an Increment/Begin signal.
4
0
No operation. This bit always reads a zero.
1
Force a Decrement/End signal.
3:0
These bits are reserved an should not be used.


3.4.3 Mode Register

The Mode Register defines the overall function of the I/O block by specifying how the 16-bit counter will be used.

Mode Register (MR) (Pointer = 0x01)

Bit(s)

Value

Description

7:4
These bits are ignored and should not be used.
3
0
Use the master clock directly (for both input synchronizers and timer).
1
Use prescaler output clock (for both input synchronizers and timer).
2:0
000
Disable counter/timer.
001
Enable counter mode. Count forever on Increment/In-Phase/Begin signal.
010
Enable counter mode. Count until any match condition on Increment/In-Phase/Begin signal.
011
Enable counter mode. Count up on Increment/In-Phase/Begin and count down on Decrement/Quadrature/End.
100
Enable timer mode. Counter runs continuously.
101
Enable timer mode. Counter runs continuously, until the End condition.
110
Enable timer mode. Counter runs from Begin condition until the End condition.
111
Enable timer mode. Counter counts continuously during the Begin condition.

3.4.4 Interrupt Enable and Status Registers

Controlling I/O block interrupts is a matter of writing to the proper bits of the Interrupt Enable Register (IER). The generation of an interrupt defined by the IER is registered to the block's Status Register (SR). The block interrupt will in turn be registered to the Master Status Register (MSR).

Interrupt Enable Register (IER) (Pointer = 0x02)

Bit(s)

Value

Description

7
0
Disable Decrement/Quadrature/End interrupt.
1
Enable Decrement/Quadrature/End interrupt
6
0
Disable Increment/In-Phase/Begin interrupt.
1
Enable Increment/In-Phase/Begin interrupt.
5
0
Disable counter rollover (decrement) interrupt.
1
Enable counter rollover (decrement) interrupt.
4
0
Disable counter rollover (increment) interrupt.
1
Enable counter rollover (increment) interrupt.
3
0
Disable Match 3 interrupt.
1
Enable Match 3 interrupt.
2
0
Disable Match 2 interrupt.
1
Enable Match 2 interrupt.
1
0
Disable Match 1 interrupt.
1
Enable Match 1 interrupt.
0
0
Disable Match 0 interrupt.
1
Enable Match 0 interrupt.


Status Register (SR) (Pointer = 0x03)

Bit(s)

Value

Description

7:0
Write
0
No operation
1
Clear the corresponding interrupt condition
7
Read
0
No Decrement/Quadrature/End interrupt condition pending.
1
Decrement/Quadrature/End interrupt condition pending.
6
Read
0
No Increment/In-Phase/Begin interrupt condition pending
1
Increment/In-Phase/Begin interrupt condition pending.
5
Read
0
No counter rollover (increment) interrupt condition pending.
1
Counter rollover (increment) interrupt condition pending.
4
Read
0
No Counter Rollover (decrement) interrupt condition pending.
1
Counter Rollover (decrement) interrupt condition pending.
3
Read
0
No Match 3 interrupt condition pending.
1
Match 3 interrupt condition pending.
2
Read
0
No Match 2 interrupt condition pending.
1
Match 2 interrupt condition pending.
1
Read
0
No Match 1 interrupt condition pending.
1
Match 1 interrupt condition pending.
0
Read
0
No Match 0 interrupt condition pending.
1
Match 0 interrupt condition pending.


3.4.5 Counter Toggle Register

The toggle function imposes a fixed frequency/duty cycle "mask" over the output when it would otherwise be continuously high. The duty cycle may be set to 50%, 25%, 12.5%, and so on by writing to this register. The purpose of this function is generally to reduce driver current for applications such as relay coils or thyristor gate drivers that control loads.

Counter Toggle Register (CTR) (Pointer = 0x04)

Bit(s)

Value

Description

7:0
0
Deselect the corresponding bit of the counter as the toggle signal.
1
Select the corresponding bit of the counter as the toggle signal. Select one bit for a 50% duty cycle. Select two adjacent bits for a 25% duty cycle, and so on. The actual toggle signal is generated as Toggle = &(~CTR | Counter[7:0]).


The output will toggle whenever the pin is supposed to output a logic one.

The diagram below shows how Counter [0] and Counter [1] would look relative to each other, and then shows the effects of toggling an output with Counter [0].


3.4.6 Synch Control Register

The Synch Control Register is used to select the pin that will be used as the synch signal for that particular I/O block. A pin used as a synch signal can reset the block's counter. Similarly, the GSYNC signal has the ability to reset all the I/O blocks on the Rabbit RIO if it is selected to do so.

Synch Control Register (SCR) (Pointer = 0x05)

Bit(s)

Value

Description

7
0
Synch signal does not affect counter.
1
Enable synch signal to reset counter.
6
This bit is reserved and should not be used.
5:3
000
Disable synch signal, without generating an edge.
001
Synch signalled on rising edge.
010
Synch signalled on falling edge.
011
Synch signalled on either edge.
100
This bit combination is reserved and should not be used.
101
This bit combination is reserved and should not be used.
110
Synch signalled while low.
111
Synch signalled while high.
2:0
000
No selection. Selector output is low.
001
This bit combination is reserved and should not be used.
010
This bit combination is reserved and should not be used.
011
Select Global Synch.
100
Select Pin[0].
101
Select Pin[1].
110
Select Pin[2].
111
Select Pin[3].


3.4.7 Increment/In-Phase/Begin Control Register

This register controls which pin is used to increment the counter, act as the in-phase input to a quadrature decoder, or begin the counter. It also controls how that pin is detected, whether it be by an edge, by a level, or by a transition.

Increment/In-Phase/Begin Control Register (ICR) (Pointer = 0x06)

Bit(s)

Value

Description

7:6
These bits are reserved and should not be used.
5:3
000
Disable Increment/In-Phase/Begin signal without generating an edge
001
Increment/In-Phase/Begin signal on rising edge.
010
Increment/In-Phase/Begin signal on falling edge.
011
Increment/In-Phase/Begin signal on either edge.
100
Increment/In-Phase/Begin signal on 10 ® 11 ® 01 ® 00 ® 10 quadrature decoder transitions.
101
This bit combination is reserved and should not be used.
110
Increment/In-Phase/Begin signal while low.
111
Increment/In-Phase/Begin signal while high.
2:0
000
No selection. Selector output is low.
001
This bit combination is reserved and should not be used.
010
This bit combination is reserved and should not be used.
011
Select Global Synch.
100
Select Pin[0].
101
Select Pin[1].
110
Select Pin[2].
111
Select Pin[3].


3.4.8 Decrement/Quadrature/End Control Register

Similar to the Increment/In-Phase/Begin Control Register (ICR), the Decrement/Quadrature/End Control Register (DCR) complements the ICR in its function to decrement the counter, act as the quadrature input to a quadrature signal, or stop the counter. It also controls how that pin is detected, whether it be by an edge, level, or transition.

Decrement/Quadrature/End Control Register (DCR) (Address = 0x07)

Bit(s)

Value

Description

7:6
These bits are reserved and should not be used.
5:3
000
Disable Decrement/Quadrature/End signal without generating an edge
001
Decrement/Quadrature/End signalled on rising edge.
010
Decrement/Quadrature/End signalled on falling edge.
011
Decrement/Quadrature/End signalled on either edge.
100
Decrement/Quadrature/End signalled on 01 ® 11 ® 10 ® 00 ® 01 quadrature decoder transitions.
101
This bit combination is reserved and should not be used.
110
Decrement/Quadrature/End signalled while low.
111
Decrement/Quadrature/End signalled while high.
2:0
000
No selection. Selector output is low.
001
This bit combination is reserved and should not be used.
010
This bit combination is reserved and should not be used.
011
Select Global Synch.
100
Select Pin[0].
101
Select Pin[1].
110
Select Pin[2].
111
Select Pin[3].


3.4.9 Status Control Registers

The Status Control Registers determine how the status signal is generated, if at all.

Status x Control Register (S0CR) (Address = 0x08)
(S1CR) (Address = 0x09)
(S2CR) (Address = 0x0A)
(S3CR) (Address =0x0B)

Bit(s)

Value

Description

7:6
These bits are reserved and should not be used.
5:3
000
Status x not set by internal conditions.
001
Status x set by counter rollover (decrement).
010
Status x set by counter rollover (increment).
011
Status x set by synch signal.
100
Status x set by Match 0 condition.
101
Status x set by Match 1 condition.
110
Status x set by Match 2 condition.
111
Status x set by Match 3 condition.
2:0
000
Status x reset by internal conditions.
001
Status x reset by counter rollover (decrement).
010
Status x reset by counter rollover (increment).
011
Status x reset by synch signal.
100
Status x reset by Match 0 condition.
101
Status x reset by Match 1 condition.
110
Status x reset by Match 2 condition.
111
Status x reset by Match 3 condition.

3.4.10 Pin Control Registers

The Pin Control Registers determine the overall function of a pin.

Pin x Control Register (P0CR) (Address = 0x0C)
(P1CR) (Address = 0x0D)
(P2CR) (Address = 0x0E)
(P3CR) (Address = 0x0F)

Bit(s)

Value

Description

7:4
read
These bits return the current state of Pin[3:0].
7:4
write
These bits store the output data for Pin[3:0] (P3CR only).
3
This bit is reserved and should not be used.
2:0
000
Pin bit is an input.
001
This bit combination is reserved and should not be used.
010
This bit is an output — Status x & Toggle.
011
Pin bit is an output — Status x
100
Pin bit is an output: use appropriate bit of PxCR. Sequence through P0CR-P1CR-P2CR-P3CR, changing on each counter (increment) rollover.
101
Pin bit is an output: use appropriate bit of P3CR.
110
Pin bit is an output — low.
111
Pin bit is an output — high.


3.4.11 Match Registers

Match x LSB Register (M0LR) (Address = 0x10)
(M1LR) (Address = 0x12)
(M2LR) (Address = 0x14)
(M3LR) (Address = 0x16)

Match x MSB Register (M0MR) (Address = 0x11)
(M1MR) (Address = 0x13)
(M2MR) (Address = 0x15)
(M3MR) (Address = 0x17)

Bit(s)

Value

Description

7:0
When the current count equals the value held in this register, the Match x signal is true. This signal can be used to set a status signal and generate an interrupt request. The value in this register is loaded into a holding register for the comparison each time the counter is reloaded to allow modification of the match value during the current count cycle.

3.4.12 Count Limit Registers

The Count Limit Register is a 16-bit register used to tell the counter that the end of the counting cycle has been reached and to reset.

Count Limit LSB Register (CLLR) (Address = 0x18)

Count Limit MSB Register (CLMR) (Address = 0x19)

Bit(s)

Value

Description

7:0
When the counter reaches the value held in one of these registers (plus 1), the counter will be reset to all zeros, effectively causing division by n + 1. For example, this means placing an 8 in the register means a divide by 9.


3.4.13 Count Begin Registers

At the trigger of the Begin signal, the value of the counter is latched into the Count Begin Registers.

Count Begin LSB Register (CBLR) (Address=0x1A)

Count Begin MSB Register (CBMR) (Address=0x1B)

Bit(s)

Value

Description

7:0
These registers return the count that was latched by the Begin condition. The value that is ready is guaranteed to be stable by freeing the read data while the pointer is pointing to either of these registers. This latching function is independent of the latches controlled by the Begin condition.


3.4.14 Count End Registers

At the trigger of the End signal, the value of the counter is latched to the Count End Registers.

Count End LSB Register (CELR) (Address=0x1C)

Count End MSB Register (CEMR) (Address=0x1D)

Bit(s)

Value

Description

7:0
These registers hold the count that was latched by the End condition. The value that is read is guaranteed to be stable by freezing the read data while the pointer is pointing to either of these registers. This latching functions is independent of the latches controlled by the End condition.


3.4.15 Count Value Registers

At any point during the count cycle, the value of the counter can be read from this register.

Count Value LSB Register (CVLR) (Address = 0x1E)

Count Value MSB Register (CVMR) (Address=0x1F)

Bit(s)

Value

Description

7:0
The current count is returned. The value that is read is guaranteed to be stable by freezing the read data while the pointer is pointing to either of these registers. This implies that the pointer must be modified to point at another register to allow a new current count to be read.



Rabbit Semiconductor
www.rabbit.com
PREV INDEX NEXT