33.8.3 Control B Set

This register allows the user to set bits in the CTRLB register without doing a read-modify-write operation. Changes in this register will also be reflected in the Control B Clear register (CTRLBCLR).

Note: This register is read- and write-synchronized: SYNCBUSY.CTRLB must be checked to ensure the CTRLBSET register synchronization is complete.
Name: CTRLBSET
Offset: 0x05
Reset: 0x00
Property: PAC Write-Protection, Read-Synchronized, Write-Synchronized

Bit 76543210 
 CMD[2:0]  ONESHOTLUPDDIR 
Access R/WR/WR/WR/WR/WR/W 
Reset 000000 

Bits 7:5 – CMD[2:0] Command

These bits are used for software control of the TC. The commands are executed on the next prescaled GCLK_TC clock cycle. When a command has been executed, the CMD bit group will be read back as zero.

Writing 0x0 to these bits has no effect.

Writing a value different from 0x0 to these bits will issue a command for execution.

Important: This command requires synchronization before being executed. A valid sequence is:
  • Issue CMD command (CTRLBSET.CMD = command)
  • Wait for CMD synchronization (SYNCBUSY.CTRLB = 0)
  • Wait for CMD read back as zero (CTRLBSET.CMD = 0)
ValueNameDescription
0x0 NONE No action
0x1 RETRIGGER Force a start, restart or retrigger
0x2 STOP Force a stop
0x3 UPDATE Force update of double buffered registers
0x4 READSYNC Force a read synchronization of COUNT

Bit 2 – ONESHOT One-Shot on Counter

This bit controls one-shot operation of the TC.

Writing a '0' to this bit has no effect.

Writing a '1' to this bit will enable one-shot operation.

ValueDescription
0 The TC will wrap around and continue counting on an overflow/underflow condition.
1 The TC will wrap around and stop on the next underflow/overflow condition.

Bit 1 – LUPD Lock Update

This bit controls the update operation of the TC buffered registers.

When CTRLB.LUPD is set, no any update of the registers with value of its buffered register is performed on hardware UPDATE condition. Locking the update ensures that all buffer registers are valid before an hardware update is performed. After all the buffer registers are loaded correctly, the buffered registers can be unlocked.

Writing a '0' to this bit has no effect.

Writing a '1' to this bit will set the LUPD bit.

This bit has no effect when input capture operation is enabled.

ValueDescription
0 The CCBUFx and PERBUF buffer registers value are copied into CCx and PER registers on hardware update condition.
1 The CCBUFx and PERBUF buffer registers value are not copied into CCx and PER registers on hardware update condition.

Bit 0 – DIR Counter Direction

This bit is used to change the direction of the counter.

Writing a '0' to this bit has no effect

Writing a '1' to this bit will set the bit and make the counter count down.

ValueDescription
0 The timer/counter is counting up (incrementing).
1 The timer/counter is counting down (decrementing).