Hi, A general question. When I won’t to write I should put a “0” behind the address. Should I do it by hand, or are the words clever enough to do this?
My address => $38 = %0111000 After shifting => %1110000 = $70 Cheers, Jan Op 10 nov. 2018, om 21:23 heeft Tristan Williams <h...@tjnw.co.uk<mailto:h...@tjnw.co.uk>> het volgende geschreven: Jan, This device is need only one byte per command, so I have used i2c.c!. Do you ave a clou? but it might be expecting two single bytes, one immediately after the other. Try Number digit 2 7SEG i2c.n! Best wishes, Tristan On 10Nov18 17:27, Jan Kromhout via Amforth-devel wrote: Tristan, This is my simple code. The address of the SA1064 is $38 I have checked with the arduino for save playing the frequency of the bus should be less than 100 kHz. When I translate the simple code of the arduino to amForth I get this, but no results. Even no results with deleting the begin and end. This device is need only one byte per command, so I have used i2c.c!. Do you ave a clou? Cheers Jan \ Gravitech display, I2C Generic marker --gravitech-- $38 constant 7SEG \ I2C address for 7-Segment PORTC 4 portpin: SDA PORTC 5 portpin: SCA SDA pin_output SCA pin_output : initI2C i2c.init.default ; \ 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! 71 7SEG i2c.c! \ i2c.end ; : Send7SEG ( Number Digit ) \ 7SEG i2c.begin 7SEG i2c.c! \ Digit 7SEG i2c.c! \ Number \ i2c.end ; : test7SEG \ i2c.detect \ 7SEG i2c.begin 0 7SEG i2c.c! %01000111 7SEG i2c.c! \ i2c.end \ 7SEG i2c.begin 1 7SEG i2c.c! \ Digit $7d 7SEG i2c.c! \ Number \ i2c.end ; Op 10 nov. 2018, om 17:15 heeft Tristan Williams <h...@tjnw.co.uk<mailto:h...@tjnw.co.uk>> het volgende geschreven: 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<mailto: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<mailto: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<mailto: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<mailto: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