You can use the get function on the i2c object to see the available properties. In the first example shown in Transmitting Data Over the I2C Interface, which uses the Aardvark board, the syntax would be:
The following shows the output of the get from that example.
For the example using a NI-845x board, as shown in the NI-845x section of Configuring I2C Communication, you see the following output.
Interface-specific properties that can be used with the i2c object include:
|BitRate||Must be a positive, nonzero value specified in kHz. The adaptor and chips determine the rate. The default is 100 kHz for both the Aardvark and NI-845x adaptors.|
|TargetPower||Aardvark only. Can be specified as none or both. The value both means to power both lines, if supported. The value none means power no lines, and is the default value.|
|PullupResistors||Can be specified as none or both.
The value both enables 2k pullup resistors to protect
hardware in the I2C device, if supported. This is the default value. |
Devices may differ in their use of pullups. The Aardvark adaptor and the NI-8452 adaptor have internal pullup resistors to tie both bus lines to VDD and can be programmatically set. The NI-8451 does not have internal pullup resistors that can be programmatically set, and so require external pullups. Consult your device documentation to ensure that the correct pullups have been used.
|BoardSerial||Unique identifier of the I2C master communication device.|
|Vendor||Use to create i2c object. Must be set to aardvark, for use with Aardvark adaptor, or NI845x for use with the NI-845x adaptor.|
|BoardIndex||Use to create i2c object. Specifies the board index of the hardware. Usually set to 0.|
|RemoteAddress||Use to create i2c object. Specifies the
remote address of the hardware. Specified as a string when you create
the i2c object. For example, to specify the remote
address of 50 hex, use '50h'. |
Read the documentation of the chip in order to know what the remote address is. You can also see what the remote address of the chip is by scanning for instruments in the Test & Measurement Tool. In the tool, right-click the I2C node and select Scan for I2C adaptors. Any chips found by the scan is listed in the hardware tree. The listing includes the remote address of the chip.
All the I2C interface-specific properties work for both adaptor boards, except for TargetPower, which is Aardvark only.
The properties Vendor, BoardIndex, and RemoteAddress are used when you create the object, as shown in Transmitting Data Over the I2C Interface. The property BoardSerial is read-only. The BitRate, TargetPower, and PullupResistors properties can be set at any time after the object is created.
After you create the I2C object, you can set properties on it, as follows:
set(i2cobj, BitRate, 75)
In this case, i2cobj is the name of the object, and you are changing the BitRate from the default of 100 kHz to 75 kHz.
Note that you can alternately use the .dot notation syntax, as follows:
i2cobj.BitRate = 75
The other two properties that you can set are strings, so they would be set as follows:
set(i2cobj, 'TargetPower', 'both')
In this case, i2cobj is the name of the object, and you are changing the TargetPower from the default of none to both. Note that TargetPower is only available using the Aardvark board, and does not apply to the NI-845x board.