inter-integrated circuit&ir mlx90614 in ccs

17
Inter-Integrated Circuit & IR MLX90614 IN CCS NYUST ME Robotic Embedded Systems Lab 陳陳陳

Upload: em330

Post on 27-Apr-2015

638 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Inter-Integrated Circuit&IR MLX90614 IN CCS

Inter-Integrated Circuit&

IR MLX90614 IN CCS

NYUST MERobotic Embedded Systems Lab

陳明辰

Page 2: Inter-Integrated Circuit&IR MLX90614 IN CCS

Reference

• IICBUS(http://www.i2c-bus.org/i2c-bus/)

• Embedded Systems Academy(http://www.esacademy.com/en/index.html)

• USB2.0 高速周邊裝置設計之實務應用( 許永和 編著 )

Page 3: Inter-Integrated Circuit&IR MLX90614 IN CCS

• 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.

Page 4: Inter-Integrated Circuit&IR MLX90614 IN CCS

• 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

Page 5: Inter-Integrated Circuit&IR MLX90614 IN CCS

• SDA is the Serial DAta line, and SCL is the Serial CLock line.

Page 6: Inter-Integrated Circuit&IR MLX90614 IN CCS

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.

Page 7: Inter-Integrated Circuit&IR MLX90614 IN CCS

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.

Page 8: Inter-Integrated Circuit&IR MLX90614 IN CCS

ACK

• If the address matches, however, the chip will produce a response called the ACKNOWLEDGE signal.

Page 9: Inter-Integrated Circuit&IR MLX90614 IN CCS

DATA

• Once the MCU receives the acknowledge, it can start transmitting or receiving DATA.

Page 10: Inter-Integrated Circuit&IR MLX90614 IN CCS

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.

Page 11: Inter-Integrated Circuit&IR MLX90614 IN CCS

應注意的事項1. 嚴格按照時序圖的要求進行操作2. 若與口線上帶內部上拉電阻的單片機介面

連接,可以不外加上拉電阻。3. 程式中為配合相應的傳輸速率,在對口線

操作的指令後可用 NOP 指令加一定的延時。4. 為了減少意外的干擾信號將 EEPROM 內的

資料改寫可用外部防寫引腳(如果有),或者在 EEPROM 內部沒有用的空間寫入標誌字,每次上電時或復位時做一 次檢測,判斷 EEPROM 是否被意外改寫。

Page 12: Inter-Integrated Circuit&IR MLX90614 IN CCS

IR MLX90614 IN CCS

Page 13: Inter-Integrated Circuit&IR MLX90614 IN CCS

IR MLX90614 IN CCS

Page 14: Inter-Integrated Circuit&IR MLX90614 IN CCS
Page 15: Inter-Integrated Circuit&IR MLX90614 IN CCS
Page 16: Inter-Integrated Circuit&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

Page 17: Inter-Integrated Circuit&IR MLX90614 IN CCS

• tempdata=(((dh&0b1111111)<<8)+dl);• tempdata=(tempdata*2/100)-273;