Jan,

Have a look at the source your-amforth/common/lib/hardware/i2c.frt
and the comments at the top of the file.

i2c.c! i2c.c@ i2c.n! i2c.n@ i2c.m!n@ already have the i2c.begin and
i2c.end within the respective word. I don't know the Gravitech shield
but if you are sending multiple bytes i2c.n! might be useful.   

Best wishes,
Tristan

On 09Nov18 19:21, Jan Kromhout wrote:
> Hi,
> 
> This is my first step on the I2C road.
> I have a Gravitech shield for the Arduino, that work well.
> The code is very simple, and I have translate it to Forth.
> The display is not working.
> I include the Forth code. What is wrong?
> Thangs for any help.
> 
> Cheers,
> 
> Jan
> 
> \ Gravitech display, I2C Generic
> 
> marker --gravitech--
> 
> $38 constant 7SEG  \ I2C address for 7-Segment
> 
> / Configure 7-Segment to 12mA segment output current, Dynamic mode,
> / and Digits 1, 2, 3 AND 4 are NOT blanked
> 
> : init7SEG
>   7SEG i2c.begin
>     0 7SEG i2c.c!
>     %01000111 7SEG i2c.c!
>   i2c.end
> ;
> 
> : Send7SEG  ( Digit Number )
>   7SEG i2c.begin
>     swap 7SEG i2c.c! \ Digit
>     7SEG i2c.c!      \ Number
>   i2c.end
> ;
> 
> 
> /* Configure 7-Segment to 12mA segment output current, Dynamic mode,
>      and Digits 1, 2, 3 AND 4 are NOT blanked */
> 
>   Wire.beginTransmission(_7SEG);
>   Wire.write(0);
>   Wire.write(B01000111);
>   Wire.endTransmission();
> 
> 
> /***************************************************************************
>  Function Name: Send7SEG
> 
>  Purpose:
>    Send I2C commands to drive 7-segment display.
> ****************************************************************************/
> 
> void Send7SEG (byte Digit, byte Number)
> {
>   Wire.beginTransmission(_7SEG);
>   Wire.write(Digit);
>   Wire.write(Number);
>   Wire.endTransmission();
> }
> 
> 
> _______________________________________________
> Amforth-devel mailing list for http://amforth.sf.net/
> Amforth-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/amforth-devel
> 


_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to