flex_set_status_momo

NI-Motion Functions

flex_set_status_momo

Device Compatibility

Device Compatibility
7330
N
7340
Y
7344
Y
7350
Y
7390
N
NI SoftMotion Controller for CANopen—Xenus
N
NI SoftMotion Controller for CANopen—Accelnet
N

Set User Status MOMO

Usage

status = flex_set_status_momo(u8 boardID, u8 mustOn, u8 mustOff);

Purpose

Controls the user status bits in the Move Complete Status (MCS) register.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
mustOn u8 bitmap of user status bits to force True
mustOff u8 bitmap of user status bits to force False

Parameter Discussion

mustOn is the bitmap of user status bits to force True:

D7 D6 D5 D4 D3 D2 D1 D0
mustOn Sts15 mustOn Sts14 mustOn Sts13 0 0 0 0 0

D5 through D7:
   1 = User status bit forced True
   0 = User status bit unchanged (default)

mustOff is the bitmap of user status bits to force False:

D7 D6 D5 D4 D3 D2 D1 D0
mustOff Sts15 mustOff Sts14 mustOff Sts13 0 0 0 0 0

D5 through D7:
   1 = User status bit forced False
   0 = User status bit unchanged (default)

Using This Function

This function controls the upper three bits in the Move Complete Status (MCS) register using the MustOn/MustOff protocol. You can use this function in programs to report special conditions back to the host computer by setting and resetting one or more of these bits. Refer to the Read Move Complete Status function for more information about using the MCS register for high-speed polling.

Using the MustOn/MustOff protocol allows you to set or reset individual user status bits without affecting the other user status bits. This gives you tri-state control over each bit: True, False, or Unchanged. A one (1) in a bit location of the MustOn bitmap sets the user status bit high, while a one (1) in the corresponding location of the MustOff bitmap resets the user status bit low. A zero (0) in either bitmap has no affect, so leaving both the MustOn and MustOff bits at zero is effectively a hold, and the state of the user status bit is unchanged. If you set both the MustOn and MustOff bits to one (1), it is interpreted as a MustOn condition and the user status bit is set high.

Example

After a conditional jump in a program, you want the program to flag the host with a success code. This can be accomplished by storing the Set User Status MOMO with mustOn = 0xA0 and mustOff = 0x40. This forces user status bits 13 and 15 True and user status bit 14 low.

A subsequent poll of the MCS register returns moveCompleteStatus = 0xC07E, which corresponds to the following bitmap:

D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
Sts 15 Sts 14 Sts 13 XXX XXX XXX XXX MC 8 MC 7 MC 6 MC 5 MC 4 MC 3 MC 2 MC 1 XXX
1 0 1 0 0 0 0 0 0 1 1 1 1 1 1 0