| | pbLua PCF8574
|
| Hi, has anybody successfully tried to read ports from I2C connected PCF8574 with pbLua (Beta-8) ? Writing and setting ports is no problem, but reading ports fails. The return value is every times 0 (not NIL) Any idea ? Thanks in advance Bye (...) (18 years ago, 18-May-07, to lugnet.robotics.nxt, lugnet.robotics.nxt.nxthacking)
| | | | Re: pbLua PCF8574
|
| (...) No ideas yet, Christian. I do have a Mindsensors kit here to look at over the weekend. Are you SURE you are sending the correct string to read the registers? Can you post the code you're using for the test here? Cheers, Ralph (18 years ago, 19-May-07, to lugnet.robotics.nxt, lugnet.robotics.nxt.nxthacking)
| | | | Re: pbLua PCF8574
|
| (...) Hi Ralph, we are using this code: collectgarbage( "setpause", 110 ); function setupI2C(port) nxt.InputSetType(port,2) nxt.InputSetDir(port,1,1) nxt.InputSetState(port,1,1) nxt.I2CTimer(3) nxt.I2CInitPins(port) end function ReadPCF(port) (...) (18 years ago, 19-May-07, to lugnet.robotics.nxt, lugnet.robotics.nxt.nxthacking)
| | | | Re: pbLua PCF8574 SOLVED
|
| (...) Hi, we solved the problem... Lego-Firmware has own brain and handle read/write with own mechanisms ;-( The last read/write bit is handled automatically by lowlevel routines. Reading the same address like writing solves the problem. (...) (18 years ago, 21-May-07, to lugnet.robotics.nxt, lugnet.robotics.nxt.nxthacking)
| | | | Re: pbLua PCF8574 SOLVED ?
|
| (...) Hi, or was it a quirk at my brain to address the i2c-read-address and hope to receive usefull data ? Currently it works for me when using allways the i2c-write address... Are the any demos or samples for NXC, using the PCF8574 ? 1. setting (...) (18 years ago, 21-May-07, to lugnet.robotics.nxt, lugnet.robotics.nxt.nxthacking)
| | | | RE: pbLua PCF8574 SOLVED ?
|
| (...) This is the excepted behavior. When you want to read from I2C device, the NXT firmware first sends a write message to load the internal index "pointer" for the I2C device and then sends a read message that will read the requested number of (...) (18 years ago, 21-May-07, to lugnet.robotics.nxt, lugnet.robotics.nxt.nxthacking)
| | | | Re: pbLua PCF8574 SOLVED !
|
| (...) Hi Dick, your answer solves my knot :D It's a NXT specific behaviour and all alternatives NXT-OSes which uses original Lego-Source-Lowlevel routines have this feature ? Thanks for your answer Bye Christian (18 years ago, 21-May-07, to lugnet.robotics.nxt, lugnet.robotics.nxt.nxthacking)
| | | | Re: pbLua PCF8574 SOLVED !
|
| (...) Let me say thanks to Dick as well. I think that the NXT firmware does what's called a repeat start in the I2C definition... Here's the part in the I2C spec that is required: (URL) And with pictures: (URL) Hope this helps... Ralph (18 years ago, 21-May-07, to lugnet.robotics.nxt, lugnet.robotics.nxt.nxthacking)
| |