ncConnectTerminals

NI-CAN

ncConnectTerminals

Purpose

Connect terminals in the CAN or LIN hardware.

Format

NCTYPE_STATUS ncConnectTerminals(
NCTYPE_OBJH ObjHandle,
NCTYPE_UINT32 SourceTerminal,
NCTYPE_UINT32 DestinationTerminal,
NCTYPE_UINT32 Modifiers);

Inputs

ObjHandle

The object handle from the previous NI-CAN function. The ObjHandle is originally returned from ncOpenObject.

SourceTerminal

Specifies the connection source.

Once the connection is successfully created, behavior flows from SourceTerminal to DestinationTerminal.

For a list of valid source/destination pairs, refer to the Valid Combinations of Source/Destination section of this function reference.

The following list describes each value of SourceTerminal:

NC_SRC_TERM_RTSI0... NC_SRC_TERM_RTSI6

Selects a general-purpose RTSI line as source (input) of the connection.

NC_SRC_TERM_RTSI_CLOCK

Selects the RTSI clock line as source (input) of the connection. This terminal is also RTSI line 7. RTSI7 is dedicated for routing of a timebase (10 MHz or 20 MHz)

The only valid DestinationTerminal for this source is NC_DEST_TERM_MASTER_TIMEBASE.

For PCI and PXI form factors, this receives a 20 MHz (default) timebase from another CAN or DAQ card. For example, you can synchronize a CAN and DAQ E Series MIO card by connecting the 20 MHz oscillator (board clock) of the DAQ card to NC_SRC_TERM_RTSI_CLOCK, and then connecting NC_SRC_TERM_RTSI_CLOCK to NC_DEST_TERM_MASTER_TIMEBASE on the CAN card.

For PCMCIA form factor, a 10 MHz timebase is required on NC_SRC_TERM_RTSI_CLOCK. For synchronization with a PCMCIA DAQ card, this is done by programming the FREQOUT signal of the DAQ card to 10 MHz, then wiring FREQOUT to the NC_SRC_TERM_RTSI_CLOCK of the CAN card.

For the 847x with Sync series CAN and LIN interfaces, 1 MHz, 10 MHz, and 20 MHz are valid timebases. Refer to USB-CAN and USB-LIN Specifications for details on synchronization triggers.

This value applies to Series 2 cards only (returns error for Series 1).

NC_SRC_TERM_PXI_STAR

NC_SRC_TERM_PXI_STAR selects the PXI star trigger signal.

Within a PXI chassis, some PXI products can source star trigger from Slot 2 to all higher-numbered slots.

PXI_Star enables the PXI CAN card to receive the star trigger when it is in Slot 3 or higher.

This value applies to Series 2 PXI CAN cards only. If you are using a Series 1 CAN card or Series 2 PCI or PCMCIA CAN card, selecting this value results in an error.

NC_SRC_TERM_PXI_CLK10

NC_SRC_TERM_PXI_CLK10 selects the 10 MHz backplane clock.

The only valid DestinationTerminal for this source is NC_DEST_TERM_MASTER_TIMEBASE. This routes the 10 MHz PXI backplane clock for use as the timebase for the CAN card. When you use PXI_Clk10 as the timebase for the CAN card, you must also use PXI_Clk10 as the timebase for other PXI cards to perform synchronized input/output.

This value applies to Series 2 PXI CAN cards only. If you are using a Series 1 CAN card or Series 2 PCI or PCMCIA CAN card, selecting this value results in an error.

NC_SRC_TERM_20MHZ_TIMEBASE

NC_SRC_TERM_20MHZ_TIMEBASE selects the 20 MHz oscillator of the CAN card.

The only valid DestinationTerminal for this source is NC_DEST_TERM_RTSI_CLOCK. This routes the 20 MHz clock of the CAN card for use as a timebase by other NI cards. For example, you can synchronize two CAN cards by connecting NC_SRC_TERM_20MHZ_TIMEBASE to NC_DEST_TERM_RTSI_CLOCK on one CAN card, and then connecting NC_SRC_TERM_RTSI_CLOCK to NC_DEST_TERM_MASTER_TIMEBASE on the other CAN card.

NC_SRC_TERM_20MHZ_TIMEBASE applies to the entire CAN card, including both interfaces of a 2-port CAN card. The CAN card is specified by the ObjName input to ncOpenObject.

This value applies to Series 2 PXI or PCI CAN cards only. If you are using a Series 1 CAN card or Series 2 PCMCIA CAN card, selecting this value results in an error.

NC_SRC_TERM_10HZ_RESYNC_CLOCK

NC_SRC_TERM_10HZ_RESYNC_CLOCK selects a 10 Hz, 50 percent duty cycle clock. This slow rate is required for resynchronization of Series 1 CAN cards. On each pulse of the resync clock, the other CAN card brings its clock into sync.

By selecting RTSI0-RTSI6 as the DestinationTerminal, you route the 10 Hz clock to synchronize with other Series 1 CAN cards. NI-DAQ or NI-DAQmx cards cannot use the 10 Hz resync clock, so this selection is limited to synchronization of two or more CAN cards.

NC_SRC_TERM_10HZ_RESYNC_CLOCK applies to the entire CAN card, including both interfaces of a 2-port CAN card. The CAN card is specified by the ObjName input to ncOpenObject.

This value applies to Series 1 and Series 2 CAN cards, but is typically used with Series 1 CAN cards only. If all of the CAN cards are Series 2, the 20 MHz timebase is preferable due to the lack of drift. If you are using a mix of Series 1 and Series 2 CAN cards, you must use NC_SRC_TERM_10HZ_RESYNC_CLOCK.

NC_SRC_TERM_INTF_RECEIVE_EVENT

NC_SRC_TERM_INTF_RECEIVE_EVENT selects the dedicated receive interrupt output on the Philips SJA1000 CAN controller. When a received frame successfully passes the acceptance filter, a pulse with the width of one bit time is output during the last bit of the end of frame position of the CAN frame. Incoming CAN frames can be filtered using the NC_ATTR_SERIES2_FILTER_MODE attribute. The CAN controller is specified by the ObjName input to ncOpenObject.

NC_SRC_TERM_INTF_RECEIVE_EVENT can be used as the start trigger for other NI cards, or for external instruments.

This value applies to Series 2 card only

NC_SRC_TERM_INTF_TRANSCEIVER_EVENT

NC_SRC_TERM_INTF_TRANSCEIVER_EVENT selects the NERR signal from the CAN transceiver. The Low-Speed/Fault-Tolerant transceiver and the High-Speed transceiver provide the NERR signal. This signal asserts when a fault is detected by the transceiver. The default value of NERR is logic-high, which indicates no error.

The CAN card is specified by the ObjName input to ncOpenObject.

This value applies to Series 2 CAN cards only. If you are using a Series 1 CAN card, selecting this value results in an error.

NC_SRC_TERM_START_TRIGGER

NC_SRC_TERM_START_TRIGGER selects the start trigger, the event that starts objects.

The start trigger is the same for all CAN Objects using a given interface, such as the ObjName input to ncOpenObject.

In the default (disconnected) state of the NC_DEST_TERM_START_TRIGGER destination, the start trigger occurs when communication begins on the interface.

By selecting RTSI0-RTSI6 as the DestinationTerminal, you route the start trigger of this CAN or LIN card to the start trigger of other CAN, LIN, or DAQ cards. This ensures that sampling begins at the same time on both cards. For example, you can synchronize two CAN cards by routing NC_SRC_TERM_START_TRIGGER as the SourceTerminal on one CAN card, and then routing NC_DEST_TERM_START_TRIGGER as the DestinationTerminal on the other CAN card, with both cards using the same RTSI line for the connections.

DestinationTerminal

Specifies the destination of the connection.

The following list describes each value of DestinationTerminal:

NC_DEST_TERM_RTSI0... NC_DEST_TERM_RTSI6

Selects a general-purpose RTSI line as destination (output) of the connection.

NC_DEST_TERM_RTSI_CLOCK

Selects the RTSI clock line as destination (output) of the connection. This terminal is also RTSI line 7. RTSI7 is dedicated for routing of a timebase. The CAN card can import a 10 MHz or 20 MHz timebase, but can only export a 20 MHz timebase. The only valid SourceTerminal for this source is NC_SRC_TERM_20MHZ_TIMEBASE.

This value applies to Series 2 CAN cards only. If you are using a Series 1 CAN card, selecting this value results in an error.

NC_DEST_TERM_MASTER_TIMEBASE

NC_DEST_TERM_MASTER_TIMEBASE instructs the CAN or LIN card to use the source of the connection as the master timebase. The CAN or LIN card uses this master timebase for input sampling (including timestamps of received messages) as well as periodic output sampling.

For PCI and PXI form factors, you can use NC_SRC_TERM_RTSI_CLOCK as the SourceTerminal. By default this receives a 20 MHz timebase from another CAN or DAQ card. For example, you can synchronize a CAN and DAQ E Series MIO card by connecting the 20 MHz oscillator (board clock) of the DAQ card to RTSI Clock (RTSI7), and then connecting NC_SRC_TERM_RTSI_CLOCK to NC_DEST_TERM_MASTER_TIMEBASE on the CAN card. To change the Master Timebase Rate to 10 MHz, use ncSetAttribute to change the NC_ATTR_MASTER_TIMEBASE_RATE attribute.

For PXI form factor, you also can use NC_SRC_TERM_PXI_CLK10 as the SourceTerminal. This receives the PXI 10 MHz backplane clock for use as the master timebase.

For PCMCIA form factor, you can use NC_SRC_TERM_RTSI_CLOCK as the SourceTerminal. Unlike PCI and PXI, the PCMCIA CAN card requires a 10 MHz timebase on NC_SRC_TERM_RTSI_CLOCK. For synchronization with a PCMCIA DAQ card, this is done by programming the FREQOUT signal of the DAQ card to 10 MHz, then wiring FREQOUT to the NC_SRC_TERM_RTSI_CLOCK of the CAN card.

NC_DEST_TERM_MASTER_TIMEBASE applies to the entire CAN or LIN card, including both interfaces of a 2-port CAN card. The CAN card is specified by the ObjName input to ncOpenObject.

The default (disconnected) state of this destination means the CAN or LIN card uses its local 20 MHz timebase as the master timebase.

This value applies to Series 2 CAN cards only. If you are using a Series 1 CAN card, selecting this value results in an error.

NC_DEST_TERM_10HZ_RESYNC_CLOCK

NC_DEST_TERM_10HZ_RESYNC_CLOCK instructs the CAN card to use a 10 Hz, 50 percent duty cycle clock to resynchronize its local timebase. This slow rate is required for resynchronization of CAN cards. On each low-to-high transition of the resync clock, this CAN card brings its local timebase into sync.

When synchronizing to an E Series MIO card, a typical use of this value is to use RTSI0-RTSI6 as the SourceTerminal, then use NI-DAQ or NI-DAQmx functions to program Counter 0 of the MIO card to generate a 10 Hz 50 percent duty cycle clock on the RTSI line.

When synchronizing to a CAN card, a typical use of this value is to use RTSI0-RTSI6 as the SourceTerminal, then route the NC_SRC_TERM_10HZ_RESYNC_CLOCK of the other CAN card as the SourceTerminal to the same RTSI line.

NC_DEST_TERM_10HZ_RESYNC_CLOCK applies to the entire CAN card, including both interfaces of a 2-port CAN card. The CAN card is specified by the ObjName input to ncOpenObject.

The default (disconnected) state of this destination means the CAN card does not resynchronize its local timebase.

This value applies to Series 1 and Series 2 CAN cards, but is typically used with Series 1 CAN cards only. If all of the CAN cards are Series 2, the 20 MHz timebase is preferable due to the lack of drift. If you are using a mix of Series 1 and Series 2 CAN cards, you must use NC_DEST_TERM_10HZ_RESYNC_CLOCK.

NC_DEST_TERM_START_TRIGGER

NC_DEST_TERM_START_TRIGGER selects the start trigger, the event that begins sampling for tasks. The start trigger occurs on the first low-to-high transition of the source terminal.

The start trigger is the same for all tasks using a given interface, such as the ObjName input to ncOpenObject.

By selecting RTSI0-RTSI6, or NC_SRC_TERM_PXI_STAR for PXI hardware, as the SourceTerminal, you route the start trigger from another CAN, LIN, or DAQ card. This ensures that sampling begins at the same time on both cards. For example, you can synchronize with an E Series DAQ MIO card by routing the AI start trigger of the MIO card to a RTSI line and then routing the same RTSI line with NC_DEST_TERM_START_TRIGGER as the DestinationTerminal on the CAN card.

The default (disconnected) state of this destination means the start trigger occurs when communication begins on the interface.

Modifiers

Provides optional connection information for certain source/destination pairs. The current release of NI-CAN does not use this information for any source/destination pair, so you must pass Modifiers as zero.

Outputs

Return Value

The return value indicates the status of the function call as a signed 32-bit integer. Zero means the function executed successfully. A negative value specifies an error, which means the function did not perform the expected behavior. A positive value specifies a warning, which means the function performed as expected, but a condition arose that may require attention.

Use the ncStatusToString function of the Frame API to obtain a descriptive string for the return value.

Description

This VI connects a specific pair of source/destination terminals. One of the terminals is typically a RTSI signal, and the other terminal is an internal terminal in the CAN or LIN hardware. By connecting internal terminals to RTSI, you can synchronize the CAN or LIN hardware with another hardware product such as an NI-DAQ or NI-DAQmx card.

When the final CAN object for a given port is cleared with ncCloseObject, NI-CAN disconnects all terminal connections for that port. Therefore, the ncDisconnectTerminals function is not required for most applications. NI-DAQ and NI-DAQmx terminals remain connected after the tasks are cleared, so you must disconnect NI-DAQ/NI-DAQmx terminals manually at the end of the application.

For a list of valid source/destination pairs, refer to the following section.

Valid Combinations of Source/Destination

The following table lists all valid combinations of SourceTerminal and DestinationTerminal.

The series of the NI CAN hardware determines what combinations of SourceTerminal to DestinationTerminal are valid. Within the table, 1 indicates Series 1 hardware, and 2 indicates Series 2 hardware. You can determine the series of the NI CAN hardware by selecting the name of the card within the Devices and Interfaces view in the left pane of MAX.

Series 1 hardware has the following limitations:

  • PXI cards do not support RTSI6.
  • Signals received from a RTSI source cannot occur faster than 1 kHz. This prevents the card from receiving a 10 MHz or 20 MHz timebase, such as provided by NI E Series MIO hardware.
  • Signals received from a RTSI source must be at least 100 µs in length to be detected. This prevents the card from receiving triggers in the nanoseconds range, such as the AI trigger provided by NI E Series MIO hardware. Series 2 CAN cards also send RTSI pulses in the nanoseconds range, so Series 1 CAN cards cannot receive RTSI input from Series 2 CAN cards.
  • For CAN cards with High-Speed (HS) ports only, four RTSI signals are available for input (source), and four RTSI signals are available for output (destination). This limitation applies to the number of signals per direction, not the RTSI signal number. For example, if you connect RTSI0, RTSI1, RTSI3, and RTSI5 as input, connecting RTSI4 as input will return an error.
  • For CAN cards with one or more Low-Speed (LS) ports, two RTSI signals are available for input (source), and three RTSI signals are available for output (destination).

Series 2 hardware has the following limitations:

  • For all form factors (PCI, PXI, PCMCIA), the connection of Interface Transceiver Event to a RTSI destination is dependent on the physical port location. If the interface is located on Port 1, you can connect to even-numbered RTSI lines only (RTSI0, RTSI2, RTSI4, RTSI6). If the interface is located on Port 2, you can connect to odd-numbered RTSI lines only (RTSI1, RTSI3, RTSI5). You can determine the location by selecting the name of the interface in MAX.
  • PCI cards do not support the PXI_Star and PXI_Clk10 terminals, as those signals exist on the PXI backplane.
  • PCMCIA cards do not support the 20 MHz Timebase, PXI_Star, and PXI_Clk10 terminals. Because 20 MHz Timebase is not supported, you cannot synchronize the timebases of two PCMCIA CAN cards.
  • On PCMCIA cards, RTSI4, RTSI5 and RTSI6 are not available.

Valid Combinations of Source/Destination

SourceDestination
RTSI0 to RTSI6RTSI_Clock Master Timebase10 Hz Resync Clock Start Trigger
RTSI0 to RTSI6 1,21,2,3
RTSI_Clock 2,3
PXI_Star 2
PXI_Clk10 2
20 MHz Timebase 2,3
10 Hz Resync Clock 1,2 1,2
Interface Receive Event22
Interface Transceiver Event2
Start Trigger Event 1,2,3

1—Valid connection for Series 1 hardware

2—Valid connection for Series 2 hardware

3—Valid connection for 847x with Sync series hardware

847x with Sync series hardware has the following limitations:

  • No support for RTSI1–RTSI6.
  • Because 20 MHz timebase only outputs a 1 MHz signal, you cannot source a timebase to a PCI-CAN device. It can, however, receive a 20 MHz signal from a PCI-CAN device.
  • RTSI0 must be connected to the TRIG terminal and RTSI7 must be connected to the CLK terminal. Refer to the USB-LIN section for more information on the pinout of the USB-847x with Sync series hardware.

The following table lists all valid combinations of SourceTerminal and DestinationTerminal.