inter-integrated circuit&ir mlx90614 in ccs
TRANSCRIPT
Inter-Integrated Circuit&
IR MLX90614 IN CCS
NYUST MERobotic Embedded Systems Lab
陳明辰
Reference
• IICBUS(http://www.i2c-bus.org/i2c-bus/)
• Embedded Systems Academy(http://www.esacademy.com/en/index.html)
• USB2.0 高速周邊裝置設計之實務應用( 許永和 編著 )
• I2C 匯流排是由 PHILIPS 公司開發的兩線式串列匯流排 .
• I2C is an acronym for (Inter - Integrated Circuit) bus.
• Its name literally explains its purpose: to provide a communication link between
Integrated Circuits.
• Reduce wiring on the PCB• Reduce Electromagnetic Interference (EMI)
and Electrostatic Discharge (ESD)• Only two bus lines are required• No strict baud rate requirements like for
instance with RS232• Simple master/slave relationships exist
between all components• Every device hooked up to the bus has its own
unique address• I2C is a true multi-master bus providing
arbitration and collision detection
• SDA is the Serial DAta line, and SCL is the Serial CLock line.
START
• First, the MCU will issue a START condition. This acts as an 'Attention' signal to all of the connected devices. All ICs on the bus will listen to the bus for incoming data.
ADDRESS
• Then the MCU sends the ADDRESS of the device it wants to access, along with an indication whether the access is a Read or Write operation.
• Having received the address, all IC's will compare it with their own address. If it doesn't match, they simply wait until the bus is released by the stop condition.
ACK
• If the address matches, however, the chip will produce a response called the ACKNOWLEDGE signal.
DATA
• Once the MCU receives the acknowledge, it can start transmitting or receiving DATA.
STOP
• When all is done, the MCU will issue the STOP condition. This is a signal that the bus has been released and that the connected ICs may expect another transmission to start any moment.
應注意的事項1. 嚴格按照時序圖的要求進行操作2. 若與口線上帶內部上拉電阻的單片機介面
連接,可以不外加上拉電阻。3. 程式中為配合相應的傳輸速率,在對口線
操作的指令後可用 NOP 指令加一定的延時。4. 為了減少意外的干擾信號將 EEPROM 內的
資料改寫可用外部防寫引腳(如果有),或者在 EEPROM 內部沒有用的空間寫入標誌字,每次上電時或復位時做一 次檢測,判斷 EEPROM 是否被意外改寫。
IR MLX90614 IN CCS
IR MLX90614 IN CCS
• i2c_start(); //1• i2c_write(dev); //2• i2c_write(0x07); //3• i2c_start();//4• i2c_write(dev);//5• dl=i2c_read();//6• dh=i2c_read();//7• pec=i2c_read();//8• i2c_stop();//9
• tempdata=(((dh&0b1111111)<<8)+dl);• tempdata=(tempdata*2/100)-273;