User Manual
MCP Series
Brushed DC Motor Controllers
MCP Series User Manual
114
PRIORITYLEVEL
Variable holds the control priority level that is currently active. Levels 0,1 or 2.
main
if PRIORIYLEVEL=0 then
puts 0,[“Prioritylevel 1”,13]
elseif PRIORITYLEVEL=1
puts 0,[“Prioritylevel 2”,13]
elseif PRIORITYLEVEL=2
puts 0,[“Prioritylevel 3”,13]
goto main
PRIORITYACTIVE
Variable holds the trigger mask for priority levels. The mask indicates which control types can
become active. For exampel if Priority Level 1 is set to Serial and Oriority Level 2 is active,
PRIORITYACTIVE will equal 0x01. Indicating any activity on a Serial stream will change the
priority level back to level 1.
Priority Levels
SERIAL 0x01
PULSE 0x02
ANALOG 0x04
MOTORFLAGS (2)
Variable array holds the control state ags for both motor channels. These can be useful when
debugging hardware problems or triggering some specic script function based on motor status.
Flags
stop triggered 0x0001
reverse triggered 0x0002
forward stop triggered 0x0004
backward stop triggered 0x0008
loadhome triggered 0x0010
estop triggered 0x0020
motor is active 0x0040
velocity pid is enabled 0x0080
position pid is enabled 0x0100
motor command buffere is empty 0x0200
distance command is active 0x0400
main
if MOTORFLAGS(0)&0x0040 then
puts 0,[“Motor1 is active.”,13]
endif
if MOTORFLAGS(1)&0x0040 then
puts 0,[“Motor2 is active.”,13]
endif
pause 100
goto main