CTRA, CTRB
Register: Counter A and Counter B control registers.
DAT
< Label > < Condition > Instruction CTRA, SrcOperand < Effects >
DAT
< Label > < Condition > Instruction DestOperand, CTRA < Effects >
DAT
< Label > < Condition > Instruction CTRB, SrcOperand < Effects >
DAT
< Label > < Condition > Instruction DestOperand, CTRB < Effects >
Result: Optionally, the counter control register is updated.
- Label is an optional statement label. See Common Syntax Elements.
- Condition is an optional execution condition. See Common Syntax Elements.
- Instruction is the desired assembly instruction. CTRA or CTRB may be used in either the assembly instruction's DestOperand or SrcOperand fields.
- SrcOperand is a constant expression used by Instruction to operate on, and optionally write to, the CTRA or CTRB register in DestOperand.
- DestOperand is a constant expression indicating the register that is operated on, and optionally written to, using the value of CTRA or CTRB in SrcOperand.
Explanation
CTRA and CTRB are two of six registers (CTRA, CTRB, FRQA, FRQB, PHSA, and PHSB) that affect the behavior of a cog's Counter Modules. Each cog has two identical counter modules (A and B) that can perform many repetitive tasks. The CTRA and CTRB registers contain the configuration settings of the Counter A and Counter B Modules, respectively.
CTRA and CTRB are read/write registers and can be used in either the DestOperand or SrcOperand fields of an assembly instruction. The following code sets Counter A to NCO mode on I/O pin 2. See Registers, and the Spin language CTRA, CTRB, for more information.
mov ctra, CtrCfg CtrCfg long %0_00100_000_0000000_000000_000_000010
Unless otherwise noted, content on this site is licensed under the
Creative Commons Attribution-ShareAlike 4.0 International License.