I am working on M66 OpenCPU. My application needs lots of GPIO’s.
Evantually I run out of M66 module GPIO’s. So I diceided to use GPIO extender.
I am having MCP23017 from Micrchip. Link here
I am using MCP23017 with IIC protocol.
M66 has openCPU API’s for IIC protocal.But I am not able to get any result out of it.
To start with GPIO extender, I tried it with arduino and played with GPIO extender. And it works
fine. Arduino code is here.
Now I have some doubts. And I will put them as comparitively to get
you idea.
I have used following code
void setup()
{
Wire.begin(); // starts and wake up I2C bus
Wire.beginTransmission(0x20); // MCP23017 slave address
Wire.write(0x00); // IODIRA register
Wire.write(0x00); // set all of port A to outputs
Wire.endTransmission();
Wire.beginTransmission(0x20);
Wire.write(0x01); // IODIRB register
Wire.write(0x00); // set all of port B to outputs
Wire.endTransmission();
}
Above code sets up IIC,writes IODIRA register and make port A pin as output.
void loop()
{
Wire.beginTransmission(0x20);
Wire.write(0x12); // address port A
Wire.write(0x01); // Make Pin 1 HIGH
Wire.endTransmission();
delay(DELY);
Wire.beginTransmission(0x20);
Wire.write(0x12); // address port A
Wire.write(0x00); // Make Pin 1 LOW
Wire.endTransmission();
delay(DELY);
}
Now above code wites to port A and makes pin 1 of port HIFH and then LOW.
Now to implemet all this in M66 OpenCPU, I really dont know out it following API’s.
IF any one has any experience with working of M66 IIC or MCP23017 please help or altleast give some direction.
following API’s I need help about
1.Ql_IIC_Init
2.Ql_IIC_Config
3.Ql_IIC_Write
4.Ql_IIC_WriteRead