mcECUSelectEx
- Updated2023-02-21
- 3 minute(s) read
mcECUSelectEx
Purpose
Selects an ECU from the names stored in an A2L database.
Format
mcTypeStatus | mcECUSelectEx(
|
Input
DBRefNum
DBRefNum is the task reference from the initial database task function. The database task reference is originally returned from mcDatabaseOpen.
ECUName
ECUName is the selected ECU name out of an A2L Database file with which to initialize all subsequent tasks.
Interface
Specifies the protocol and optional interface to use for this task.
The interface input uses an enumeration in which value 0 selects CAN0, value 1 selects CAN1, and so on. As the ECU M&C API is based on the NI-CAN Channel API, the NI-CAN Frame API cannot be used on the same CAN network interface simultaneously. If the CAN network interface is already initialized in the Frame API, this function returns an error.
Output
ECURefNum
ECURefNum is the task reference which links to the selected ECU.
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 mcStatusToString function of the ECU M&C API to obtain a descriptive string for the return value.
Description
mcECUSelectEx creates an ECU reference handle to the selected ECU name. The mcECUSelectEx function does not start communication. This enables you to use mcSetProperty to change the properties of an ECU task. After you change properties, use mcECUConnect to start communication for the task and logically connect to the selected ECU.
Interface selects the communication protocol and the desired interface to use for this task. The protocol and interface input are required, as these parameters are not defined in the A2L database. The default baud rate for CCP or XCP on CAN, or the IP address for XCP on UDP/TCP, may be defined in the A2L database, but you can change it by setting the Interface Baud Rate or IP Address property with MC Set Property.vi.
This parameter is expected to be a string with the format Protocol:CommInterface.
Protocol supports:
- CCP to use the CAN Calibration Protocol
- XCP to use the XCP Universal Measurement and Calibration Protocol
CommInterface selects the transport layer and hardware interface to employ:
Ethernet
Use UDP or TCP as CommInterface. Supported with XCP protocol only.
NI-CAN
Use CANx as CommInterface to select the corresponding NI-CAN interface. The special CAN interface values 256 and 257 refer to virtual interfaces. For more information about using virtual interfaces, refer to the Frame to Channel Conversion section of Chapter 6, Using The Channel API, in the NI-CAN Hardware and Software User Manual.
NI-XNET
Use CANx@nixnet as CommInterface to select the corresponding NI-XNET interface as configured under Devices and Interfaces in MAX.
For using NI-XNET hardware on CompactRIO or R Series hardware, you may need to create an FPGA bit file to enable access to the modules. Refer to NI-XNET documentation for information about creating and loading a bit file; use the regular NI-XNET string format.
![]() |
Note When you append @nixnet to the Protocol and Interface string, the ECU Measurement and Calibration Toolkit uses NI-XNET Queued sessions. To force the ECU Measurement and Calibration Toolkit to use Stream sessions instead, append @ni_genie_nixnet to the Protocol and Interface string (for example, CCP:CAN1@ni_genie_nixnet). |
NI 985x CAN modules
Use CANx@BridgeBitFile.lvbitx as CommInterface. A bridge FPGA VI (found in the LabVIEW examples of ECU MC) must be compiled for the RIO target; BridgeBitFile.lvbitx represents the absolute file path of the resulting bit file. It will be downloaded to the FPGA automatically when opening the CAN interface. For Real-Time targets, the bit file must be transferred to the internal disk, and this local file path must be used.
CANx refers to the name of the front panel controls used in the bridge FPGA VI (not to the module name in the LabVIEW project). Only a single 985x CAN interface is supported per FPGA target.
Use CANx@RIOx,BridgeBitFile.lvbitx as CommInterface to also specify the RIO target. RIOx equals the RIO target name as defined in your LabVIEW Project definition.