Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 117 of 909
OCHN(IIC,1,N,baud,1,8,D)
The OCHNcommand is used to set the I²C communication parameters, as follows:
IIC Literal syntax IIC to tell what kind of communication this is
1 Literal value 1, since this is the location of that port
N Literal, not relevant to IIC
baud Bit rate for communication with the IIC device
1 Literal, not relevant to IIC
8 Literal, not relevant to IIC
D Literal, always in data mode for IIC communication
CCHN(IIC,1)
The CCHN(IIC,1)command is simply used to close the I²C communications channel.
PRINT1(arg1,arg2, … ,arg_n)
Where arg is:
IIS Start or restart an IIC command. For IIC devices that require a restart,
simply call the IIS command a second time within a print.
IIP Stop an IIC command.
IIGn Get n bytes from the IIC channel (requires the previous commands to
have provided whatever addressing or command is required for the
device to start sending). The G argument provides the right number of
clock intervals to acquire the data from the IIC device.
RGETCHR1, Var=GETCHR1
Returns data from the IIC device (if available). The data is always in unsigned byte values, so
assign the data to a 16 or 32-bit register first in order to test for special cases.
For example, the value is 0-255 for normal data, which represents all possible values for the
byte. If the value from the GETCHR1 command is -1, it means the buffer is empty.
RLEN1, Var=LEN1
Gets the number of bytes in the receive buffer.
Part 1: Programming: OCHN(IIC,1,N,baud,1,8,D)