17.02.2015 Views

CCS C Compiler Manual PCB / PCM / PCH

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Built-in Functions<br />

i2c_speed( )<br />

Syntax:<br />

Parameters:<br />

Returns:<br />

Function:<br />

Availability:<br />

Requires:<br />

i2c_speed (baud)<br />

i2c_speed (stream, baud)<br />

baud is the number of bits per second.<br />

stream - specify the stream defined in #USE I2C<br />

Nothing.<br />

This function changes the I2c bit rate at run time. This only works if the<br />

hardware I2C module is being used.<br />

All devices.<br />

#USE I2C<br />

Examples:<br />

I2C_Speed (400000);<br />

Example Files:<br />

Also See:<br />

none<br />

i2c_poll, i2c_start, i2c_stop, i2c_slaveaddr, i2c_isr_state, i2c_write,<br />

i2c_read, #USE I2C, I2C Overview<br />

i2c_start( )<br />

Syntax:<br />

Parameters:<br />

Returns:<br />

Function:<br />

i2c_start()<br />

i2c_start(stream)<br />

i2c_start(stream, restart)<br />

stream: specify the stream defined in #USE I2C<br />

restart: 2 – new restart is forced instead of start<br />

1 – normal start is performed<br />

0 (or not specified) – restart is done only if the compiler last encountered a<br />

I2C_START and no I2C_STOP<br />

undefined<br />

Issues a start condition when in the I2C master mode. After the start condition<br />

the clock is held low until I2C_WRITE() is called. If another I2C_start is called<br />

in the same function before an i2c_stop is called, then a special restart<br />

condition is issued. Note that specific I2C protocol depends on the slave<br />

device. The I2C_START function will now accept an optional parameter. If 1<br />

the compiler assumes the bus is in the stopped state. If 2 the compiler treats<br />

203

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!