17.02.2015 Views

CCS C Compiler Manual PCB / PCM / PCH

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

this I2C_START as a restart. If no parameter is passed a 2 is used only if the<br />

compiler compiled a I2C_START last with no I2C_STOP since.<br />

Availability:<br />

Requires:<br />

Examples:<br />

All devices.<br />

#USE I2C<br />

i2c_start();<br />

i2c_write(0xa0); // Device address<br />

i2c_write(address); // Data to device<br />

i2c_start();<br />

// Restart<br />

i2c_write(0xa1); // to change data direction<br />

data=i2c_read(0); // Now read from slave<br />

i2c_stop();<br />

Example Files: ex_extee.c with 2416.c<br />

Also See:<br />

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

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

i2c_stop( )<br />

Syntax:<br />

Parameters:<br />

Returns:<br />

Function:<br />

Availability:<br />

Requires:<br />

i2c_stop()<br />

i2c_stop(stream)<br />

stream: (optional) specify stream defined in #USE I2C<br />

undefined<br />

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

All devices.<br />

#USE I2C<br />

Examples:<br />

i2c_start(); // Start condition<br />

i2c_write(0xa0); // Device address<br />

i2c_write(5); // Device command<br />

i2c_write(12); // Device data<br />

i2c_stop(); // Stop condition<br />

Example Files: ex_extee.c with 2416.c<br />

Also See:<br />

i2c_poll, i2c_speed, i2c_start, i2c_slaveaddr, i2c_isr_state, i2c_write, i2c_read,<br />

#USE I2C, I2C Overview<br />

204

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

Saved successfully!

Ooh no, something went wrong!