Re: [Amforth] I2C Generic

2018-11-10 Thread Jan Kromhout
Tristan,

I have tried that. No results. Monday I get an Logic Analyser so I can watch 
the I2C bus. Hopefully can I figure out what is wrong.

Cheers,

Jan


> Op 10 nov. 2018, om 21:23 heeft Tristan Williams  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  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
 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
>> 
>> 
>> ___
>> 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



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

Re: [Amforth] I2C Generic

2018-11-10 Thread Tristan Williams
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  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
> >> 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
> 
> 
> ___
> 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


Re: [Amforth] I2C Generic

2018-11-10 Thread Erich Wälde
Hello Jan,

> The i2c scanner is seeing $38, should i still shift to $70?
Don't be afraid of just trying this. There is nothing that
breaks, if you happen to use a different i2c address.

So I dont' think so, but let me check

> | $ ls -l /dev/ttyUSB0 
> | crw-rw 1 root dialout 188, 0 2018-11-10 18:33 /dev/ttyUSB0
> | $ minicom -wo -b 115200 -D /dev/ttyUSB0
> |  ok
> | > +i2c
> |  ok
> | > hex i2c.scan
> |  50
> |  ok
> | > i2c_addr_rtc .
> | 50  ok
> | > i2c.detect
> |   0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
> |  0:   -- -- -- -- -- -- -- -- --
> | 10:  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> | 20:  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> | 30:  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> | 40:  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> | 50:  50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> | 60:  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> | 70:  -- -- -- -- -- -- -- --
> |  ok

In that case the address is good. At least as long as you
use your-amforth/trunk/common/lib/hardware/i2c.frt and its
includes.

Dealing with unresponsive hardware is always a little
challenging, because you don't /see/ anything for a long time.
A few ideas:
- does the hw work with another program? (then the hw is good)
- can you successfully talk to another component on the i2c?
- can you add an LED to SCL and SDA and see, whether both are
  blinking when accessing the bus? Kind of poor mans
  oscilloscope ...
- did you check that the TWI unit is initialized correctly?
- did you try a different bus speed, eg. 100 kHz instead of 400?
- does your code read the ACKs on the bus correctly (yes, if you
  use the above mentioned libs)
- none of the above ...

Things like that. Don't despair! And don't panic either :-)

It took me something like a month to get a 434 MHz radio link to
work. Mainly because i didn't /see/ anything! In the end a 20 Eu
TV USB dongle and gnuradio made me see the signal.


Cheers,
Erich




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


Re: [Amforth] Clock Works

2018-11-10 Thread Erich Wälde
Hello Jan,

> Where can I download the software of the articles of Clock Works.
> The link https://wiki.forth-ev.de/doku.php/projects:clockworks ...

Thanks for reminding me, that there is a broken link in the
game. This one is better:

https://wiki.forth-ev.de/doku.php/projects:clockworks:clockworks

Note the additional ":clockworks"

But at the end it /should/ point to

http://amforth.sourceforge.net/Projects/ClockWorks/index.html

anyway. This is where the complete source code ist available.

So I need to fix the page on wiki.forth-ev.de a little.



Cheers,
Erich


-- 
May the Forth be with you ...


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


Re: [Amforth] Clock Works

2018-11-10 Thread Jan Kromhout via Amforth-devel
Hello,

Find the source!!

Cheers,

Jan



> Op 10 nov. 2018, om 16:26 heeft Jan Kromhout via Amforth-devel 
>  het volgende geschreven:
> 
> Hello,
> 
> Where can I download the software of the articles of Clock Works.
> The link https://wiki.forth-ev.de/doku.php/projects:clockworks 
>  gives the message.
> 
> 
> 
> Dieses Thema existiert noch nicht
> 
> Cheers,
> 
> Jan
> ___
> 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


Re: [Amforth] I2C Generic

2018-11-10 Thread Jan Kromhout via Amforth-devel
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  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
>> 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


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


Re: [Amforth] I2C Generic

2018-11-10 Thread Tristan Williams
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