CAN Bus Output
Overview
A CAN Bus Output packs a single CANbus signal into a raw outgoing CAN frame, using a byte/bit layout you define by hand. Use it when you know the frame layout (e.g. from a DBC) for an arbitrary or custom device and there is no CAN Preset for it. This is the raw frame signal approach: you give the message ID, say how the bits are encoded and where they sit, then scale your source value into the raw signal. To write a named object on a supported device instead, use a CAN Object Output.
Prerequisites & hardware
- A defined CAN bus for the channel the frame is sent on — see Working with the CAN Bus.
- The frame's message ID and bit layout for the signal you want to write (length, offset, encoding).
- A source value (a map, driver or input) to drive the signal.
Add it in the app
- Add a new output and choose CAN Bus Output as the type.
- Give it a clear alias (e.g.
Requested Torque). - Enter the Message ID and its ID type, then the encoding type, length and offset that place the signal in the frame.
- Set the in → raw scaling and a default value, then drive it from a map/driver.
Settings reference
| Setting | Meaning | Unit | Range / values | Notes |
|---|---|---|---|---|
| Message ID | CAN frame identifier to send | hex | fixed32 | The arbitration ID of the outgoing frame. |
| Message ID type | Identifier width | — | Extended (29-bit), Standard (11-bit) |
Must match what the receiving device expects. |
| Encoding type | How the value is packed into the bits | — | UnsignedBigEndian, UnsignedLittleEndian, SignedBigEndian, SignedLittleEndian, BitField, CounterField, BitCounterField |
Selects signedness/endianness/bitfield. CounterField / BitCounterField auto-generate a rolling message counter. |
| Length | Signal length | bytes / bits | uint32 | In bytes for the integer types and CounterField; in bits for the bitfield types (BitField, BitCounterField). |
| Offset | Position of the signal in the frame | bytes / bits | uint32 | Same units as Length: bytes for integer/CounterField types, bits for bitfield types. |
| In min / In max | Input (engineering) range to scale from | source unit | sint32 | The source low/high points. |
| Raw min / Raw max | Raw signal range to scale to | — | sint32 | The packed value at In min / In max. |
| Default value | Value packed before a source value is available | source unit | sint32 | Sent until the source provides a value. |
Scaling: the source value is mapped from In min…In max to Raw min…Raw max using two-point interpolation.
Rolling counter: choose CounterField or BitCounterField for keep-alive / rolling-counter bytes — the controller increments the value each frame for you, so no source is needed.
Common settings
CAN Bus Output also uses the shared settings — alias and pin. See Common IO Settings.
Example — requested torque to an inverter
- Type CAN Bus Output, alias
Requested Torque. - Message ID
0x100, ID typeStandard (11-bit). - Encoding type
UnsignedLittleEndian, Length2(bytes), Offset1(starts at byte 1) — a 16-bit value. (A bitfield type would use bits here.) - In min/max
0/500(Nm) → Raw min/max0/5000(0.1 Nm/bit). - Default value
0so no torque is requested until the strategy drives it. - Add a second output on the same ID with Encoding type
CounterFieldfor the inverter's rolling-counter byte.
Troubleshooting
- Receiver ignores the frame: check the Message ID and ID type, and the CAN bus baud rate.
- Value lands wrong / sign flipped: check the encoding type, Length and Offset — they are in bytes for integer/
CounterFieldtypes and bits for bitfield types. - Receiver reports a counter/checksum fault: add a
CounterField/BitCounterFieldoutput for the rolling-counter byte. - Sends an unexpected value at start-up: set a sensible Default value.
Related
- CAN Object Output — write a named object to a CAN Preset instead of packing bytes by hand.
- CAN Bus Input — decode a signal from an incoming frame.
- Working with the CAN Bus