Re: [Amforth] Need some help with the SPI

2019-06-09 Thread Ian Jefferson
What a nice RTFM! I have some fond memories of working with a capable C programmer on an Atmel Butterfly as a platform.  I relied heavily on the data sheet to understand the capability of the ATmega169 at the time and several times was able to identify paths forward by doing so. We were squeez

Re: [Amforth] Need some help with the SPI

2019-06-09 Thread Erich Wälde
Dear Jan, allow me to observe the following things: > // enable SPI.Master > SPI.setDataMode(SPI_MODE0); > SPI.setBitOrder(MSBFIRST); > SPI.setClockDivider(SPI_CLOCK_DIV4); > SPI.begin(); The words and the concepts behind them are documented in great detail in the datasheet of your contr

Re: [Amforth] Need some help with the SPI

2019-06-09 Thread Peter C. Hauser
Dear Jan, spi.setmode is used to set one of the 4 SPI modes 0, 1, 2, or 3, e.g. "1 spi.setmode". The mode to use depends on the device you want to connect to, and you will find it in the datasheet (perhaps not explicitely stated, but the necessary information will be there). Most common is 0.

Re: [Amforth] Need some help with the SPI

2019-06-09 Thread Jan Kromhout
Dear Peter This is the code I need to model in amForth // enable SPI.Master SPI.setDataMode(SPI_MODE0); SPI.setBitOrder(MSBFIRST); SPI.setClockDivider(SPI_CLOCK_DIV4); SPI.begin(); What to do with \ check SPI device datasheet for mode settings : spi.setmode ( spi-mode -- ) spi.mode pin

Re: [Amforth] Need some help with the SPI

2019-06-08 Thread Matthias Trute
Hi, > You can also use the following words to avoid c!@spi, which is > missing from the preassembled package for the Arduino: > > > \ send a byte, ignore received byte > : c!spi ( c -- ) > SPDR c! ( c addr -- ) > ; > > \ receive a byte, send a dummy one > : c@spi ( -- c) > 0 SPDR c! 1

Re: [Amforth] Need some help with the SPI

2019-06-08 Thread Peter C. Hauser
Jan, You can also use the following words to avoid c!@spi, which is missing from the preassembled package for the Arduino: \ send a byte, ignore received byte : c!spi ( c -- ) SPDR c! ( c addr -- ) ; \ receive a byte, send a dummy one : c@spi ( -- c) 0 SPDR c! 1 ms SPDR c@ ; SPDR is

Re: [Amforth] Need some help with the SPI

2019-06-07 Thread Jan Kromhout via Amforth-devel
Hello Tristan, That’s nice. Please can you explain how to do it? I know that there are some article thats describe also how to compile forth under windows. It had a simple guideline. I have that uses for playing with the fp packages. And that was working fine. But I have removed is from my compu

Re: [Amforth] Need some help with the SPI

2019-06-07 Thread Tristan Williams
Hello Jan, Erich puts the case for being able to build AmForth very well. I build AmForth on OS X if that is of any help. Kind regards, Tristan On 07Jun19 21:37, Erich Wälde wrote: > Hello Jan, > > Jan Kromhout via Amforth-devel writes: > > > Hello Tristan,Erich > > > > This is far over my

Re: [Amforth] Need some help with the SPI

2019-06-07 Thread Erich Wälde
Hello Jan, Jan Kromhout via Amforth-devel writes: > Hello Tristan,Erich > > This is far over my knowledge, but will give it a try. > > But when I try to load the spi.frt I get an error here > > |C| 97|\ send a byte, ignore recieved byte > |S| 98|: c!spi ( c -- ) > |S| 99|c!@spi drop > |

Re: [Amforth] Need some help with the SPI

2019-06-07 Thread Jan Kromhout via Amforth-devel
Hello Tristan,Erich This is far over my knowledge, but will give it a try. But when I try to load the spi.frt I get an error here |C| 97|\ send a byte, ignore recieved byte |S| 98|: c!spi ( c -- ) |S| 99|c!@spi drop |E= ?? -13 6 Is this also a assembler word? Kindly regards, Jan

Re: [Amforth] Need some help with the SPI

2019-06-07 Thread Erich Wälde
Hello Jan, Jan Kromhout writes: > Hi Tristan, > > What to load in the right sequence to fellow the examples in > http://amforth.sourceforge.net/TG/recipes/SPI.html ? > If I have the right sequence of loading the screens I will start as you > mentiod. > > Kind regards, > > Jan > > > > Op 7 jun.

Re: [Amforth] Need some help with the SPI

2019-06-07 Thread Jan Kromhout
Hi Tristan, What to load in the right sequence to fellow the examples in http://amforth.sourceforge.net/TG/recipes/SPI.html ? If I have the right sequence of loading the screens I will start as you mentiod. Kind regards, Jan Op 7 jun. 2019, om 19:25 heeft Tristan Williams mailto:h...@tjnw.c

Re: [Amforth] Need some help with the SPI

2019-06-07 Thread Tristan Williams
Hi Jan, > No don’t have. Why? Because words/spirw.asm provides c!@spi which makes using the hardware spi easier, and it is used in the recipes http://amforth.sourceforge.net/TG/recipes/SPI.html Separately, if you haven't read it already https://en.wikipedia.org/wiki/Serial_Peripheral_Interfac

Re: [Amforth] Need some help with the SPI

2019-06-07 Thread Jan Kromhout via Amforth-devel
Hello Tristan, No don’t have. Why? Verstuurd vanaf mijn iPad > Op 7 jun. 2019 om 17:25 heeft Tristan Williams het volgende > geschreven: > > Hello Jan, > > A quick question first. > > You have built your AmForth hex files with words/spirw.asm ? > > Kind regards, > > Tristan > >> On 07Jun

Re: [Amforth] Need some help with the SPI

2019-06-07 Thread Tristan Williams
Hello Jan, A quick question first. You have built your AmForth hex files with words/spirw.asm ? Kind regards, Tristan On 07Jun19 17:06, Jan Kromhout via Amforth-devel wrote: > Hello > > I have take a close look into SPI routines. > I really not understand them. > > I need simple make a conne

Re: [Amforth] Need some help with the SPI

2019-06-07 Thread Peter C. Hauser
Jan, Can I suggest that in order to get to grips with it, rather than starting with the Arduino example, study the data book for the microcontroller to learn how SPI is controlled with the related registers, and then study the SPI words provided with the AmForth package. C/C++/Arduino langua

[Amforth] Need some help with the SPI

2019-06-07 Thread Jan Kromhout via Amforth-devel
Hello I have take a close look into SPI routines. I really not understand them. I need simple make a connection withe the arduino in amForth. The basics I understand how to make a pin high or low etc. But I don’t know how to start to initialize the SPI etc. Can someone help me with this or give a