Understanding CAN Frames
CAN (Controller Area Network) communication uses frames to transmit data. Each frame is identified by a CAN ID and contains up to 8 bytes of data. Data fields within a frame are defined by their byte position, bit position, and bit length, allowing for precise extraction of values from the CAN frame payload.Naming Conventions
While not mandatory, it is recommended to adopt the following naming conventions for clarity and usability:- Write Operations: Prefix names with
control.to indicate that the field is used for controlling the device. - Read Operations: Prefix names with
measure.to signify that the field is used for measurement purposes. - Fault and Warning Fields: Use the prefixes
fault.orwarning.for fields that monitor faults or warnings. This helps in generating appropriate Telegram notifications and alerts for the system.
Required Parameters
Each register in the address map must include the following parameters:The CAN identifier for the frame containing this data field. The canId should be specified in decimal format.Example:
100The starting byte position within the CAN frame data payload (0-7).Options:
0 - 7The starting bit position within the start byte (0-7).Options:
0 - 7The total number of bits for this data field (1-64).Options:
1 - 64A unique name for the data field, representing the measurement point read from or written to the CAN device.Example:
measure.ports.port1.voltageThe data type of the value.Options:
int8 | uint8 | int16 | uint16 | int32 | uint32 | float32 | string32 | int64 | uint64 | float64Optional Parameters
These parameters are not necessary for every entry but can be included as needed:The scaling factor to apply to the CAN data field’s return value or the value being written.Example:
0.1The offset to apply to the CAN data field’s return value or the value being written.Example:
10The direction of the power or current flow on a port of the device. When the direction is set to
output,
the register value will be inverted.Options: input | outputThe minimum value of the register. For write register, setting the minimum value prevents you from
writing a value lower than the minimum value. The control command will be blocked by the Power Platform.Example:
0The maximum value of the register. For write register, setting the maximum value prevents you from
writing a value higher than the maximum value. The control command will be blocked by the Power Platform.Example:
10Indicates if mapping should be applied to the return value or the value being written.Example:
Specifies the byte order notation.Options:
little | big.json extension. For example, canbus_device_address_map.json.
Example
canbus_address_map.json