Download Not eXactly C (NXC)

Transcript
NXC Programmer's Guide
UF_UPDATE_RESET_BLOCK_COUNT
UF_UPDATE_RESET_ROTATION_COUNT
Resets the block-relative rotation counter
Resets the program-relative rotation counter
Table 15. UpdateFlag Constants
Valid OutputMode values are described in the following table.
OutputMode Constants
Value
Meaning
OUT_MODE_COAST
OUT_MODE_MOTORON
OUT_MODE_BRAKE
OUT_MODE_REGULATED
OUT_MODE_REGMETHOD
0x00
0x01
0x02
0x04
0xf0
No power and no braking so motors rotate freely
Enables PWM power to the outputs given the Power setting
Uses electronic braking to outputs
Enables active power regulation using the RegMode value
Table 16. OutputMode Constants
Valid RunState values are described in the following table.
RunState Constants
Value
Meaning
OUT_RUNSTATE_IDLE
OUT_RUNSTATE_RAMPUP
0x00
0x10
OUT_RUNSTATE_RUNNING
OUT_RUNSTATE_RAMPDOWN
0x20
0x40
Disable all power to motors.
Enable ramping up from a current Power to a new (higher)
Power over a specified TachoLimit goal.
Enable power to motors at the specified Power level.
Enable ramping down from a current Power to a new (lower)
Power over a specified TachoLimit goal.
Table 17. RunState Constants
Valid RegMode values are described in the following table.
RegMode Constants
Value
Meaning
OUT_REGMODE_IDLE
OUT_REGMODE_SPEED
OUT_REGMODE_SYNC
0x00
0x01
0x02
No regulation
Regulate a motor's speed (Power)
Synchronize the rotation of two motors
Table 18. RegMode Constants
3.3.1 Convenience Calls
Since control of outputs is such a common feature of programs, a number of convenience
functions are provided that make it easy to work with the outputs. It should be noted that
most of these commands do not provide any new functionality above lower level calls
described in the following section. They are merely convenient ways to make programs
more concise.
The Ex versions of the motor functions use special reset constants. They are defined in
the following table. The Var versions of the motor functions require that the outputs
argument be a variable while the non-Var versions require that the outputs argument be a
constant.
Reset Constants
Value
RESET_NONE
RESET_COUNT
RESET_BLOCK_COUNT
RESET_ROTATION_COUNT
RESET_BLOCKANDTACHO
RESET_ALL
0x00
0x08
0x20
0x40
0x28
0x68
Page 53