SlideShare une entreprise Scribd logo
1  sur  40
1
I2C-bus
• I2C(Inter-Integrated Circuit)是由飛利浦公司
  發表的一種雙向兩線式串列通訊匯流排,
  是用來控制IC與IC之間直接通訊的串列通訊
  介面。

• 這些周邊裝置可以是串列EEPROM、顯示器
  驅動器、A/D 轉換器等。


                                     2
I2C-bus
• 傳輸速度:
 – 標準模式 100 Kbit/s
 – 快速模式 400 Kbit/s
 – 高速模式 3.4 Mbit/s


• 限制:
 – 連接至I2C-bus的最大元件數,加總電容值應限
   制在400pF

                              3
I2C-bus
                              V+

                   Rp   Rp

SDA


SCL



        MCU                  EEPROM    溫度
      PIC18F4520             24LC32A   TC74




                                              4
V+

          Rp   Rp

 SDA


 SCL




DATA   CLOCK        DATA   CLOCK
OUT     OUT         OUT     OUT

DATA   CLOCK        DATA   CLOCK
 IN      IN          IN      IN



                                   5
I 2 C-bus 的傳送、讀取

 接收端        傳送端
讀取資料       改變資料




                   6
START & STOP condition
 START condition:當 SCL High期間,SDA 產生 High → Low
  STOP condition:當 SCL High期間,SDA 產生 Low → High


SDA


SCL




  START 和 STOP condition 都是由主控端(master)產生

                                             7
I 2 C-bus的一筆交易資料




• Every byte put on the SDA line must be 8-bits long.
• Each byte has to be followed by an acknowledge bit.
• Data is transferred with the most significant bit (MSB) first
                                                                  8
Acknowledgement

 接收端        傳送端
讀取資料       改變資料




                    9
接收端讀取8位元回應ACK

回應ACK

讀取8位元




                                        A

        1   2   3   4   5   6   7   8       9

                                                10
傳送端送出8位元讀取ACK

讀取ACK

送8位元




                                        A

        1   2   3   4   5   6   7   8       9

                                                11
I 2 C-bus完整的一筆資料交易
  控制碼   資料   資料




                     12
控制碼

1:主控端讀取資料
0:主控端傳送資料



指定通訊裝置的位址



            13
主控端-傳送資料




           14
主控端-傳送資料

               主控端


S 控制碼      A   資料    A   資料   A P

R/W = 0
               從屬端

                                    15
主控端-讀取資料




           16
主控端-讀取資料

              主控端
R/W = 1

S 控制碼     A   資料    A   資料   A P



              從屬端

                                   17
混和模式

S   控制碼   A 資料 A Sr   控制碼   A 資料 A P




                                  18
混和模式


S 控制碼    A    資料   A   資料   A P




Sr 控制碼
S        A   資料    A   資料   A P


                                  19
混和模式


S 控制碼    A    資料   A   資料   A P




Sr 控制碼
S        A   資料    A   資料   A P


                                  20
void I2CInit(void);
void Sbit(void);
void Pbit(void);
unsigned char I2CWrite(unsigned char Data);
unsigned char I2CRead ( unsigned char ack );
void I2Cpoll(unsigned char Dev);

                                               21
100 kHz and 400 kHz Clock Compatibility
Page Write Time 5 ms max.

32-Byte Page Write Buffer

                                                 Page Latches




                                          寫入保護




                                                        22
23
24
25
提昇電阻

       26
27
000
001
002
003

FFD
FFE
FFF




      指定記憶體位址

                28
29
30
31
32
24LC32A資料寫入操作
  Start                 位址          位址
              控制碼
condition             High byte   Low byte

              指定記憶體位址
            資料方向 PIC → 24LC32A



                                               Stop
               資料       資料         資料
                                             condition

                      傳送記憶體資料
                    資料方向 PIC → 24LC32A
                                                   33
24LC32A資料讀取操作
  Start                 位址          位址
              控制碼
condition             High byte   Low byte

              指定記憶體位址
            資料方向 PIC → 24LC32A



 Restart                                       Stop
              控制碼       資料         資料
condition                                    condition

                  記憶體資料讀取
                資料方向 PIC ← 24LC32A
                                                   34
24LC32A資料讀取操作
  Start              位址          位址         End
            控制碼
condition          High byte   Low byte   condition

               指定記憶體位址
             資料方向 PIC → 24LC32A



  Start                                     Stop
            控制碼      資料         資料
condition                                 condition

               記憶體資料讀取
             資料方向 PIC ← 24LC32A
                                                35
請完成24LC32A讀寫操作
    指定記憶體位址:0x03,連續寫入A,B,C三筆資料
              控制碼            位址           位址
      S       R/W = 0      High byte    Low byte
                                                      資料     資料   資料   P

      S                                                                P


       指定記憶體位址:0x03,連續讀取三筆資料
    控制碼          位址            位址                  控制碼
S   R/W = 0    High byte     Low byte     Sr       R/W = 1
                                                             資料   資料   資料        P

S                                         Sr                                     P

                                                                            36
37
J10




      38
指定位址0x03

 寫入資料

 錯誤處理




           39
指定位址0x03




   資料讀取




           40

Contenu connexe

Tendances

Amortize analysis of Deque with 2 Stack
Amortize analysis of Deque with 2 StackAmortize analysis of Deque with 2 Stack
Amortize analysis of Deque with 2 StackKen Ogura
 
TTL Logic Families and its Types.pptx
TTL Logic Families and its Types.pptxTTL Logic Families and its Types.pptx
TTL Logic Families and its Types.pptxHarishKumarKS3
 
Multiplication algorithm
Multiplication algorithmMultiplication algorithm
Multiplication algorithmGaurav Subham
 
Major project report
Major project reportMajor project report
Major project reportPraveen Singh
 
Electronic Toll Collection System
Electronic Toll Collection SystemElectronic Toll Collection System
Electronic Toll Collection SystemRajan Bairasriya
 
ARM Exception and interrupts
ARM Exception and interrupts ARM Exception and interrupts
ARM Exception and interrupts NishmaNJ
 
M2M systems layers and designs standardizations
M2M systems layers and designs standardizationsM2M systems layers and designs standardizations
M2M systems layers and designs standardizationsFabMinds
 
Application Layer Protocols for the IoT
Application Layer Protocols for the IoTApplication Layer Protocols for the IoT
Application Layer Protocols for the IoTDamien Magoni
 
Instruction set of 8085 microprocessor
Instruction set of 8085 microprocessorInstruction set of 8085 microprocessor
Instruction set of 8085 microprocessorRahul Sahu
 
Automation of shopping cart to ease queue in malls by using RFID
Automation of shopping cart to ease queue in malls by using RFIDAutomation of shopping cart to ease queue in malls by using RFID
Automation of shopping cart to ease queue in malls by using RFIDSudher Sun
 
Internet of Things: Protocols for M2M
Internet of Things: Protocols for M2MInternet of Things: Protocols for M2M
Internet of Things: Protocols for M2MCharles Gibbons
 
CRC-32
CRC-32CRC-32
CRC-327shi
 
Case study on Transaction in Grocery Store
Case study on Transaction in Grocery Store Case study on Transaction in Grocery Store
Case study on Transaction in Grocery Store divyawani2
 
8085 arithmetic instructions
8085 arithmetic instructions8085 arithmetic instructions
8085 arithmetic instructionsprashant1271
 
エニグマ暗号とは何だったのか
エニグマ暗号とは何だったのかエニグマ暗号とは何だったのか
エニグマ暗号とは何だったのかTakahiro (Poly) Horikawa
 
Introduction to Microprocessors
Introduction to MicroprocessorsIntroduction to Microprocessors
Introduction to Microprocessors76 Degree Creative
 

Tendances (20)

Amortize analysis of Deque with 2 Stack
Amortize analysis of Deque with 2 StackAmortize analysis of Deque with 2 Stack
Amortize analysis of Deque with 2 Stack
 
TTL Logic Families and its Types.pptx
TTL Logic Families and its Types.pptxTTL Logic Families and its Types.pptx
TTL Logic Families and its Types.pptx
 
Multiplication algorithm
Multiplication algorithmMultiplication algorithm
Multiplication algorithm
 
Major project report
Major project reportMajor project report
Major project report
 
Iot
IotIot
Iot
 
Electronic Toll Collection System
Electronic Toll Collection SystemElectronic Toll Collection System
Electronic Toll Collection System
 
ARM Exception and interrupts
ARM Exception and interrupts ARM Exception and interrupts
ARM Exception and interrupts
 
M2M systems layers and designs standardizations
M2M systems layers and designs standardizationsM2M systems layers and designs standardizations
M2M systems layers and designs standardizations
 
Application Layer Protocols for the IoT
Application Layer Protocols for the IoTApplication Layer Protocols for the IoT
Application Layer Protocols for the IoT
 
Open Interconnect Consortium - Why & What
Open Interconnect Consortium - Why & WhatOpen Interconnect Consortium - Why & What
Open Interconnect Consortium - Why & What
 
Instruction set of 8085 microprocessor
Instruction set of 8085 microprocessorInstruction set of 8085 microprocessor
Instruction set of 8085 microprocessor
 
Automation of shopping cart to ease queue in malls by using RFID
Automation of shopping cart to ease queue in malls by using RFIDAutomation of shopping cart to ease queue in malls by using RFID
Automation of shopping cart to ease queue in malls by using RFID
 
Internet of Things: Protocols for M2M
Internet of Things: Protocols for M2MInternet of Things: Protocols for M2M
Internet of Things: Protocols for M2M
 
CRC-32
CRC-32CRC-32
CRC-32
 
Case study on Transaction in Grocery Store
Case study on Transaction in Grocery Store Case study on Transaction in Grocery Store
Case study on Transaction in Grocery Store
 
8085 arithmetic instructions
8085 arithmetic instructions8085 arithmetic instructions
8085 arithmetic instructions
 
エニグマ暗号とは何だったのか
エニグマ暗号とは何だったのかエニグマ暗号とは何だったのか
エニグマ暗号とは何だったのか
 
80386 Architecture
80386 Architecture80386 Architecture
80386 Architecture
 
Introduction to Microprocessors
Introduction to MicroprocessorsIntroduction to Microprocessors
Introduction to Microprocessors
 
Simple Neural Network Python Code
Simple Neural Network Python CodeSimple Neural Network Python Code
Simple Neural Network Python Code
 

En vedette

Project humix overview - For Raspberry pi community meetup
Project humix overview - For  Raspberry pi  community meetupProject humix overview - For  Raspberry pi  community meetup
Project humix overview - For Raspberry pi community meetupJeffrey Liu
 
用Raspberry Pi 學Linux I2C Driver
用Raspberry Pi 學Linux I2C Driver用Raspberry Pi 學Linux I2C Driver
用Raspberry Pi 學Linux I2C Driver艾鍗科技
 
台灣樹莓派 2016/12/26 #17 站在Nas的中心呼喊物聯網 QNAP QIoT
台灣樹莓派 2016/12/26 #17 站在Nas的中心呼喊物聯網 QNAP QIoT台灣樹莓派 2016/12/26 #17 站在Nas的中心呼喊物聯網 QNAP QIoT
台灣樹莓派 2016/12/26 #17 站在Nas的中心呼喊物聯網 QNAP QIoTAnderson Cheng
 
曼陀籮式電子電路教學法
曼陀籮式電子電路教學法曼陀籮式電子電路教學法
曼陀籮式電子電路教學法艾鍗科技
 
05 EEPROM memory.2016
05 EEPROM memory.201605 EEPROM memory.2016
05 EEPROM memory.2016Mohamed Fawzy
 
IoT of heart rate watchdog
IoT of heart rate watchdogIoT of heart rate watchdog
IoT of heart rate watchdog艾鍗科技
 
Deploy mbed IoT cloud
Deploy mbed IoT cloudDeploy mbed IoT cloud
Deploy mbed IoT cloud艾鍗科技
 
Tutorial1: mbed開發快速上手
Tutorial1: mbed開發快速上手Tutorial1: mbed開發快速上手
Tutorial1: mbed開發快速上手艾鍗科技
 
艾鍗學院-健康照護手環
艾鍗學院-健康照護手環艾鍗學院-健康照護手環
艾鍗學院-健康照護手環艾鍗科技
 
家庭醫療系統 PCMH
家庭醫療系統 PCMH家庭醫療系統 PCMH
家庭醫療系統 PCMH艾鍗科技
 
Microprocessor 8085 architecture ppt. april 2013
Microprocessor 8085 architecture ppt. april 2013Microprocessor 8085 architecture ppt. april 2013
Microprocessor 8085 architecture ppt. april 2013harshalata
 
貫通物聯網每一哩路 with Microsfot Azure IoT Sutie
貫通物聯網每一哩路 with Microsfot Azure IoT Sutie貫通物聯網每一哩路 with Microsfot Azure IoT Sutie
貫通物聯網每一哩路 with Microsfot Azure IoT SutieHerman Wu
 
Project Humix overview
Project Humix overviewProject Humix overview
Project Humix overviewJeffrey Liu
 
程式設計首日封
程式設計首日封程式設計首日封
程式設計首日封政斌 楊
 
encoder and decoder in digital electronics
encoder and decoder in digital electronicsencoder and decoder in digital electronics
encoder and decoder in digital electronicsvikram rajpurohit
 

En vedette (20)

Project humix overview - For Raspberry pi community meetup
Project humix overview - For  Raspberry pi  community meetupProject humix overview - For  Raspberry pi  community meetup
Project humix overview - For Raspberry pi community meetup
 
用Raspberry Pi 學Linux I2C Driver
用Raspberry Pi 學Linux I2C Driver用Raspberry Pi 學Linux I2C Driver
用Raspberry Pi 學Linux I2C Driver
 
台灣樹莓派 2016/12/26 #17 站在Nas的中心呼喊物聯網 QNAP QIoT
台灣樹莓派 2016/12/26 #17 站在Nas的中心呼喊物聯網 QNAP QIoT台灣樹莓派 2016/12/26 #17 站在Nas的中心呼喊物聯網 QNAP QIoT
台灣樹莓派 2016/12/26 #17 站在Nas的中心呼喊物聯網 QNAP QIoT
 
曼陀籮式電子電路教學法
曼陀籮式電子電路教學法曼陀籮式電子電路教學法
曼陀籮式電子電路教學法
 
05 EEPROM memory.2016
05 EEPROM memory.201605 EEPROM memory.2016
05 EEPROM memory.2016
 
Synchronous Counter
Synchronous Counter Synchronous Counter
Synchronous Counter
 
IoT of heart rate watchdog
IoT of heart rate watchdogIoT of heart rate watchdog
IoT of heart rate watchdog
 
Deploy mbed IoT cloud
Deploy mbed IoT cloudDeploy mbed IoT cloud
Deploy mbed IoT cloud
 
Tutorial1: mbed開發快速上手
Tutorial1: mbed開發快速上手Tutorial1: mbed開發快速上手
Tutorial1: mbed開發快速上手
 
Eeprom
EepromEeprom
Eeprom
 
艾鍗學院-健康照護手環
艾鍗學院-健康照護手環艾鍗學院-健康照護手環
艾鍗學院-健康照護手環
 
家庭醫療系統 PCMH
家庭醫療系統 PCMH家庭醫療系統 PCMH
家庭醫療系統 PCMH
 
Microprocessor 8085 architecture ppt. april 2013
Microprocessor 8085 architecture ppt. april 2013Microprocessor 8085 architecture ppt. april 2013
Microprocessor 8085 architecture ppt. april 2013
 
Number system conversion
Number system conversionNumber system conversion
Number system conversion
 
G. ripple counter
G. ripple counterG. ripple counter
G. ripple counter
 
貫通物聯網每一哩路 with Microsfot Azure IoT Sutie
貫通物聯網每一哩路 with Microsfot Azure IoT Sutie貫通物聯網每一哩路 with Microsfot Azure IoT Sutie
貫通物聯網每一哩路 with Microsfot Azure IoT Sutie
 
Project Humix overview
Project Humix overviewProject Humix overview
Project Humix overview
 
Conversion of number system
Conversion of number systemConversion of number system
Conversion of number system
 
程式設計首日封
程式設計首日封程式設計首日封
程式設計首日封
 
encoder and decoder in digital electronics
encoder and decoder in digital electronicsencoder and decoder in digital electronics
encoder and decoder in digital electronics
 

Similaire à 艾鍗學院單晶片韌體-I2C EEPROM 操作

艾鍗學院-單晶片韌體-CC2500通訊實驗
艾鍗學院-單晶片韌體-CC2500通訊實驗艾鍗學院-單晶片韌體-CC2500通訊實驗
艾鍗學院-單晶片韌體-CC2500通訊實驗艾鍗科技
 
networking performance
networking performancenetworking performance
networking performance朋 王
 
接口芯片
接口芯片接口芯片
接口芯片jugn
 
第7章 常用接口芯片
第7章 常用接口芯片第7章 常用接口芯片
第7章 常用接口芯片jugn
 
Wbm9000动态库说明L
Wbm9000动态库说明LWbm9000动态库说明L
Wbm9000动态库说明Lguest8eab39bd
 
Arduino 習作工坊 - Lesson 4 通訊之夜
Arduino 習作工坊 -  Lesson 4 通訊之夜Arduino 習作工坊 -  Lesson 4 通訊之夜
Arduino 習作工坊 - Lesson 4 通訊之夜CAVEDU Education
 
数字电路复习
数字电路复习数字电路复习
数字电路复习zhaowmm
 
第18讲 Hdlc和Ppp
第18讲 Hdlc和Ppp第18讲 Hdlc和Ppp
第18讲 Hdlc和PppF.l. Yu
 
智慧家庭 簡報
智慧家庭 簡報智慧家庭 簡報
智慧家庭 簡報艾鍗科技
 
0416 Windows Server 2008 Native IPv6 新功能介紹
0416 Windows Server 2008 Native IPv6 新功能介紹0416 Windows Server 2008 Native IPv6 新功能介紹
0416 Windows Server 2008 Native IPv6 新功能介紹Timothy Chen
 

Similaire à 艾鍗學院單晶片韌體-I2C EEPROM 操作 (13)

艾鍗學院-單晶片韌體-CC2500通訊實驗
艾鍗學院-單晶片韌體-CC2500通訊實驗艾鍗學院-單晶片韌體-CC2500通訊實驗
艾鍗學院-單晶片韌體-CC2500通訊實驗
 
networking performance
networking performancenetworking performance
networking performance
 
接口芯片
接口芯片接口芯片
接口芯片
 
第7章 常用接口芯片
第7章 常用接口芯片第7章 常用接口芯片
第7章 常用接口芯片
 
Ch2 1
Ch2 1Ch2 1
Ch2 1
 
Wbm9000动态库说明L
Wbm9000动态库说明LWbm9000动态库说明L
Wbm9000动态库说明L
 
Arduino 習作工坊 - Lesson 4 通訊之夜
Arduino 習作工坊 -  Lesson 4 通訊之夜Arduino 習作工坊 -  Lesson 4 通訊之夜
Arduino 習作工坊 - Lesson 4 通訊之夜
 
数字电路复习
数字电路复习数字电路复习
数字电路复习
 
第18讲 Hdlc和Ppp
第18讲 Hdlc和Ppp第18讲 Hdlc和Ppp
第18讲 Hdlc和Ppp
 
智慧家庭 簡報
智慧家庭 簡報智慧家庭 簡報
智慧家庭 簡報
 
第6章
第6章第6章
第6章
 
10 存储系统02
10 存储系统0210 存储系统02
10 存储系统02
 
0416 Windows Server 2008 Native IPv6 新功能介紹
0416 Windows Server 2008 Native IPv6 新功能介紹0416 Windows Server 2008 Native IPv6 新功能介紹
0416 Windows Server 2008 Native IPv6 新功能介紹
 

Plus de 艾鍗科技

TinyML - 4 speech recognition
TinyML - 4 speech recognition TinyML - 4 speech recognition
TinyML - 4 speech recognition 艾鍗科技
 
Appendix 1 Goolge colab
Appendix 1 Goolge colabAppendix 1 Goolge colab
Appendix 1 Goolge colab艾鍗科技
 
Project-IOT於餐館系統的應用
Project-IOT於餐館系統的應用Project-IOT於餐館系統的應用
Project-IOT於餐館系統的應用艾鍗科技
 
02 IoT implementation
02 IoT implementation02 IoT implementation
02 IoT implementation艾鍗科技
 
Tiny ML for spark Fun Edge
Tiny ML for spark Fun EdgeTiny ML for spark Fun Edge
Tiny ML for spark Fun Edge艾鍗科技
 
2. 機器學習簡介
2. 機器學習簡介2. 機器學習簡介
2. 機器學習簡介艾鍗科技
 
5.MLP(Multi-Layer Perceptron)
5.MLP(Multi-Layer Perceptron) 5.MLP(Multi-Layer Perceptron)
5.MLP(Multi-Layer Perceptron) 艾鍗科技
 
心率血氧檢測與運動促進
心率血氧檢測與運動促進心率血氧檢測與運動促進
心率血氧檢測與運動促進艾鍗科技
 
利用音樂&情境燈幫助放鬆
利用音樂&情境燈幫助放鬆利用音樂&情境燈幫助放鬆
利用音樂&情境燈幫助放鬆艾鍗科技
 
IoT感測器驅動程式 在樹莓派上實作
IoT感測器驅動程式在樹莓派上實作IoT感測器驅動程式在樹莓派上實作
IoT感測器驅動程式 在樹莓派上實作艾鍗科技
 
無線聲控遙控車
無線聲控遙控車無線聲控遙控車
無線聲控遙控車艾鍗科技
 
最佳光源的研究和實作
最佳光源的研究和實作最佳光源的研究和實作
最佳光源的研究和實作 艾鍗科技
 
無線監控網路攝影機與控制自走車
無線監控網路攝影機與控制自走車無線監控網路攝影機與控制自走車
無線監控網路攝影機與控制自走車 艾鍗科技
 
Reinforcement Learning
Reinforcement LearningReinforcement Learning
Reinforcement Learning艾鍗科技
 
人臉辨識考勤系統
人臉辨識考勤系統人臉辨識考勤系統
人臉辨識考勤系統艾鍗科技
 
智慧家庭Smart Home
智慧家庭Smart Home智慧家庭Smart Home
智慧家庭Smart Home艾鍗科技
 

Plus de 艾鍗科技 (20)

TinyML - 4 speech recognition
TinyML - 4 speech recognition TinyML - 4 speech recognition
TinyML - 4 speech recognition
 
Appendix 1 Goolge colab
Appendix 1 Goolge colabAppendix 1 Goolge colab
Appendix 1 Goolge colab
 
Project-IOT於餐館系統的應用
Project-IOT於餐館系統的應用Project-IOT於餐館系統的應用
Project-IOT於餐館系統的應用
 
02 IoT implementation
02 IoT implementation02 IoT implementation
02 IoT implementation
 
Tiny ML for spark Fun Edge
Tiny ML for spark Fun EdgeTiny ML for spark Fun Edge
Tiny ML for spark Fun Edge
 
Openvino ncs2
Openvino ncs2Openvino ncs2
Openvino ncs2
 
Step motor
Step motorStep motor
Step motor
 
2. 機器學習簡介
2. 機器學習簡介2. 機器學習簡介
2. 機器學習簡介
 
5.MLP(Multi-Layer Perceptron)
5.MLP(Multi-Layer Perceptron) 5.MLP(Multi-Layer Perceptron)
5.MLP(Multi-Layer Perceptron)
 
3. data features
3. data features3. data features
3. data features
 
心率血氧檢測與運動促進
心率血氧檢測與運動促進心率血氧檢測與運動促進
心率血氧檢測與運動促進
 
利用音樂&情境燈幫助放鬆
利用音樂&情境燈幫助放鬆利用音樂&情境燈幫助放鬆
利用音樂&情境燈幫助放鬆
 
IoT感測器驅動程式 在樹莓派上實作
IoT感測器驅動程式在樹莓派上實作IoT感測器驅動程式在樹莓派上實作
IoT感測器驅動程式 在樹莓派上實作
 
無線聲控遙控車
無線聲控遙控車無線聲控遙控車
無線聲控遙控車
 
最佳光源的研究和實作
最佳光源的研究和實作最佳光源的研究和實作
最佳光源的研究和實作
 
無線監控網路攝影機與控制自走車
無線監控網路攝影機與控制自走車無線監控網路攝影機與控制自走車
無線監控網路攝影機與控制自走車
 
Reinforcement Learning
Reinforcement LearningReinforcement Learning
Reinforcement Learning
 
Linux Device Tree
Linux Device TreeLinux Device Tree
Linux Device Tree
 
人臉辨識考勤系統
人臉辨識考勤系統人臉辨識考勤系統
人臉辨識考勤系統
 
智慧家庭Smart Home
智慧家庭Smart Home智慧家庭Smart Home
智慧家庭Smart Home
 

艾鍗學院單晶片韌體-I2C EEPROM 操作