flex_read_csr_rtn

NI-Motion Functions

flex_read_csr_rtn

Device Compatibility

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

Read Communication Status

Usage

status = flex_read_csr_rtn(u8 boardID, u16* csr);

Purpose

Reads the Communication Status Register (CSR).

Tip  Refer to the Remarks section for information about how the behavior of this function differs between controllers.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
csr u16* bitmap of communications status

Parameter Discussion

csr is the bitmap of communication status from the Communication Status Register.

For D0 Ready to Receive (RTR):
   1 = Ready to receive a word from the host
   0 = Not ready to receive (busy)

For D1 Ready to Send (RTS):
   1 = Ready to send a word from the RDB to the host
   0 = Not ready to send (RDB empty)

For D3 Command In Process (PIP):
   1 = Waiting for more data from host to complete the command
   0 = Idle

For D4 Packet Error (Pkt Err):
   1 = Communication packet error
   0 = No error

For D5 Power-Up Reset (PU Reset):
   1 = Controller is in the Power-Up state
   0 = Power-Up state has been cleared

For D6 Error Message (Err Msg):
   1 = Modal error message pending
   0 = No error

For D7 Hardware Failure (HW Fail):
   1 = Fatal hardware error occurred
   0 = No error

Using This Function

On power up, the controller is in a power-up reset state. Refer to Clear Power Up Status for information about clearing the reset condition.

Note  Refer to Function Execution Times for benchmark timing information about your controller.

Remarks

This section includes information about how the behavior of this function differs among the controllers that support it.

NI 73xx Controller Considerations

The following list includes considerations you must make when you are using this function with a 73xx motion controller:

  • This function performs a direct read of the Communication Status Register (CSR) on the 73xx motion controllers. The CSR is a hardware register containing communication handshaking and error status bits. The NI-Motion software polls this register continuously when sending and receiving packets for handshaking and error checking purposes. Refer to the motion controller documentation for more information about low-level communication protocols and return data packets.
  • You also can call this function at any time to check the communication and error status. Because the CSR is always up to date and directly accessible over the computer bus, executing this function does not affect the operation of the NI motion controller.

NI SoftMotion Controller Considerations

The following list includes considerations you must make when you are using this function with the NI SoftMotion Controller:

  • If you are using the NI SoftMotion Controller, this function reads the NI SoftMotion Controller engine service status.
    • D0 Ready to Receive (RTR) indicates if the NI SoftMotion Controller is running.
    • D4 Shutdown indicates if the NI SoftMotion Controller is in a shutdown state.
  • The NI SoftMotion Controller does not support the following CSR bits:
    • D1 Ready to Send (RTS)
    • D3 Command In Process (PIP)
    • D7 Hardware Failure (HW Fail)