oI2CM Object

Main Index
Object List
Back to top of pageDescription:
 Provides access to a low-speed I2C master port using specific I/O lines.
 The following table lists the size and availability of the oI2CM Object.
 ObjectSizeDescriptionA1A2B1B2C1
oI2CM5 BytesProvides access to a low-speed I2C master port using specific I/O lines.xxxxx
Back to top of pageOperation:
 The oI2CM Object reads/writes data from/to an I2C device connected to the Local I2C Bus. The Local I2C Bus consists of the Local I2C Clock Line, the Local I2C Data Line, and Ground.

The Node property specifies the 7-Bit address of the I2C device with which to communicate. The 7-Bit address is the I2C address that is assigned by the device's manufacturer and is 'hard-wired' into the I2C device.

The Mode property specifies the I2C addressing mode.  Three different I2C addressing modes are supported as well as either an 8-Bit or 16-Bit data transfer. If the I2C device does not use an internal memory/register location, then the Mode property can be set to 2 (cv7bit) which specifies to send only the 7-Bit I2C address. If the I2C device does use an internal memory/register location, then the Mode property can be set to 0 (cv23bit) or 1 (cv10bit) which specifies to send the 7-Bit I2C address followed by a memory/register location of either 16-Bits or 8-Bits respectively (See Mode property table below). The terms cv7bit, cv10bit and cv23bit reflect the total number of bits in the addressing.  Mode cv23bit means use 7Bit Node + 16 bit address locations, cv10bit means use 7Bit Node + 3 significant bits of an 8 bit register address and cv7bit means to use just the 7Bit Node.

The Location property specifies the I2C device's memory/register location and is only used when the Mode property is set to 0 or 1.

The NoInc property specifies if the Location property is increased each time the I2C device is read from or written to. If the NoInc property is set to 0 then the Location property will be increased by the number of bytes specified by the Width property. If the NoInc property is set to 1 then the Location property is left unchanged.

The Width property specifies how many bytes get transferred. If the Width property is set to 0, then 1 byte is transferred. If the Width property is set to 1, then 2 bytes are transferred when the I2C device is read/written.  (See history)

The oI2CM Object has no Operate property. Instead when an oI2CM Object's Value property is read from or written to the oI2CM Object performs all the necessary operations to transfer data to/from the specified I2C device. Once the data has been transferred, the oI2CM Object returns to a dormant state.

For more information on the specifications of individual I2C devices consult the manufacturer's technical information sheets.

Note that the default property (Value) of the oI2CM Object cannot be assigned to a pointer in a virtual circuit.

Back to top of pageProperties:
 

The following table lists the properties of the oI2CM Object:

Property

Description

Value
A value that indicates the contents of the I2C device. When read, the value within the I2C device will be returned. When written, the value is stored into the I2C device.
Object Class: oProperty Value Range:0 - 255 (When Width = 0)
0 - 65535 (When Width = 1)
Data Type: Numeric Default Value: 0
Node
A value that specifies the I2C address to be used.
Object Class: oVar7 Value Range: 0 - 127
Data Type: Numeric Default Value: 0
Location
A value that specifies the I2C location to be used.
Object Class: oVar1 Value Range: 0 - 65535
Data Type: Numeric Default Value: 0
Mode
A value that selects the I2C mode to use.
Object Class: oSelect0to3 Value Range: 0 - 3
Data Type: Numeric Default Value: 0
ModeConstantDescription
0cv23BitThe oI2CM Object will use 7 bit Node + 16 bit Location addresses to access the device.
1cv10BitThe oI2CM Object will use 7 bit Node + 8 bit Location addresses to access the device.
2cv7BitThe oI2CM Object will use 7 bit Node only.
3 None
NoInc
A value that selects if the location property will not be incremented each time the Value property is read or written.
Object Class: oSelect0to1L Value Range: 0 - 1
Data Type: Numeric Default Value: 0
NoIncConstantDescription
0cvFalseThe oI2CM Object increments the Location property each time the Value property is read or written
1cvTrueThe oI2CM Object does not increment the Location property each time the Value property is read or written
Width
A value that selects the number of bytes to read/write
Object Class: oSelect0to1 Value Range: 0 - 1
Data Type: Numeric Default Value: 0
WidthConstantDescription
0cv8BitThe oI2CM Object will read and write 8 bits at a time
1cv16BitThe oI2CM Object will read and write 16 bits at a time (see history)
Address
Returns a pointer to the address of the oCounter Object instance.
Object Class: oAddress Value Range: 0 - 127
Data Type:Pointer (Read Only) Default Value: Address of Object

Back to top of page Related Items:

 The following table lists objects that use the oI2CM Object.
 ObjectDescriptionA1A2B1B2C1
oEEPromProvides access to an I2C EEPROM memory.xxxxx
Back to top of page Version History and Bug List:
 Firmware Ver A1: Introduced.

Bugs:
Firmware B.2 introduced a bug where 16 bit values cannot be written/read reliably.
Firmware C.1 fixed.


ooPIC Compiler Ver 6.0 (c) Copyright 1997 - 2007 Savage Innovations, LLC.