Használati útmutató Microchip PIC24FJ96GA006

Olvassa el alább 📖 a magyar nyelvű használati útmutatót Microchip PIC24FJ96GA006 (74 oldal) a nincs kategorizálva kategóriában. Ezt az útmutatót 4 ember találta hasznosnak és 2 felhasználó értékelte átlagosan 4.5 csillagra

Oldal 1/74
2007-2015 Microchip Technology Inc. DS70000195G-page 1
HIGHLIGHTS
This section of the manual contains the following major topics:
1.0 Introduction ....................................................................................................................... 2
2.0 I
2
C Bus Characteristics..................................................................................................... 4
3.0 Control and Status Registers ............................................................................................ 8
4.0 Enabling I
2
C Operation ................................................................................................... 18
5.0 Communicating as a Master in a Single Master Environment ........................................ 20
6.0 Communicating as a Master in a Multi-Master Environment .......................................... 34
7.0 Communicating as a Slave ............................................................................................. 37
8.0 Connection Considerations for I
2
C Bus .......................................................................... 61
9.0 Operation in Power-Saving Modes ................................................................................. 63
10.0 Peripheral Module Disable (PMDx) Registers ................................................................ 63
11.0 Effects of a Reset............................................................................................................ 63
12.0 Constant-Current Source ................................................................................................ 64
13.0 Register Maps................................................................................................................. 66
14.0 Design Tips ..................................................................................................................... 67
15.0 Related Application Notes............................................................................................... 68
16.0 Revision History .............................................................................................................. 69
Inter-Integrated Circuit (I2C)
dsPIC33/PIC24 Family Reference Manual
DS70000195G-page 2 2007-2015 Microchip Technology Inc.
This document supersedes the following PIC24 and dsPIC
®
DSC Family Reference Manual sections:
1.0 INTRODUCTION
The Inter-Integrated Circuit (I
2
C) module is a serial interface useful for communicating with other
peripheral or microcontroller (MCU) devices. The external peripheral devices may be serial
EEPROMs, display drivers, Analog-to-Digital Converters (ADC) and so on.
The I
2
C module can operate as any one of the following in the I
2
C system:
Slave device
Master device in a single master system (slave may be active)
Master or slave device in a multi-master system (bus collision detection and arbitration are
available)
The I
2
C module contains an independent I
2
C master logic and a I
2
C slave logic, which generates
interrupts based on their events. In the multi-master systems, the user software is simply
partitioned into the master controller and the slave controller.
When the I
2
C master logic is active, the slave logic also remains active, detecting the state of the
bus and potentially receiving messages from itself in a single master system or from the other
masters in a multi-master system. No messages are lost during the multi-master bus arbitration.
In a multi-master system, the bus collision conflicts with the other masters in the system when
detected, and the module provides a method to terminate and then restart the message.
The I
2
C module contains a Baud Rate Generator (BRG). The I
2
C BRG does not consume other
timer resources in the device. Figure 1-1 illustrates the I
2
C module block diagram.
Key features of the I
2
C module include the following:
Independent master and slave logic
Multi-master support which prevents message losses in arbitration
Detects 7-bit and 10-bit device addresses with configurable address masking in Slave mode
Detects general call addresses as defined in the I
2
C protocol
Bus Repeater mode, allowing the module to accept all messages as a slave, irrespective of
the address
Automatic SCLx clock stretching provides delays for the processor to respond to a slave
data request
Supports 100 kHz and 400 kHz bus specifications
Supports the Intelligent Platform Management Interface (IPMI) standard
Supports SDAx hold time for SMBus (300 nS or 150 nS) in Slave mode
Note: This family reference manual section is meant to serve as a complement to device
data sheets. Depending on the device variant, this manual section may not apply to
all PIC24 and dsPIC33 devices.
Please consult the note at the beginning of the “Inter-Integrated Circuit (I
2
C)”
chapter in the current device data sheet to check whether this document supports
the device you are using.
Device data sheets and family reference manual sections are available for
download from the Microchip Worldwide Web site at:
http://www.microchip.com
DS Number Section Number Title
DS70195 19 dsPIC33F/PIC24H Family Reference Manual
DS70330 19 dsPIC33E/PIC24E Family Reference Manual
DS39702 24 PIC24F Family Reference Manual
DS70235 19 PIC24H Family Reference Manual
DS70068 21 dsPIC30F Family Reference Manual
Note:
For more information, refer to the SDAHT bit description in the specific device data sheet.
2007-2015 Microchip Technology Inc. DS70000195G-page 3
Inter-Integrated Circuit (I
2
C)
Figure 1-1: I
2
C Block Diagram
I2CxRCV
Internal
Data Bus
SCLx
SDAx
Shift
Match Detect
Clock
Address Match
Clock
Stretching
I2CxTRN
LSB
Shift Clock
BRG
Reload
Control
T
CY
or T
CY
/2
(1)
Acknowledge
Generation
I2CxCONH
I2CxSTAT
Control Logic
Read
LSB
Write
Read
I2CxBRG
I2CxRSR
Write
Read
Write
Read
Write
Read
Write
Read
Write
Read
Down Counter
I2CxCONL
Write
Read
Note 1: Refer to the specific device data sheet for the clock rate.
I2CxADD
Start and Stop
Bit Detect
Start and Stop
Bit Generation
Collision
Detect
I2CxMSK
dsPIC33/PIC24 Family Reference Manual
DS70000195G-page 4 2007-2015 Microchip Technology Inc.
2.0 I2C BUS CHARACTERISTICS
The I
2
C bus is a 2-wire serial interface. Figure 2-1 illustrates the schematic of an I
2
C connection
between a dsPIC33/PIC24 device and a 24LC256 I
2
C serial EEPROM, which is a typical
example for any I
2
C interface.
The I
2
C interface uses a comprehensive protocol to ensure reliable transmission and reception
of the data. When communicating, one device acts as the “master” and it initiates transfer on the
bus, and generates the clock signals to permit that transfer, while the other devices act as the
“slave” responding to the transfer. The clock line, SCLx, is output from the master and input to
the slave, although occasionally the slave drives the SCLx line. The data line, SDAx, may be
output and input from both the master and slave.
Because the SDAx and SCLx lines are bidirectional, the output stages of the devices driving the
SDAx and SCLx lines must have an open-drain in order to perform the wired-AND function of the bus.
External pull-up resistors are used to ensure a high level when no device is pulling the line down.
In the I
2
C interface protocol, each device has an address. When a master needs to initiate a data
transfer, it first transmits the address of the device that it wants to “communicate”. All of the
devices “listen” to see if this is their address. Within this address, bit 0 specifies whether the
master wants to read from or write to the slave device. The master and slave are always in
opposite modes (Transmitter or Receiver) of operation during a data transfer. That is, they
operate in either of the following two relationships:
Master-Transmitter and Slave-Receiver
Slave-Transmitter and Master-Receiver
In both cases, the master originates the SCLx clock signal.
Figure 2-1: Typical I
2
C Interconnection Block Diagram
Note:
SCLx and SDAx must be configured as digital.
SCLx
SDAx
dsPIC33/PIC24
SDA
SCL
V
DD
V
DD
2.2 k24LC256
(typical)
2007-2015 Microchip Technology Inc. DS70000195G-page 5
Inter-Integrated Circuit (I
2
C)
2.1 Bus Protocol
The following I
2
C bus protocol has been defined:
The data transfer may be initiated only when the bus is not busy.
During the data transfer, the data line must remain stable whenever the SCLx clock line is
high. Any changes in the data line, while the SCLx clock line is high, will be interpreted as a
Start or Stop condition.
Accordingly, the bus conditions are defined as illustrated in Figure 2-2.
Figure 2-2: I
2
C Bus Protocol States
2.1.1 START DATA TRANSFER (S)
After a bus Idle state, a high-to-low transition of the SDAx line while the clock (SCLx) is high
determines a Start condition. All data transfers must be preceded by a Start condition.
2.1.2 STOP DATA TRANSFER (P)
A low-to-high transition of the SDAx line while the clock (SCLx) is high determines a Stop
condition. All data transfers must end with a Stop condition.
2.1.3 REPEATED START (R)
After a Wait state, a high-to-low transition of the SDAx line while the clock (SCLx) is high
determines a Repeated Start condition. Repeated Starts allow a master to change bus direction
or address a slave device without relinquishing control of the bus.
2.1.4 DATA VALID (D)
After a Start condition, the state of the SDAx line represents valid data when the SDAx line is
stable for the duration of the high period of the clock signal. There is one bit of data per SCLx
clock.
2.1.5 ACKNOWLEDGE (A) OR NOT ACKNOWLEDGE (N)
All data byte transmissions must be Acknowledged (ACK) or Not Acknowledged (NACK) by the
receiver. The receiver will pull the SDAx line low for an ACK or release the SDAx line for a NACK.
The Acknowledge is a 1-bit period using one SCLx clock.
2.1.6 WAIT/DATA INVALID (Q)
The data on the line must be changed during the low period of the clock signal. The devices may
also stretch the clock low time by asserting a low on the SCLx line, causing a Wait on the bus.
2.1.7 BUS IDLE (I)
Both data and clock lines remain high after a Stop condition and before a Start condition.
Address
Valid
Data
Allowed
to Change
Stop
Condition
Start
Condition
SCLx
SDAx
(I) (S) (D) (A) or (N) (P) (I)
Data or
(Q)
ACK/NACK
Valid
NACK
ACK
dsPIC33/PIC24 Family Reference Manual
DS70000195G-page 6 2007-2015 Microchip Technology Inc.
2.2 Message Protocol
A typical I
2
C message is illustrated in Figure 2-3. In this example, the message will read a
specified byte from a 24LC256 I
2
C serial EEPROM. The dsPIC33/PIC24 device will act as the
master and the 24LC256 device will act as the slave.
Figure 2-3 illustrates the data as driven by the master device and the slave device, taking into
account that the combined SDAx line is a wired-AND of the master and slave data. The master
device controls and sequences the protocol. The slave device will only drive the bus at
specifically determined times.
Figure 2-3: A Typical I
2
C Message: Read of Serial EEPROM (Random Address Mode)
2.2.1 START MESSAGE
Each message is initiated with a Start condition and terminated with a Stop condition. The
number of data bytes transferred between the Start and Stop conditions is determined by the
master device. As defined by the system protocol, the bytes of the message may have special
meaning, such as the device address byte or the data byte.
2.2.2 ADDRESS SLAVE
In Figure 2-3, the first byte is the device address byte, which must be the first part of any I
2
C
message. It contains a device address and a R/W status bit. Note that R/W = 0 for this first
address byte, indicating that the master will be a transmitter and the slave will be a receiver.
2.2.3 SLAVE ACKNOWLEDGE
The receiving device is obliged to generate an Acknowledge signal, ACK, after the reception of
each byte. The master device must generate an extra SCLx clock, which is associated with this
Acknowledge bit.
2.2.4 MASTER TRANSMIT
The next two bytes, sent by the master to the slave, are data bytes that contain the location of
the requested EEPROM data byte. The slave must Acknowledge each of the data bytes.
2.2.5 REPEATED START
The slave EEPROM has the required address information that is required to return the requested
data byte to the master. However, the R/W status bit from the first device address byte specifies
the master transmission and the slave reception. The direction of the bus must be reversed for
the slave to send data to the master.
To perform this function without ending the message, the master sends a Repeated Start. The
Repeated Start is followed with a device address byte containing the same device address as
before, and with R/W = 1, to indicate the slave transmission and the master reception.
X
Bus
Master
SDAx
Start
Address
Byte
EEPROM Address
High Byte
EEPROM Address
Low Byte Address
Byte Data
Byte
S1 0 1 0 AAA0
210 R1 0 1 0 AAA1
210 P
Slave
SDAx
Activity
N
AAAA
Output
Output
Idle
R/W
ACK
ACK
ACK
Restart
ACK
NACK
Stop
Idle
R/W
 2007-2015 Microchip Technology Inc. DS70000195G-page 9
Inter-Integrated Circuit (I
2
C)
Register 3-1: I2CxCON: I2Cx Control Register
R/W-0 U-0 R/W-0 R/W-1, HC R/W-0 R/W-0 R/W-0 R/W-0
I2CEN I2CSIDL SCLREL IPMIEN
( )1
A10M DISSLW SMEN
bit 15 bit 8
R/W-0 R/W-0 R/W-0 R/W-0, HC R/W-0, HC R/W-0, HC R/W-0, HC R/W-0, HC
GCEN STREN ACKDT ACKEN RCEN PEN RSEN SEN
bit 7 bit 0
Legend:
HC = Hardware Clearable bit
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at Reset ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 15
I2CEN:
I2Cx Enable bit
1 = Enables the I2Cx module and configures the SDAx and SCLx pins as serial port pins
0 = Disables the I2Cx module; all the I
2
C pins are controlled by port functions
bit 14
Unimplemented:
Read as ‘0’
bit 13
I2CSIDL:
I2Cx Stop in Idle Mode bit
1 = Discontinues the module operation when a device enters the Idle mode
0 = Continues the module operation in the Idle mode
bit 12
SCLREL:
SCLx Release Control bit (when operating as I
2
C slave)
1 = Releases the SCLx clock
0 = Holds the SCLx clock low (clock stretch)
If STREN = 1:
User software may write ‘0’ to initiate a clock stretch and write ‘1’ to release the clock. Hardware clears
at the beginning of every slave data byte transmission. Hardware clears at the end of every slave
address byte reception. Hardware clears at the end of every slave data byte reception.
If STREN = 0:
User software may only write ‘1’ to release the clock. Hardware clears at the beginning of every slave
data byte transmission. Hardware clears at the end of every slave address byte reception.
bit 11
IPMIEN:
IPMI Enable bit
( )1
1 = IPMI Support mode is enabled, all addresses are Acknowledged
0 = IPMI Support mode is disabled
bit 10
A10M:
10-Bit Slave Address bit
1 = I2CxADD register is a 10-bit slave address
0 = I2CxADD register is a 7-bit slave address
bit 9
DISSLW:
Disable Slew Rate Control bit
1 = Slew rate control is disabled
0 = Slew rate control is enabled
bit 8
SMEN:
SMBus Input Levels bit
1 = Enables the I/O pin thresholds compliant with the SMBus specification
0 = Disables the SMBus input thresholds
bit 7
GCEN:
General Call Enable bit (when operating as I
2
C slave)
1 = Enables the interrupt when a general call address is received in the I2CxRSR register (module is
enabled for reception)
0 = Disables the general call address
bit 6
STREN:
SCLx Clock Stretch Enable bit (I
2
C Slave mode only; used in conjunction with the SCLREL bit)
1 = Enables the user software or the receive clock stretching
0 = Disables the user software or the receive clock stretching
Note 1:
The IPMIEN bit should not be set when the I
2
C module is operating as a master.

Termékspecifikációk

Márka: Microchip
Kategória: nincs kategorizálva
Modell: PIC24FJ96GA006

Szüksége van segítségre?

Ha segítségre van szüksége Microchip PIC24FJ96GA006, tegyen fel kérdést alább, és más felhasználók válaszolnak Önnek




Útmutatók nincs kategorizálva Microchip

Útmutatók nincs kategorizálva

Legújabb útmutatók nincs kategorizálva

MOZA

MOZA SR-P Útmutató

10 Április 2025
CaterChef

CaterChef 445001 Útmutató

9 Április 2025
IFM

IFM E40581 Útmutató

9 Április 2025
Livn

Livn Bolt Útmutató

9 Április 2025
Livn

Livn Beats Útmutató

9 Április 2025
IFM

IFM O3R252 Útmutató

9 Április 2025