Timer Counter Channel Interface Peripheral

TC5 (AT91S_TC) 0xFFFA4080 (AT91C_BASE_TC5)
Periph ID AICSymbolDescription
22 (AT91C_ID_TC5)Timer Counter 5

FunctionDescription
AT91F_TC5_CfgPMCEnable Peripheral clock in PMC for TC5


TC4 (AT91S_TC) 0xFFFA4040 (AT91C_BASE_TC4)
Periph ID AICSymbolDescription
21 (AT91C_ID_TC4)Timer Counter 4

FunctionDescription
AT91F_TC4_CfgPMCEnable Peripheral clock in PMC for TC4


TC3 (AT91S_TC) 0xFFFA4000 (AT91C_BASE_TC3)
Periph ID AICSymbolDescription
20 (AT91C_ID_TC3)Timer Counter 3

FunctionDescription
AT91F_TC3_CfgPMCEnable Peripheral clock in PMC for TC3


TC2 (AT91S_TC) 0xFFFA0080 (AT91C_BASE_TC2)
Periph ID AICSymbolDescription
19 (AT91C_ID_TC2)Timer Counter 2

FunctionDescription
AT91F_TC2_CfgPMCEnable Peripheral clock in PMC for TC2


TC1 (AT91S_TC) 0xFFFA0040 (AT91C_BASE_TC1)
Periph ID AICSymbolDescription
18 (AT91C_ID_TC1)Timer Counter 1

FunctionDescription
AT91F_TC1_CfgPMCEnable Peripheral clock in PMC for TC1


TC0 (AT91S_TC) 0xFFFA0000 (AT91C_BASE_TC0)
Periph ID AICSymbolDescription
17 (AT91C_ID_TC0)Timer Counter 0

FunctionDescription
AT91F_TC0_CfgPMCEnable Peripheral clock in PMC for TC0


TC Software API (AT91S_TC)

OffsetFieldDescription
0x0TC_CCRChannel Control Register
0x4TC_CMRChannel Mode Register
0x10TC_CVCounter Value
0x14TC_RARegister A
0x18TC_RBRegister B
0x1CTC_RCRegister C
0x20TC_SRStatus Register
0x24TC_IERInterrupt Enable Register
0x28TC_IDRInterrupt Disable Register
0x2CTC_IMRInterrupt Mask Register

FunctionDescription
AT91F_TC_GetInterruptMaskStatusReturn TC Interrupt Mask Status
AT91F_TC_IsInterruptMaskedTest if TC Interrupt is Masked
AT91F_TC_InterruptDisableDisable TC Interrupt
AT91F_TC_InterruptEnableEnable TC Interrupt

TC Register Description

TC: AT91_REG TC_CCR Channel Control Register

OffsetNameDescription
0TC_CLKEN
AT91C_TC_CLKEN
Counter Clock Enable Command
0 = No effect.
1 = Enables the clock if CLKDIS is not 1.
1TC_CLKDIS
AT91C_TC_CLKDIS
Counter Clock Disable Command
0 = No effect.
1 = Disables the clock.
2TC_SWTRG
AT91C_TC_SWTRG
Software Trigger Command
0 = No effect.
1 = A software trigger is performed: the counter is reset and clock is started.

TC: AT91_REG TC_CMR Channel Mode Register

OffsetNameDescription
6TC_CPCSTOP
AT91C_TC_CPCSTOP
Counter Clock Stopped with RC Compare
0 = Counter clock is not stopped when counter reaches RC.
1 = Counter clock is stopped when counter reaches RC.
7TC_CPCDIS
AT91C_TC_CPCDIS
Counter Clock Disable with RC Compare
0 = Counter clock is not disabled when counter reaches RC.
1 = Counter clock is disabled when counter reaches RC.
9..8TC_EEVTEDG
AT91C_TC_EEVTEDG
External Event Edge Selection
ValueLabelDescription
0TC_EEVTEDG_NONE
AT91C_TC_EEVTEDG_NONE

Edge: None
1TC_EEVTEDG_RISING
AT91C_TC_EEVTEDG_RISING

Edge: rising edge
2TC_EEVTEDG_FALLING
AT91C_TC_EEVTEDG_FALLING

Edge: falling edge
3TC_EEVTEDG_BOTH
AT91C_TC_EEVTEDG_BOTH

Edge: each edge
11..10TC_EEVT
AT91C_TC_EEVT
External Event Selection
ValueLabelDescription
0TC_EEVT_NONE
AT91C_TC_EEVT_NONE

Signal selected as external event: TIOB TIOB direction: input
1TC_EEVT_RISING
AT91C_TC_EEVT_RISING

Signal selected as external event: XC0 TIOB direction: output
2TC_EEVT_FALLING
AT91C_TC_EEVT_FALLING

Signal selected as external event: XC1 TIOB direction: output
3TC_EEVT_BOTH
AT91C_TC_EEVT_BOTH

Signal selected as external event: XC2 TIOB direction: output
12TC_ENETRG
AT91C_TC_ENETRG
External Event Trigger enable
0 = The external event has no effect on the counter and its clock. In this case, the selected external event only controls the TIOA output.
1 = The external event resets the counter and starts the counter clock.
14..13TC_WAVESEL
AT91C_TC_WAVESEL
Waveform Selection
ValueLabelDescription
0TC_WAVESEL_UP
AT91C_TC_WAVESEL_UP

UP mode without atomatic trigger on RC Compare
1TC_WAVESEL_UP_AUTO
AT91C_TC_WAVESEL_UP_AUTO

UP mode with automatic trigger on RC Compare
2TC_WAVESEL_UPDOWN
AT91C_TC_WAVESEL_UPDOWN

UPDOWN mode without automatic trigger on RC Compare
3TC_WAVESEL_UPDOWN_AUTO
AT91C_TC_WAVESEL_UPDOWN_AUTO

UPDOWN mode with automatic trigger on RC Compare
14TC_CPCTRG
AT91C_TC_CPCTRG
RC Compare Trigger Enable
0 = RC Compare has no effect on the counter and its clock.
1 = RC Compare resets the counter and starts the counter clock.
15TC_WAVE
AT91C_TC_WAVE

0 = Capture Mode is enabled.
1 = Capture Mode is disabled (Waveform Mode is enabled).
0 = Waveform Mode is disabled (Capture Mode is enabled).
1 = Waveform Mode is enabled.
17..16TC_ACPA
AT91C_TC_ACPA
RA Compare Effect on TIOA
ValueLabelDescription
0TC_ACPA_NONE
AT91C_TC_ACPA_NONE

Effect: none
1TC_ACPA_SET
AT91C_TC_ACPA_SET

Effect: set
2TC_ACPA_CLEAR
AT91C_TC_ACPA_CLEAR

Effect: clear
3TC_ACPA_TOGGLE
AT91C_TC_ACPA_TOGGLE

Effect: toggle
19..18TC_ACPC
AT91C_TC_ACPC
RC Compare Effect on TIOA
ValueLabelDescription
0TC_ACPC_NONE
AT91C_TC_ACPC_NONE

Effect: none
1TC_ACPC_SET
AT91C_TC_ACPC_SET

Effect: set
2TC_ACPC_CLEAR
AT91C_TC_ACPC_CLEAR

Effect: clear
3TC_ACPC_TOGGLE
AT91C_TC_ACPC_TOGGLE

Effect: toggle
21..20TC_AEEVT
AT91C_TC_AEEVT
External Event Effect on TIOA
ValueLabelDescription
0TC_AEEVT_NONE
AT91C_TC_AEEVT_NONE

Effect: none
1TC_AEEVT_SET
AT91C_TC_AEEVT_SET

Effect: set
2TC_AEEVT_CLEAR
AT91C_TC_AEEVT_CLEAR

Effect: clear
3TC_AEEVT_TOGGLE
AT91C_TC_AEEVT_TOGGLE

Effect: toggle
23..22TC_ASWTRG
AT91C_TC_ASWTRG
Software Trigger Effect on TIOA
ValueLabelDescription
0TC_ASWTRG_NONE
AT91C_TC_ASWTRG_NONE

Effect: none
1TC_ASWTRG_SET
AT91C_TC_ASWTRG_SET

Effect: set
2TC_ASWTRG_CLEAR
AT91C_TC_ASWTRG_CLEAR

Effect: clear
3TC_ASWTRG_TOGGLE
AT91C_TC_ASWTRG_TOGGLE

Effect: toggle
25..24TC_BCPB
AT91C_TC_BCPB
RB Compare Effect on TIOB
ValueLabelDescription
0TC_BCPB_NONE
AT91C_TC_BCPB_NONE

Effect: none
1TC_BCPB_SET
AT91C_TC_BCPB_SET

Effect: set
2TC_BCPB_CLEAR
AT91C_TC_BCPB_CLEAR

Effect: clear
3TC_BCPB_TOGGLE
AT91C_TC_BCPB_TOGGLE

Effect: toggle
27..26TC_BCPC
AT91C_TC_BCPC
RC Compare Effect on TIOB
ValueLabelDescription
0TC_BCPC_NONE
AT91C_TC_BCPC_NONE

Effect: none
1TC_BCPC_SET
AT91C_TC_BCPC_SET

Effect: set
2TC_BCPC_CLEAR
AT91C_TC_BCPC_CLEAR

Effect: clear
3TC_BCPC_TOGGLE
AT91C_TC_BCPC_TOGGLE

Effect: toggle
29..28TC_BEEVT
AT91C_TC_BEEVT
External Event Effect on TIOB
ValueLabelDescription
0TC_BEEVT_NONE
AT91C_TC_BEEVT_NONE

Effect: none
1TC_BEEVT_SET
AT91C_TC_BEEVT_SET

Effect: set
2TC_BEEVT_CLEAR
AT91C_TC_BEEVT_CLEAR

Effect: clear
3TC_BEEVT_TOGGLE
AT91C_TC_BEEVT_TOGGLE

Effect: toggle
31..30TC_BSWTRG
AT91C_TC_BSWTRG
Software Trigger Effect on TIOB
ValueLabelDescription
0TC_BSWTRG_NONE
AT91C_TC_BSWTRG_NONE

Effect: none
1TC_BSWTRG_SET
AT91C_TC_BSWTRG_SET

Effect: set
2TC_BSWTRG_CLEAR
AT91C_TC_BSWTRG_CLEAR

Effect: clear
3TC_BSWTRG_TOGGLE
AT91C_TC_BSWTRG_TOGGLE

Effect: toggle

TC: AT91_REG TC_CV Counter Value


0-65535 Counter Value contains the counter value in real time.

TC: AT91_REG TC_RA Register A


TC Register A contains the Register A value in real time

TC: AT91_REG TC_RB Register B


TC Register B contains the Register B value in real time

TC: AT91_REG TC_RC Register C


TC Register C contains the Register C value in real time

TC: AT91_REG TC_SR Status Register

OffsetNameDescription
0TC_COVFS
AT91C_TC_COVFS
Counter Overflow
0 = No counter overflow has occurred since the last read of the Status Register.
1 = A counter overflow has occurred since the last read of the Status Register.
1TC_LOVRS
AT91C_TC_LOVRS
Load Overrun
0 = Load overrun has not occurred since the last read of the Status Register or WAVE = 1.
1 = RA or RB have been loaded at least twice without any read of the corresponding register since the last read of the Sta-tus Register, if WAVE = 0.
2TC_CPAS
AT91C_TC_CPAS
RA Compare
0 = RA Compare has not occurred since the last read of the Status Register or WAVE = 0.
1 = RA Compare has occurred since the last read of the Status Register, if WAVE = 1.
3TC_CPBS
AT91C_TC_CPBS
RB Compare
0 = RB Compare has not occurred since the last read of the Status Register or WAVE = 0.
1 = RB Compare has occurred since the last read of the Status Register, if WAVE = 1.
4TC_CPCS
AT91C_TC_CPCS
RC Compare
0 = RC Compare has not occurred since the last read of the Status Register.
1 = RC Compare has occurred since the last read of the Status Register.
5TC_LDRAS
AT91C_TC_LDRAS
RA Loading
0 = RA Load has not occurred since the last read of the Status Register or WAVE = 1.
1 = RA Load has occurred since the last read of the Status Register, if WAVE = 0.
6TC_LDRBS
AT91C_TC_LDRBS
RB Loading
0 = RB Load has not occurred since the last read of the Status Register or WAVE = 1.
1 = RB Load has occurred since the last read of the Status Register, if WAVE = 0.
7TC_ETRCS
AT91C_TC_ETRCS
External Trigger
0 = External trigger has not occurred since the last read of the Status Register.
1 = External trigger has occurred since the last read of the Status Register.
16TC_ETRGS
AT91C_TC_ETRGS
Clock Enabling
0 = Clock is disabled.
1 = Clock is enabled.
17TC_MTIOA
AT91C_TC_MTIOA
TIOA Mirror
0 = TIOA is low. If WAVE = 0, this means that TIOA pin is low. If WAVE = 1, this means that TIOA is driven low.
1 = TIOA is high. If WAVE = 0, this means that TIOA pin is high. If WAVE = 1, this means that TIOA is driven high.
18TC_MTIOB
AT91C_TC_MTIOB
TIOA Mirror
0 = TIOB is low. If WAVE = 0, this means that TIOB pin is low. If WAVE = 1, this means that TIOB is driven low.
1 = TIOB is high. If WAVE = 0, this means that TIOB pin is high. If WAVE = 1, this means that TIOB is driven high.

TC: AT91_REG TC_IER Interrupt Enable Register

OffsetNameDescription
0TC_COVFS
AT91C_TC_COVFS
Counter Overflow
0 = No counter overflow has occurred since the last read of the Status Register.
1 = A counter overflow has occurred since the last read of the Status Register.
1TC_LOVRS
AT91C_TC_LOVRS
Load Overrun
0 = Load overrun has not occurred since the last read of the Status Register or WAVE = 1.
1 = RA or RB have been loaded at least twice without any read of the corresponding register since the last read of the Sta-tus Register, if WAVE = 0.
2TC_CPAS
AT91C_TC_CPAS
RA Compare
0 = RA Compare has not occurred since the last read of the Status Register or WAVE = 0.
1 = RA Compare has occurred since the last read of the Status Register, if WAVE = 1.
3TC_CPBS
AT91C_TC_CPBS
RB Compare
0 = RB Compare has not occurred since the last read of the Status Register or WAVE = 0.
1 = RB Compare has occurred since the last read of the Status Register, if WAVE = 1.
4TC_CPCS
AT91C_TC_CPCS
RC Compare
0 = RC Compare has not occurred since the last read of the Status Register.
1 = RC Compare has occurred since the last read of the Status Register.
5TC_LDRAS
AT91C_TC_LDRAS
RA Loading
0 = RA Load has not occurred since the last read of the Status Register or WAVE = 1.
1 = RA Load has occurred since the last read of the Status Register, if WAVE = 0.
6TC_LDRBS
AT91C_TC_LDRBS
RB Loading
0 = RB Load has not occurred since the last read of the Status Register or WAVE = 1.
1 = RB Load has occurred since the last read of the Status Register, if WAVE = 0.
7TC_ETRCS
AT91C_TC_ETRCS
External Trigger
0 = External trigger has not occurred since the last read of the Status Register.
1 = External trigger has occurred since the last read of the Status Register.

TC: AT91_REG TC_IDR Interrupt Disable Register

OffsetNameDescription
0TC_COVFS
AT91C_TC_COVFS
Counter Overflow
0 = No counter overflow has occurred since the last read of the Status Register.
1 = A counter overflow has occurred since the last read of the Status Register.
1TC_LOVRS
AT91C_TC_LOVRS
Load Overrun
0 = Load overrun has not occurred since the last read of the Status Register or WAVE = 1.
1 = RA or RB have been loaded at least twice without any read of the corresponding register since the last read of the Sta-tus Register, if WAVE = 0.
2TC_CPAS
AT91C_TC_CPAS
RA Compare
0 = RA Compare has not occurred since the last read of the Status Register or WAVE = 0.
1 = RA Compare has occurred since the last read of the Status Register, if WAVE = 1.
3TC_CPBS
AT91C_TC_CPBS
RB Compare
0 = RB Compare has not occurred since the last read of the Status Register or WAVE = 0.
1 = RB Compare has occurred since the last read of the Status Register, if WAVE = 1.
4TC_CPCS
AT91C_TC_CPCS
RC Compare
0 = RC Compare has not occurred since the last read of the Status Register.
1 = RC Compare has occurred since the last read of the Status Register.
5TC_LDRAS
AT91C_TC_LDRAS
RA Loading
0 = RA Load has not occurred since the last read of the Status Register or WAVE = 1.
1 = RA Load has occurred since the last read of the Status Register, if WAVE = 0.
6TC_LDRBS
AT91C_TC_LDRBS
RB Loading
0 = RB Load has not occurred since the last read of the Status Register or WAVE = 1.
1 = RB Load has occurred since the last read of the Status Register, if WAVE = 0.
7TC_ETRCS
AT91C_TC_ETRCS
External Trigger
0 = External trigger has not occurred since the last read of the Status Register.
1 = External trigger has occurred since the last read of the Status Register.

TC: AT91_REG TC_IMR Interrupt Mask Register

OffsetNameDescription
0TC_COVFS
AT91C_TC_COVFS
Counter Overflow
0 = No counter overflow has occurred since the last read of the Status Register.
1 = A counter overflow has occurred since the last read of the Status Register.
1TC_LOVRS
AT91C_TC_LOVRS
Load Overrun
0 = Load overrun has not occurred since the last read of the Status Register or WAVE = 1.
1 = RA or RB have been loaded at least twice without any read of the corresponding register since the last read of the Sta-tus Register, if WAVE = 0.
2TC_CPAS
AT91C_TC_CPAS
RA Compare
0 = RA Compare has not occurred since the last read of the Status Register or WAVE = 0.
1 = RA Compare has occurred since the last read of the Status Register, if WAVE = 1.
3TC_CPBS
AT91C_TC_CPBS
RB Compare
0 = RB Compare has not occurred since the last read of the Status Register or WAVE = 0.
1 = RB Compare has occurred since the last read of the Status Register, if WAVE = 1.
4TC_CPCS
AT91C_TC_CPCS
RC Compare
0 = RC Compare has not occurred since the last read of the Status Register.
1 = RC Compare has occurred since the last read of the Status Register.
5TC_LDRAS
AT91C_TC_LDRAS
RA Loading
0 = RA Load has not occurred since the last read of the Status Register or WAVE = 1.
1 = RA Load has occurred since the last read of the Status Register, if WAVE = 0.
6TC_LDRBS
AT91C_TC_LDRBS
RB Loading
0 = RB Load has not occurred since the last read of the Status Register or WAVE = 1.
1 = RB Load has occurred since the last read of the Status Register, if WAVE = 0.
7TC_ETRCS
AT91C_TC_ETRCS
External Trigger
0 = External trigger has not occurred since the last read of the Status Register.
1 = External trigger has occurred since the last read of the Status Register.