MC-Basic Constants

From SoftMC-Wiki
Jump to: navigation, search

Constants are numbers, which are written as ordinary text characters; for example, 161. Constants can be written in decimal or in hexadecimal (HEX). To write a constant in hex, precede it by a 0x; for example, 0xF is the hex representation of 15 decimal.

The softMC provides numerous literal constants (reserved words with a fixed value). You can use these constants anywhere in your program to make your code more intuitive and easier to read. For example:

A1.Motion = ON

turns on the A1 property Motion. This is more intuitive to read than:

A1.Motion = 1

although the effect is identical.


A number of keywords have been defined in the system to facilitate operation. These keywords, or constants, may be used in place of explicit numeric values in instances where a parameter has a discrete range of allowed values.

The following is a list of constants.

Reserved Name Value Usage Example
ON 1 MOTION property (axis and system) ENABLE property (System, axis and group) A1.Motion = ON A1.Enable = ON
OFF 0 MOTION property (axis and system) ENABLE property (System, axis and group) SLAVE axis property A1.Motion=OFF A1.Enable=OFF A1.Slave = OFF
MaxDouble 1.797693134862311 e+308 Returns the maximum double precision value
Maxlong 2147483647 Returns the maximum integer value
MinLong -2147483648 Returns the minimum integer value
Immediate/Immed 1 StartType property value (axis and group) StopType property value (axis and group) A1.StartType = Immediate A1.StopType = Immed
SuperImmediate/Simm 5 StartType property value (axis and group) A1.StartType = Simm
Abort 4 StartType property value (axis and group) A1.StartType = Abort
Settled 2 StartType property value (axis and group) A1.StartType = Settled
InPosition/Inpos 2 StartType property value (axis and group) A1.StartType = InPos
GeneratorCompleted/Gcom 3 StartType property value (axis and group) G1.StartType = Gcom
Sync 4 StartType property value (axis and group) A1.StartType = Sync
OnPath 2 StopType property type (axis and group) A1.StopType = OnPath
EndMotion/Emot 3 StopType property type (axis and group) A1.StopType = EndMotion
Continue/Cont 1 ProceedType property (axis and group) A1.ProceedType = Cont
NextMotion/Nmot 2 ProceedType property (axis and group) A1.ProceedType = NextMotion
ClearMotion/Cmot 3 ProceedType property (axis and group) A1.ProceedType = ClearMotion
True 1 Absolute property (axis and group) Simulated property (axis) A1.Absolute = True
False 0 Absolute property (axis and group) Simulated property (axis) A1.Absolute = False
PI 3.14159265359 In expressions; to convert from Radians to degrees Deg = Rad *180 / PI
Gear 1 Slave property (axis only) A1.Slave = Gear
Cam 2 Slave property (axis only) A1.Slave = Cam
External 1 Feedback type a1.Feedback = External
Rise 1 Capture Polarity a1.CapturePolarity = Rise
Fall 2 Capture Polarity a1.CapturePolarity = Fall
Halt 0 Drive Halt/Restart control. a1.HaltRestart = Halt
Restart 1 Drive Halt/Restart control. a1.HaltRestart = Restart
In1 1
In2 2
In3 3
Homing 10 Assigning home switch In1mode = homing
Capturing 16 Assigning capture switch In2mode = capturing
Positive 1 Axis direction A1.Direction = Positive
Negative -1 Axis direction A1.Direction = Negative
Task_Running 1 Task state Returned by <task>.State query.
Task_Stopped 2 Task state Returned by <task>.State query.
Task_Error 4 Task state Returned by <task>.State query.
Task_Ready 7 Task state Returned by <task>.State query.
Task_KillStart 9 Task state Returned by <task>.State query. Intermidiate state, start of task kill sequence.
Task_Killed 10 Task state Returned by <task>.State query.
Task_Interrupted 512 Task state qualifier Returned by <task>.State query.
Task_Locked 256 Task state qualifier Returned by <task>.State query.
LEFTY 1 Arm flag : positive jont-2 moves the wrist in positive WORLD Z direction while joint-3 is not activated
RIGHTY 2 Arm flag  : positive jont-2 moves the wrist in negative WORLD Z direction while joint-3 is not activated
BELOW 1 Elbow flag  :Position of the wrist of the LEFTY/ RIGHTYarm with respect to the shoulder coord. system has Negative/Positive coordinate value along the Y axis of the second segment
ABOVE 2 Elbow flag  :Position of the wrist of the LEFTY/ RIGHTYarm with respect to the shoulder coord. system has Negative/Positive coordinate value along the Y axis of the second segment
FLIP 2 Wrist flag : value of joint 5 is negative
NOFLIP 1 Wrist flag  : value of joint 5 is positive