WebbotLib AVR library
WebbotLib It just does it
  C++ documentation  C documentation

setBitRate

Sets the communications speed of the I2C bus.
When the bus is initialised it is set to use a default of 100 kilo-bits per second which is satisfactory for most devices.
If some devices fail to work as expected then check the data sheet for the device to find the required bit rate. If you have more than one device connected to the same bus then you should check the maximum speed that they can each cope with - and then select the lowest number.
The speed only needs to be set once and is therefore best done in 'appInitSoftware'.
A planned future enhancement is to set up the speed for each device in Project Designer so that it can generate the correct code to set the best bit rate.
Syntax
I2cBus. setBitRate(bitrateKHz)
Where I2cBus is the name you have given to the device in Project Designer.
Parameters
TypeNameDescription
'bitrateKHz'
The communication speed in kilo bits per second ie a value of '100' means '100 kilo bits per second' or '100,000 bits per second'.
Returns
None
Note
You can only change the speed of a hardware bus.
Example
To change the speed of a bus called 'i2cMaster' to use 10,000 bits per second:
i2cMaster.setBitRate(10);

 

 

Valid XHTML 1.0 Transitional