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
Pointer Register
|
|
|
|
|
Indirect Register
|
|
|
|
|
Command Register
|
|
|
|
|
Mode Register
|
|
|
|
|
Interrupt Enable Register
|
|
|
|
|
Status Register
|
|
|
|
|
Counter Toggle Register
|
|
|
|
|
Synch Control Register
|
|
|
|
|
Increment/In-Phase/Begin Control Register
|
|
|
|
|
Decrement/Quadrature/End Control Register
|
|
|
|
|
Status 0 Control Register
|
|
|
|
|
Status 1 Control Register
|
|
|
|
|
Status 2 Control Register
|
|
|
|
|
Status 3 Control Register
|
|
|
|
|
Pin 0 Control Register
|
|
|
|
|
Pin 1 Control Register
|
|
|
|
|
Pin 2 Control Register
|
|
|
|
|
Pin 3 Control Register
|
|
|
|
|
Match 0 LSB Register
|
|
|
|
|
Match 0 MSB Register
|
|
|
|
|
Match 1 LSB Register
|
|
|
|
|
Match 1 MSB Register
|
|
|
|
|
Match 2 LSB Register
|
|
|
|
|
Match 2 MSB Register
|
|
|
|
|
Match 3 LSB Register
|
|
|
|
|
Match 3 MSB Register
|
|
|
|
|
Count Limit LSB Register
|
|
|
|
|
Count Limit MSB Register
|
|
|
|
|
Count Begin LSB Register
|
|
|
|
|
Count Begin MSB Register
|
|
|
|
|
Count End LSB Register
|
|
|
|
|
Count End MSB Register
|
|
|
|
|
Count Value LSB Register
|
|
|
|
|
Count Value MSB Register
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
Disable pointer auto-increment.
|
|
|
Enable pointer auto-increment.
|
|
|
|
These bits are ignored during writes and always return zero when read.
|
|
|
|
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)
|
|
|
|
|
|
|
|
Data from the register addressed by the Pointer Register are returned.
|
|
|
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)
|
|
|
|
|
|
|
|
No operation. This bit always reads a zero.
|
|
|
Reset counter to all zeros.
|
|
|
|
No operation. This bit always reads a zero.
|
|
|
Force a synch signal.
|
|
|
|
No operation. This bit always reads a zero.
|
|
|
Force an Increment/Begin signal.
|
|
|
|
No operation. This bit always reads a zero.
|
|
|
Force a Decrement/End signal.
|
|
|
|
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)
|
|
|
|
|
|
|
|
These bits are ignored and should not be used.
|
|
|
|
Use the master clock directly (for both input synchronizers and timer).
|
|
|
Use prescaler output clock (for both input synchronizers and timer).
|
|
|
|
Disable counter/timer.
|
|
|
Enable counter mode. Count forever on Increment/In-Phase/Begin signal.
|
|
|
Enable counter mode. Count until any match condition on Increment/In-Phase/Begin signal.
|
|
|
Enable counter mode. Count up on Increment/In-Phase/Begin and count down on Decrement/Quadrature/End.
|
|
|
Enable timer mode. Counter runs continuously.
|
|
|
Enable timer mode. Counter runs continuously, until the End condition.
|
|
|
Enable timer mode. Counter runs from Begin condition until the End condition.
|
|
|
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)
|
|
|
|
|
|
|
|
Disable Decrement/Quadrature/End interrupt.
|
|
|
Enable Decrement/Quadrature/End interrupt
|
|
|
|
Disable Increment/In-Phase/Begin interrupt.
|
|
|
Enable Increment/In-Phase/Begin interrupt.
|
|
|
|
Disable counter rollover (decrement) interrupt.
|
|
|
Enable counter rollover (decrement) interrupt.
|
|
|
|
Disable counter rollover (increment) interrupt.
|
|
|
Enable counter rollover (increment) interrupt.
|
|
|
|
Disable Match 3 interrupt.
|
|
|
Enable Match 3 interrupt.
|
|
|
|
Disable Match 2 interrupt.
|
|
|
Enable Match 2 interrupt.
|
|
|
|
Disable Match 1 interrupt.
|
|
|
Enable Match 1 interrupt.
|
|
|
|
Disable Match 0 interrupt.
|
|
|
Enable Match 0 interrupt.
|
|
Status Register (SR) (Pointer = 0x03)
|
|
|
|
|
|
|
|
No operation
|
|
|
Clear the corresponding interrupt condition
|
|
|
|
No Decrement/Quadrature/End interrupt condition pending.
|
|
|
Decrement/Quadrature/End interrupt condition pending.
|
|
|
|
No Increment/In-Phase/Begin interrupt condition pending
|
|
|
Increment/In-Phase/Begin interrupt condition pending.
|
|
|
|
No counter rollover (increment) interrupt condition pending.
|
|
|
Counter rollover (increment) interrupt condition pending.
|
|
|
|
No Counter Rollover (decrement) interrupt condition pending.
|
|
|
Counter Rollover (decrement) interrupt condition pending.
|
|
|
|
No Match 3 interrupt condition pending.
|
|
|
Match 3 interrupt condition pending.
|
|
|
|
No Match 2 interrupt condition pending.
|
|
|
Match 2 interrupt condition pending.
|
|
|
|
No Match 1 interrupt condition pending.
|
|
|
Match 1 interrupt condition pending.
|
|
|
|
No Match 0 interrupt condition pending.
|
|
|
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)
|
|
|
|
|
|
|
|
Deselect the corresponding bit of the counter as the toggle signal.
|
|
|
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)
|
|
|
|
|
|
|
|
Synch signal does not affect counter.
|
|
|
Enable synch signal to reset counter.
|
|
|
|
This bit is reserved and should not be used.
|
|
|
|
Disable synch signal, without generating an edge.
|
|
|
Synch signalled on rising edge.
|
|
|
Synch signalled on falling edge.
|
|
|
Synch signalled on either edge.
|
|
|
This bit combination is reserved and should not be used.
|
|
|
This bit combination is reserved and should not be used.
|
|
|
Synch signalled while low.
|
|
|
Synch signalled while high.
|
|
|
|
No selection. Selector output is low.
|
|
|
This bit combination is reserved and should not be used.
|
|
|
This bit combination is reserved and should not be used.
|
|
|
Select Global Synch.
|
|
|
Select Pin[0].
|
|
|
Select Pin[1].
|
|
|
Select Pin[2].
|
|
|
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)
|
|
|
|
|
|
|
|
These bits are reserved and should not be used.
|
|
|
|
Disable Increment/In-Phase/Begin signal without generating an edge
|
|
|
Increment/In-Phase/Begin signal on rising edge.
|
|
|
Increment/In-Phase/Begin signal on falling edge.
|
|
|
Increment/In-Phase/Begin signal on either edge.
|
|
|
Increment/In-Phase/Begin signal on 10 ® 11 ® 01 ® 00 ® 10 quadrature decoder transitions.
|
|
|
This bit combination is reserved and should not be used.
|
|
|
Increment/In-Phase/Begin signal while low.
|
|
|
Increment/In-Phase/Begin signal while high.
|
|
|
|
No selection. Selector output is low.
|
|
|
This bit combination is reserved and should not be used.
|
|
|
This bit combination is reserved and should not be used.
|
|
|
Select Global Synch.
|
|
|
Select Pin[0].
|
|
|
Select Pin[1].
|
|
|
Select Pin[2].
|
|
|
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)
|
|
|
|
|
|
|
|
These bits are reserved and should not be used.
|
|
|
|
Disable Decrement/Quadrature/End signal without generating an edge
|
|
|
Decrement/Quadrature/End signalled on rising edge.
|
|
|
Decrement/Quadrature/End signalled on falling edge.
|
|
|
Decrement/Quadrature/End signalled on either edge.
|
|
|
Decrement/Quadrature/End signalled on 01 ® 11 ® 10 ® 00 ® 01 quadrature decoder transitions.
|
|
|
This bit combination is reserved and should not be used.
|
|
|
Decrement/Quadrature/End signalled while low.
|
|
|
Decrement/Quadrature/End signalled while high.
|
|
|
|
No selection. Selector output is low.
|
|
|
This bit combination is reserved and should not be used.
|
|
|
This bit combination is reserved and should not be used.
|
|
|
Select Global Synch.
|
|
|
Select Pin[0].
|
|
|
Select Pin[1].
|
|
|
Select Pin[2].
|
|
|
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)
|
|
|
|
|
|
|
|
These bits are reserved and should not be used.
|
|
|
|
Status x not set by internal conditions.
|
|
|
Status x set by counter rollover (decrement).
|
|
|
Status x set by counter rollover (increment).
|
|
|
Status x set by synch signal.
|
|
|
Status x set by Match 0 condition.
|
|
|
Status x set by Match 1 condition.
|
|
|
Status x set by Match 2 condition.
|
|
|
Status x set by Match 3 condition.
|
|
|
|
Status x reset by internal conditions.
|
|
|
Status x reset by counter rollover (decrement).
|
|
|
Status x reset by counter rollover (increment).
|
|
|
Status x reset by synch signal.
|
|
|
Status x reset by Match 0 condition.
|
|
|
Status x reset by Match 1 condition.
|
|
|
Status x reset by Match 2 condition.
|
|
|
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)
|
|
|
|
|
|
|
|
These bits return the current state of Pin[3:0].
|
|
|
|
These bits store the output data for Pin[3:0] (P3CR only).
|
|
|
|
This bit is reserved and should not be used.
|
|
|
|
Pin bit is an input.
|
|
|
This bit combination is reserved and should not be used.
|
|
|
This bit is an output Status x & Toggle.
|
|
|
Pin bit is an output Status x
|
|
|
Pin bit is an output: use appropriate bit of PxCR. Sequence through P0CR-P1CR-P2CR-P3CR, changing on each counter (increment) rollover.
|
|
|
Pin bit is an output: use appropriate bit of P3CR.
|
|
|
Pin bit is an output low.
|
|
|
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)
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
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.
|