ncSetAttr.vi
From NI-CAN
ncSetAttr.vi
Purpose
Set the value of an object attribute. The attributes provided in this VI allow for additional configuration beyond the attributes of ncConfig VIs.
Format

Input
| ObjHandle in is the object handle from the previous NI-CAN VI. The handle originates from the ncOpen VI. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
AttrId specifies the attribute to set. Baud Rate For NI CAN hardware you can specify the following basic baud rates as the numeric rate: 5000, 6150, 7813, 8000, 10000, 12500, 15625, 16000, 20000, 25000, 31250, 33333, 40000, 50000, 62500, 80000, 83333, 100000, 125000, 160000, 200000, 250000, 400000, 500000, 800000, and 1000000. You can specify advanced baud rates as 8000XXYY hex, where YY is the value of Bit Timing Register 0 (BTR0), and XX is the value of Bit Timing Register 1 (BTR1) of the SJA1000 CAN controller. For NI LIN hardware you can specify any baud rate from 2400 to 20000 baud. If the baud rate you select varies more than .5% from the calculated baud rate, you will receive a warning message. The calculation for the baud rate is as follows: Calculated Baud Rate = 1,500,000/x where x = (1,500,000/Input Baud Rate), rounded to the nearest integer. LIN Checksum Type Specifies the method the LIN interface should use when calculating checksums for published data, or verifying received checksums for subscribed-to data. The values for this attribute are:
Setting the LIN Checksum Type to Classic indicates that the LIN-specified checksum calculation algorithm should be applied only to the data bytes. Setting the LIN Checksum Type to Enhanced indicates that the checksum calculation algorithm should be applied to the ID and data bytes. LIN Enable DLC Check Specifies the manner in which the LIN interface detects end-of-response when writing a header IsRemote type. This attribute does not affect the LIN interface processing of the full and response IsRemote types. The values for this attribute are:
When the LIN interface transmits a header, it expects an external slave to publish data in response. When writing headers, the LIN interface detects end-of-response using either the LIN-specified response timeout for a response containing the maximum number (8) of data bytes (LIN Enable DLC Check=FALSE), or reception of a response containing DLC number of data bytes (LIN Enable DLC Check=TRUE). If LIN Enable DLC Check=FALSE, then the minimum time separation between the transmission of headers will be header time + time to subscribe to eight data bytes (DLC is ignored) and checksum + LIN interface inter-frame delay. If LIN Enable DLC Check=TRUE, then the minimum time separation between the transmission of headers will be header time + time to subscribe to DLC number of data bytes and checksum + LIN interface inter-frame delay. If you want to transmit header frames, each separated by a unique schedule table amount of delay with maximum timing accuracy, set LIN Enable DLC Check to TRUE. Note that if LIN Enable DLC Check=TRUE, the LIN interface will verify that a DLC in the range of one to eight is in the header IsRemote type written by the host. If LIN Enable DLC Check=FALSE, the LIN interface will ignore the DLC in the header IsRemote type written by the host. LIN Log Wakeup Specifies whether the LIN interface should report wakeup events as frames (TRUE) or not (FALSE). Wakeup events are always reported as states. The values for this attribute are:
LIN Response Timeout Specifies an amount of response timeout, in 50 µs increments, to add to the LIN-specified response timeout the LIN interface uses to detect certain bus errors and end-of-response. The values for this attribute are:
LIN Sleep Sets the sleep state of the LIN interface. The values for this attribute are:
The LIN interface powers up in the awake state (LIN Sleep=FALSE). When the LIN Sleep attribute is set to FALSE, the user may set it to TRUE at any time: upon reception of a sleep frame (four second period of bus inactivity has passed), upon reception of a full frame containing go-to-sleep command data, or when it is desired to simply put the interface to sleep. When the LIN Sleep attribute is set to TRUE, either the user or the state machines within the LIN interface may set the attribute to FALSE, depending upon whether the interface is acting as master or slave, and whether or not it is issuing or receiving the wakeup request. Listen Only? Specifies whether to use the listen only feature of the Philips SJA1000 CAN controller (Series 2 only). Communication must be stopped to set this attribute. Use Start On Open False with ncConfigCANNet, set the attribute, then use ncAction to start communication.
0 (FALSE) When set to FALSE, listen only mode is disabled (default). Received frames are ACKnowledged, and frames can be transmitted using ncWriteNet and ncWriteObj. 1 (TRUE) When set to TRUE, listen only mode is enabled.
The Network Interface and CAN Objects can only receive frames. The interface does not transmit on the network: no ACKnowledgements are transmitted for received frames, and ncWriteNet and ncWriteObj will return an error. The Philips SJA1000 CAN controller enters error passive state when listen only is enabled. The listen only mode is not available on the Intel 82527 CAN controller used by Series 1 CAN hardware (returns error). This attribute is available only for the Network Interface, not CAN Objects. Log Bus Errors? Specifies whether to log bus errors when the interface detects a bus error. For CAN interfaces, the bus error frame is logged when a bus error is detected. The Log Bus Error? attribute is not supported by Series 1 CAN interfaces. This attribute has to be set prior to starting the Network Interface. The values for this attribute are:
The CAN bus error frame has the following format:
For LIN interfaces, the bus error frame is logged into the read queue when a timeout or bus errors such as Bit Framing or Checksum occurs. This attribute must be set prior to starting the Network Interface. The LIN bus error frame has the following format:
Data bytes zero and one (Error code) indicate the type of LIN bus error. Refer to the following table for a list of LIN bus error codes and descriptions. Data bytes two and three are reserved for internal use. For errors in which a received byte did not match the expected value, data byte four indicates the received value and data byte 5 indicates the expected value. For a bus error occurring at a point in the LIN frame after which the break, sync, and ID fields have been processed, data byte six indicates the LIN ID.
Log Comm Warnings Specifies whether to log communication warnings (including transceiver faults) to the Network Interface read queue. The values for this attribute are: 0 (FALSE) When set to FALSE, the Network Interface reports CAN communication warnings (including transceiver faults) in Error out of the read VIs. For more information, refer to ncReadNetMult. 1 (TRUE) When set to TRUE, the Network Interface reports CAN communication warnings (including transceiver faults) by storing a special frame in the read queue. The communication warnings are not reported in Error out. For more information on communication warnings and errors, refer to ncReadNetMult. The special communication warning frame uses the following format:
When calling ncReadNet or ncReadNetMult to read frames from the Network Interface, you typically use the IsRemote field to differentiate communications warnings from CAN frames. Refer to ncReadNetMult for more information. This attribute applies only to Series 1 and Series 2 hardware. This attribute is available only from the Network Interface, not CAN Objects. Log Start Trigger? Set this attribute to true if you wish to log the start trigger into the read queue of the CAN or LIN Network Interface Object. The values for this attribute are: 0 (FALSE) Disables the logging of the start trigger (default) in the read queue of the Network Interface Object. 1 (TRUE) Enables the logging of the start trigger in the read queue of the Network Interface Object. The start trigger is logged when the CAN chip starts communication. This attribute should be set prior to starting the Network Interface Object. This attribute is applicable only to the Network Interface Object and setting this attribute on CAN Objects will result in an NI-CAN error.
Log Transceiver Faults? Specifies whether to enable the logging of transceiver faults as frames in the read queue of the Network Interface Object. The values for this attribute are:
This attribute is supported only on High Speed and Low Speed CAN transceivers. This attribute can be set before or after starting the CAN Network Interface Object. The frame will be logged each time the transceiver's NERR signal changes state. In order to filter out noise on this signal, the logging can occur up to 10ms apart. The transceiver fault frame as the following format:
Master Timebase Rate Sets the rate (in MHz) of the external clock that is exported to the CAN card. The values for this attribute are: 20 (20 MHz) When synchronizing 2 CAN cards or synchronizing a CAN card with an E-Series DAQ card, the 20 MHz Master Timebase Rate is to be used. By default, this attribute is set to 20 MHz. 10 (10 MHz) The Master Timebase Rate should be set to 10 MHz when synchronizing a CAN card with an M-Series DAQ card. The M-Series DAQ card can export a 20 MHz clock but it does this by using one of its two counters. If your CAN-DAQ application does not use the 2 DAQ counters then, you can leave the timebase rate set to 20 MHz (default). This attribute can be set either before or after calling ncConnectTerminals.vi to connect the RTSI_CLK to Master Timebase. However, this attribute must always be called prior to starting the Network Interface Object. This attribute is applicable only to PCI and PXI Series 2 cards. For PCMCIA cards, setting this attribute will return an error. On PXI cards, if PXI_CLK10 is routed to the Master Timebase, then the rate is fixed at 10 MHz (it over rides any previous setting of this attribute). Setting this attribute for Series 1 cards will also result in a NI-CAN error. For the 847x and 847x with Sync series CAN and LIN interfaces, setting this attribute has no effect. The 847x and 847x with Sync series CAN and LIN interfaces automatically synchronize to a Master Timebase Rate of 1, 10, or 20 MHz. Refer to USB-CAN and USB-LIN Specifications for details on synchronization triggers. ReadMult Size for Notification Sets the number of frames used as a threshold for the Read Multiple state. For more information on the Read Multiple state, refer to ncWaitForState.vi. The default value is one half of Read Queue Length. This attribute applies only to Series 1 and Series 2 hardware.
Self Reception? For CAN, this specifies whether to echo successfully transmitted CAN frames into the read queue of the CAN Network Interface and/or CAN Objects (Series 2 only). Each reception occurs just as if the frame were received from another CAN device. For self reception to operate properly, another CAN device must receive and acknowledge each transmit. If a transmitted frame is not successfully acknowledged, it is not echoed into the read queue. Communication must be stopped to set this attribute. Use Start On Open False with ncConfigCANNet.vi, set the attribute, then use ncAction.vi to start communication. 0 (FALSE) Disables Self Reception mode (default). Transmitted frames do not appear in read queues. 1 (TRUE) Enables Self Reception mode. Transmitted frames appear in read queues as if they were received from another CAN device. The Self Reception mode is not available on the Intel 82527 CAN controller used by Series 1 CAN hardware. For Series 1 interfaces, this attribute must be left at its default (zero). For LIN, this specifies whether or not to load frames for which the LIN interface slave task is the publisher of the response into the read queue. 0 (FALSE) Disables Self Reception mode (default). Frames for which the LIN interface slave task is the publisher of the response do not appear in read queues. 1 (TRUE) Enables Self Reception mode. Frames for which the LIN interface slave task is the publisher of the response appear in read queues as if they were the result of an external slave task publishing the response. This attribute is available only for the Network Interface Objects, not CAN Objects. Specifies the filter comparator for the Philips SJA1000 CAN controller. This attribute is not supported for Series 1 CAN, 847x LIN, or 847x with Sync LIN interfaces (returns error). This attribute specifies a comparator value that is checked against the ID, RTR, and data bits. The Series 2 Mask determines the applicable bits for comparison. The default value of this attribute is zero. The mapping of bits in this attribute to the ID, RTR, and data bits of incoming frames is determined by the value of the Series 2 Filter Mode attribute. Refer to Series 2 Filter Mode to understand the format of this attribute as well as the Series 2 Mask. Communication must be stopped to set this attribute. Use Start On Open False with ncConfigCANNet.vi, set the desired attributes, then use ncAction.vi to start communication. Specifies the filter mask for the Philips SJA1000 CAN controller. This attribute is not supported for Series 1 CAN, 847x LIN, or 847x with Sync LIN interfaces (returns error). This attribute specifies a bit mask that determines the ID, RTR, and data bits that are compared. If a bit is clear in the mask, the corresponding bit in the Series 2 Comparator is checked. If a bit in the mask is set, that bit is ignored for the purpose of filtering (don't care). This interpretation is the opposite of the legacy Standard/Extended Mask attributes. The default value of this attribute is hex FFFFFFFF, which means that all frames are received. The mapping of bits in this attribute to the ID, RTR, and data bits of incoming frames is determined by the value of the Series 2 Filter Mode attribute. Refer to Series 2 Filter Mode to understand the format of this attribute as well as the Series 2 Comparator. Communication must be stopped to set this attribute. Use Start On Open False with ncConfigCANNet.vi, set the desired attributes, then use ncAction.vi to start communication. The Philips SJA1000 CAN controller provides sophisticated filtering of received frames. This attribute specifies the filtering mode, which is used in conjunction with the Series 2 Mask and Series 2 Comparator attributes. This attribute is not supported for Series 1 CAN, 847x LIN, or 847x with Sync LIN interfaces (returns error). For Series 1 interfaces, the Standard Mask/Comparator and Extended Mask/Comparator attributes are programmed directly into the Intel 82527 CAN controller. Use those attributes to specify filtering of received frames on Series 1 interfaces. The Philips SJA1000 does not support distinct standard and extended masking. Therefore, on Series 2 interfaces the Standard Mask/Comparator and Extended Mask/Comparator attributes are implemented in software (for backward compatibility). Since software masking can have an adverse impact on receive performance, National Instruments recommends that you disable software masking for Series 2 interfaces. Disable software masking by specifying don't-care (0) for all four mask/comparator attributes of ncConfigCANNet.vi. Communication must be stopped to set this attribute. Use Start On Open False with ncConfigCANNet.vi, set the desired attributes, then use ncAction.vi to start communication. Since the format of the filters is very specific to the Philips SJA1000 CAN controller, National Instruments cannot guarantee compatibility for this attribute on future hardware series. When using this attribute in the application, it is best to get the Series attribute to verify that the CAN hardware is Series 2, 847x, or 847x with Sync. The filtering specified by this attribute and the Series 2 Mask/Comparator applies to the CAN Network Interface Object and all CAN Objects for that interface. For example, if you specify filters that discard ID 5, then open a CAN Object to receive ID 5, the CAN Object will not receive data. The default value for this attribute is Single Standard. This attribute uses the following values: 0 (Single Standard) Filter all standard (11-bit) frames using a single mask/comparator filter. The following figure describes the format of the Series 2 Mask and Series 2 Comparator attributes for this filter mode.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| AttrValue provides the attribute value for AttrId. | |||||||
Error in describes error conditions occurring before the VI executes. If an error has already occurred, the VI returns the value of the Error in cluster in Error out.
|
Output
| ObjHandle out is the object handle for the next NI-CAN VI. | |||||||
Error out describes error conditions. If the Error in cluster indicated an error, the Error out cluster contains the same information. Otherwise, Error out describes the error status of this VI.
|
Description
ncSetAttr.vi sets the value of the attribute specified by AttrId in the object specified by ObjHandle in.





