I replaced my i2c files with those from the trunk r2209 and all of
i2c.c! i2c.c@ i2c.n! i2c.n@ i2c.m!n@ give me what I was expecting.
What I was doing incorrectly below I don't know but perhaps starting
from a completely fresh UNO (as I did above) was part of the
solution. Apologies, I will do that first next time.
Tristan
On 25Jan17 00:37, Tristan Williams wrote:
> Hello,
>
> I am in the process of connecting a keypad to an i2c port expander
> (PCF8574A) to an UNO and have run into the following problem. More
> than likely the problem is my lack of understanding. Writing to the
> port expander appears to be no problem. Reading from it using i2c.>n
> results in the UNO hanging. Writing zero bytes and then reading 1 byte
> using i2c.m>n appears to read the port expander correctly (i.e. 1 0
> $38 i2c.m>n). What am I missing? Edited minicom session below.
>
> Best wishes and thanks,
> Tristan
>
> amforth 6.3 ATmega328P Forthduino
> > i2c.init.default
> ok
> > i2c.detect
> 0 1 2 3 4 5 6 7 8 9 A B C D E F
> 0: -- -- -- -- -- -- -- -- --
> 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 30: -- -- -- -- -- -- -- -- 38 -- -- -- -- -- -- --
> 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 70: -- -- -- -- -- -- -- --
> ok
>
> # turns on each LED attached to the port expander (ports sinking)
> > $00 1 $38 i2c.n>
> ok
>
> # turns off each LED attached to the port expander
> > $ff 1 $38 i2c.n>
> ok
>
> # this hangs the UNO
> > 1 $38 i2c.>n
>
> # (repeating all comands except the one above)
> # this reads the port expander address and leaves $ff on the stack
> > 1 0 $38 i2c.m>n
> ok
>
>
>
>
>
>
>
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> ___
> Amforth-devel mailing list for http://amforth.sf.net/
> Amforth-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/amforth-devel
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel