CANBR        Set the CAN-bus baud rate

Syntax                        

CANBR value16

Set CAN-bus Baud Rate to value16

CANBR VAR16

Set CAN-bus Baud Rate to VAR16

 

Operandsvalue16: 16-bit unsigned integer immediate value

       VAR16: 16-bit integer variable

PlaceTMLOnline

Binary code

CANBR

DescriptionSets the baud rate and bit sampling timing for the CAN-bus communication channel. The new baud settings can be provided either as an immediate value or by the value of a TML variable. In both cases, the possible values are:

The current CAN-bus settings are saved in the TML register CBR, and may be read at any moment. The CAN-bus baud rate is set at power on using the following algorithm:

a.With the value read from the EEPROM setup table
b.If the setup table is invalid, with the last baud rate read from a valid setup table
c.If there is no baud rate set by a valid setup table, with 500kb

 

Remarks:

Use this command when a drive/motor operates in AUTORUN (after power on starts to execute the TML program from the EEPROM) and it must communicate with a host at a CAN baud rate different from the default value. In this case, the TML program must start with a CAN baud rate change.
An alternate solution to the above case is to set via CANBR command the desired baud rate and then to save it in the EEPROM, with the command SAVE. After a reset, the drive/motor starts directly with the new baud rate, if the setup table was valid. Once set, the new default baud rate is preserved, even if the setup table is later on disabled, because the default CAN baud rate is stored in a separate area of the EEPROM.

 

Example

CANBR 0x1273; // set CAN-bus for 1Mb