![]() |
Kvaser J1939 Library
|
The function j1939_create_channel is used to create a J1939 channel and j1939_open_channel is used to open the channel for communication.
The channel may be opened and closed multiple times during its lifetime and this is similar to bus on and bus off in CANlib.
Example. Create and open a channel.
The J1939ChannelParams structure passed to j1939_create_channel is used to configure a J1939 channel. The bit_rate parameter is used to set the CAN bitrate for the channel. In order to set the bit rate, the CANlib channel must be opened with init access. If the CANlib channel is already opened with init access then j1939_create_channel will fail. If the bit_rate parameter is 0, the channel will not attempt to set the bit rate and will use the existing bit rate of the CAN channel.
Additional channel options can be set using j1939_set_channel_option, see J1939ChannelOption for available configuration options.