. |
Transitioning to the New CAN I/O Functions Why the change? In the previous MPI release, 03.02.00, a new set of functions were introduced to access dedicated and general purpose I/O. To ensure a consistent interface for other I/O, a new set of functions were added to the MPI in the 03.03.00 release for accessing the I/O attached to CANOpen nodes. The new interface has one function for accessing single or multiple digital bits, which should reduce any confusion between the original two functions in the 03.02.00 release with very similar names: meiCanNodeDigitalInputGet and meiCanNodeDigitalInputsGet.
What Has Changed?
The original functions and enumerations are still available and will have the same functionality as they did prior to 03.03.00 MPI release. See MPI Version Numbering. The original definitions have been moved to meiDepricated.h. NOTE: An existing application can still use the deprecated interface without any source code changes. However, new or existing applications that want to use the extended functions should use the new interface. See Also: CAN I/O Overview
Sample Code The new analog functions now return a 16-bit signed number, not a double. This allows the true bits from each analog channel to be accessed. This is useful when using 4-20mA slices from MEI (TSIO-6006 and TSIO-6008) since these will return the number 8000h if the current is below the minimum sensor threshold of 3mA. Example 1 If the original code to read the current state of input 3 on node 5 was:
The equivalent code using the new interface would be:
Example 2 If the original code to read the current state of inputs 2, 3 and 4 on node 5 was:
The equivalent code using the new interface would be:
Example 3 If the original code to clear outputs 8 to 15 on node 5 was:
The equivalent code using the new interface would be:
|
| | Copyright © 2001-2021 Motion Engineering |