Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
1 ratings:
 5 out of 5     Rate this Document

845x I2C Examples Always Return a Zero For The First Byte

Hardware: Industrial Communications

Problem:
When I run the I2C shipping examples in LabVIEW, I always read a zero for the first byte. How can I avoid this?

Solution:
The I2C examples currently use a 16-bit address scheme for the writes and reads; the 8-bit address of the I2C controller is written to the first address byte, and a zero to the second address byte. Because of this, there is always a zero in the first byte if you have an I2C controller that uses 8-bit (word) addressing. To avoid reading a zero for the first byte, you can modify the example to use an 8-bit address scheme by following the steps below:
  1. Right-click on the EEPROM starting address control on the block diagram, and select Representation » Unsigned Byte (U8) to change the representation to an 8-bit unsigned integer.
  2. Delete the wires going into the build array function, and reduce it to expose only two inputs.
  3. Next delete the split number function, and remove any broken wires.
  4. Wire the EEPROM starting address output to the first input of the build array function, and the output of the for loop to the second input.
The example program attached below, which can be viewed in LabVIEW 7.1 and higher, demonstrates this solution.

Related Links:
Developer Zone Tutorial: I2C Bus Overview


Attachments:


Microchip 24LC512 Write.vi


Report Date: 03/28/2006
Last Updated: 10/29/2008
Document ID: 3VRGOM5N

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit