nctConnectTerminals

NI-CAN

nctConnectTerminals

Purpose

Connects terminals in the CAN hardware.

Format

nctTypeStatus nctConnectTerminals(
nctTypeTaskRef TaskRef,
u32 SourceTerminal,
u32 DestinationTerminal,
u32 Modifiers);

Inputs

TaskRef

Task reference from the previous NI-CAN function. The task reference is originally returned from nctInitStart, nctInitialize, or nctCreateMessage.

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.

The following list describes each value of SourceTerminal:

nctSrcTermRTSI0... nctSrcTermRTSI6

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

nctSrcTermRTSI_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 nctDestTermMasterTimebase.

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 nctSrcTermRTSI_Clock, and then connecting nctSrcTermRTSI_Clock to nctDestTermMasterTimebase on the CAN card.

For PCMCIA form factor, a 10 MHz timebase is required on nctSrcTermRTSI_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 nctSrcTermRTSI_Clock of the CAN card.

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

nctSrcTermPXI_Star

nctSrcTermPXI_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.

nctSrcTermPXI_Clk10

nctSrcTermPXI_Clk10 selects the PXI 10 MHz backplane clock.

The only valid DestinationTerminal for this source is nctDestTermMasterTimebase. 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.

nctSrcTerm20MHzTimebase

nctSrcTerm20MHzTimebase selects the 20 MHz oscillator of the CAN card.

The only valid DestinationTerminal for this source is nctDestTermRTSI_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 nctSrcTerm20MHzTimebase to nctDestTermRTSI_CLOCK on one CAN card, and then connecting nctSrcTermRTSI_CLOCK to nctDestTermMasterTimebase on the other CAN card.

nctSrcTerm20MHzTimebase applies to the entire CAN card, including both interfaces of a 2-port CAN card. The CAN card is specified by the task interface, such as the Interface input to nctInitialize.

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.

nctSrcTerm10HzResyncClock

nctSrcTerm10HzResyncClock selects a 10 Hz, 50 percent duty cycle clock. This slow rate is required for resynchronization of 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 CAN cards. NI DAQ cards cannot use the 10 Hz resync clock, so this selection is limited to synchronization of two or more CAN cards.

nctSrcTerm10HzResyncClock applies to the entire CAN card, including both interfaces of a 2-port CAN card. The CAN card is specified by the task interface, such as the Interface input to nctInitialize.

This value 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 nctSrcTerm10HzResyncClock.

nctSrcTermIntfReceiveEvent

nctSrcTermIntfReceiveEvent 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 nctPropIntfSeries2FilterMode property. The CAN controller is specified by the task interface, such as the Interface input to nctInitialize.

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

Since this value requires the Philips SJA1000 CAN controller, it applies to Series 2 CAN cards only. If you are using a Series 1 CAN card, selecting this value results in an error.

nctSrcTermIntfTransceiverEvent

nctSrcTermIntfTransceiverEvent 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 controller is specified by the task interface, such as the Interface input to nctInitialize.

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.

nctSrcTermStartTrigger

nctSrcTermStartTrigger selects the start trigger, the event that begins sampling for tasks.

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

In the default (disconnected) state of the nctDestTermStartTrigger 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 card to the start trigger of other CAN 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 nctSrcTermStartTrigger as the SourceTerminal on one CAN card, and then routing nctDestTermStartTrigger 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:

nctDestTermRTSI0... nctDestTermRTSI6

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

nctDestTermRTSI_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 nctSrcTerm20MHzTimebase.

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.

nctDestTermMasterTimebase

nctDestTermMasterTimebase instructs the CAN card to use the source of the connection as the master timebase. The CAN 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 nctSrcTermRTSI_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 nctSrcTermRTSI_Clock to nctDestTermMasterTimebase on the CAN card. To change the Master Timebase Rate to 10 MHz, use nctSetProperty to change the nctPropHwMasterTimebaseRate.

For PXI form factor, you also can use nctSrcTermPXI_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 nctSrcTermRTSI_Clock as the SourceTerminal. Unlike PCI and PXI, the PCMCIA CAN card requires a 10 MHz timebase on nctSrcTermRTSI_Clock (TRIG7_CLK). 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 nctSrcTermRTSI_Clock of the CAN card.

nctDestTermMasterTimebase applies to the entire CAN card, including both interfaces of a 2-port CAN card. The CAN card is specified by the task interface, such as the Interface input to nctInitialize.

The default (disconnected) state of this destination means the CAN 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.

nctDestTerm10HzResyncClock

nctDestTerm10HzResyncClock 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 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 nctSrcTerm10HzResyncClock of the other CAN card as the SourceTerminal to the same RTSI line.

nctDestTerm10HzResyncClock applies to the entire CAN card, including both interfaces of a 2-port CAN card. The CAN card is specified by the task interface, such as the Interface input to nctInitialize.

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

This value 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 nctSrcTerm10HzResyncClock.

nctDestTermStartTrigger

nctDestTermStartTrigger 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 Interface input to nctInitialize.

By selecting RTSI0-RTSI6, or nctSrcTermPXI_Star for PXI hardware, as the SourceTerminal, you route the start trigger from another CAN 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 nctDestTermStartTrigger 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. Because communication begins when the first task of the interface is started, this does not synchronize sampling with other NI cards.

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. The ncStatusToString and ncGetHardwareInfo functions are the only Frame API functions that can be called within a Channel API application.

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 hardware. By connecting internal terminals to RTSI, you can synchronize the CAN card with another hardware product such as an NI-DAQ or NI-DAQmx card.

The most common uses of RTSI synchronization are demonstrated by the CAN/DAQ programming examples.

When the final task for a given interface is cleared with nctClear, NI-CAN disconnects all terminal connections for that interface. Therefore, the nctDisconnectTerminals 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 RTSI 6.
  • 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
RTSI_Clock 2
PXI_Star 2
PXI_Clk10 2
20 MHz Timebase 2
10 Hz Resync Clock 1,2 1,2
Interface Receive Event22
Interface Transceiver Event2
Start Trigger 1,2

1—Valid connection for Series 1 hardware

2—Valid connection for Series 2 hardware