Hi Forum,
I'm looking to the readme file of MOD-IO2 examples, it list the functional codes available. For analog read there are four codes available 0x10, 0x11, 0x12, 0x13, 0x17 each of them related to a pin.
What I cannot found is how set the pins in analog mode, in other words how set the ANSELA register to declare which input pins are analog and which are digitals.
Does the ANSELA register is set automatically once used an analog read functional code?
If I look to the source code of the MOD-IO2 I cannot found the analog functional code
switch(command
{
case SET_TRIS: CommandSetTris(); break;
case SET_LAT: CommandSetLat(); break;
case GET_PORT: CommandGetPort(); break;
case SET_PU: CommandSetPullUps(); break;
case SET_REL: CommandSetRelay(); break;
case SET_ADDRESS: CommandSetAddress(); break;
default: break;
}
Thanks.
Regards,
Dario.
I was looking for an old example, while requesting an analog read the pin is set as analog input.
There is one fix that shall be applied to the README file of the MOD-IO2+OLinuXino example, for GET_PORT function is reported to perform two reads, first with arguments (address0, address1, address2, command) and later read for get the data.
In the real case the first command is a write (address+W) with such arguments and then a read to get data.
Regards,
Dario.
New question, for MOD-IO this time. Where I can found a reference manual with supported commands as per MOD-IO2?
Thanks,
Dario.
Hey Dario,
It is in the firmware archive in README.txt: https://www.olimex.com/Products/Modules/IO/MOD-IO/resources/MOD-IO(I2C-Slave)_v1.02.zip (https://www.olimex.com/Products/Modules/IO/MOD-IO/resources/MOD-IO(I2C-Slave)_v1.02.zip).
Best regards,
Lub/OLIMEX