FUNCTIONAL OVERVIEW
I2C
I2C? is a popular two -wire communication protocol developed by Phillips. Many PIC
microcontrollers support hardware- based I2C?. CCS offers support for the hardware -based
I2C? and a software - based master I2C? device. (For more information on the h ardware-based
I2C module, please consult the datasheet for you target device; not all PICs support I2C?.)
Relevant Functions:
i2c_start()
i2c_write(data)
i2c_read()
i2c_stop()
i2c_poll()
Issues a start command when in the I2C master mode.
Sends a single byte over the I2C interface.
Reads a byte over the I2C interface.
Issues a stop command when in the I2C master mode.
Returns a TRUE if the hardware has received a byte in the
buffer.
Relevant Preprocessor:
#USE I2C
Configures the compiler to s upport I2C? to your
specifications.
Relevant Interrupts:
#INT_SSP
#INT_BUSCOL
#INT_I2C
#INT_BUSCOL2
#INT_SSP2
Relevant Include Files:
None, all functions built-in
Relevant getenv() Parameters:
I2C_SLAVE
I2C_MASTER
Example Code:
#define Device_SDA PIN_C3
#define Device_SLC PIN_C4
#use i 2 c(master,
I2C or SPI activity
Bus Collision
I2C Interrupt (Only on 14000)
Bus Collision (Only supported on some PIC18's)
I2C or SPI activity (Only supported on some PIC18's)
Returns a 1 if the device has I2C slave H/W
Returns a 1 if the device has a I2C master H/W
// Pin defines
// Configure Device as Master
sda=Device_SDA,
scl=Device_SCL)
..
..
30
相关PDF资料
PCI-EXP-T42G5-N1 IP CORE PCI EXPRESS ORCA 4
PCM18XH2 PROCESSOR MODULE MPLAB-ICE 2000
PCM18XN0 PROCESSOR MODULE FOR ICE2000
PDA-B-24-615-E-2B1-1-C CIRCUIT BREAKER MAG 1P 15A
PFMF.260.2 PFMF PTC FUSE SMT 2.6A 1812
PFNF.200.2 PFNF PTC FUSE SMT 2A 1206
PFRY.375 PTC-FUSE RADIAL 72 VDC
PFSM.150.33.2 FUSE PTC 8A 15V FST-TRIP SMD
相关代理商/技术参数
PCD_09 制造商:MACOM 制造商全称:Tyco Electronics 功能描述:Low Profile PCB Relay PCD
PCD-00173-0C 制造商:Molex 功能描述:ETHERNET CABLE ASSEMBLY
PCD-00173-0E 制造商:Molex 功能描述:Ethernet Cable Assembly
PCD-00173-0H 制造商:Molex 功能描述:ETHERNET CABLE ASSEMBLY
PCD-00173-0K 制造商:Molex 功能描述:ETHERNET CABLE ASSEMBLY
PCD-00174-0C 制造商:Molex 功能描述:ETHERNET CABLE ASSEMBLY 制造商:Molex 功能描述:ETHERNET CABLE ASSEMBLY; Cable Length - Imperial:3ft; Cable Length - Metric:914.4mm; Connector Type A:RJ45 Plug; Connector Type B:RJ45 Plug; Jacket Color:Red; Approval Bodies:CSA / UL; Body Material:PVC; Cable Assembly Type:Ethernet ;RoHS Compliant: NA
PCD-00174-0E 制造商:Molex 功能描述:ETHERNET CABLE ASSEMBLY 制造商:Molex 功能描述:ETHERNET CABLE ASSEMBLY; Cable Length - Imperial:3ft; Cable Length - Metric:914.4mm; Connector Type A:RJ45 Plug; Connector Type B:RJ45 Plug; Jacket Color:Grey; Approval Bodies:CSA / UL; Body Material:PVC; Cable Assembly Type:Ethernet;RoHS Compliant: NA
PCD-00174-0H 制造商:Molex 功能描述:ETHERNET CABLE ASSEMBLY