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

Re: [Amforth] Need some help to construct an .asm file

2018-12-25 Thread Jan Kromhout via Amforth-devel
Thanks for the rsponse. Merry Christmad, Jan Verstuurd vanaf mijn iPad > Op 25 dec. 2018 om 10:36 heeft Matthias Trute het volgende > geschreven: > > Am Montag, den 24.12.2018, 17:51 + schrieb Jan Kromhout: >> Hello, >> >> I wont to write my own routine in assembler as a learning goal.

Re: [Amforth] Need some help to construct an .asm file

2018-12-25 Thread Matthias Trute
Am Montag, den 24.12.2018, 17:51 + schrieb Jan Kromhout: > Hello, > > I wont to write my own routine in assembler as a learning goal. > Have looked into a lot of asm routines, but can’t figure out how to > add two doubles into R16 to R23 > and after the calculation put R16 to R19 back to the s

[Amforth] Need some help to construct an .asm file

2018-12-24 Thread Jan Kromhout
Hello, I wont to write my own routine in assembler as a learning goal. Have looked into a lot of asm routines, but can’t figure out how to add two doubles into R16 to R23 and after the calculation put R16 to R19 back to the stack. Can I use R16 to R19 freely for my own use, or should I take anot

Re: [Amforth] Need some help

2018-10-29 Thread Erich Wälde
Hello Jan, Jan Kromhout writes: > Hi, > > I have this simple Arduino program thats put a PWM signal to port 9 of the > Arduino. > Checked with my RIGOL and the PWM is changed when I change the value of ppm. > > #define PWM_A 9 /* Pin-9 on Arduino Board */ > > void setup() { > Serial.begin(115

Re: [Amforth] Need some help

2018-10-29 Thread Matthias Trute
> : PWM_init > PWM_A pin_output \ Set pin 9 (PB1) to output > %1010 TCCR1A c!\ Store constant > %00010001 TCCR1B c!\ Store constant This stores a byte, &400 is beyond 8bits. Try ! instead > &400 OCR1A c! \ Store constant Matthias _

[Amforth] Need some help

2018-10-29 Thread Jan Kromhout
Hi, I have this simple Arduino program thats put a PWM signal to port 9 of the Arduino. Checked with my RIGOL and the PWM is changed when I change the value of ppm. #define PWM_A 9 /* Pin-9 on Arduino Board */ void setup() { Serial.begin(115200); int pwm = 200; /* duty 50% */ pinMode(P

Re: [Amforth] need some help

2012-05-31 Thread Matthias Trute
Hi Jan, > > Hi Mathias, I have include in to the "dict_appl.inc" the last two words. > .include "dict_interrupt.inc" > .include "dict_usart.inc" > .include "dict_wl.inc" > .include "dict_minimum.inc" > .include "words/2to_r.asm" > .include "words/2r_from.asm" Final-New-Line missing? The assembl

Re: [Amforth] need some help

2012-05-31 Thread Jan Kromhout
asm" But when I load the case.frt then the words 2r> and 2>r are not recognise. Can you tell me what I do wrong? Thanks. Cheers, Jan > Date: Thu, 31 May 2012 19:53:27 +0200 > From: mtr...@web.de > To: amforth-devel@lists.sourceforge.net > Subject: Re: [Amforth] need some h

Re: [Amforth] need some help

2012-05-31 Thread Matthias Trute
Hi Jan, > It is working. Fine :=) > > How can I figure out wich words are not include? Good question. I see it the other way: What words are included? For that I usually consolt the inc-files that are usede (mostly dict_appl.inc and dict_appl_core.inc). The inc files in the core/ directory ar

Re: [Amforth] need some help

2012-05-30 Thread Jan Kromhout
Hi Mathias, Thanks for this. It is working. How can I figure out wich words are not include? Cheers, Jan kromhout Sacharovlaan 3 3223HM Hellevoetsluis-NL Op 30 mei 2012 om 21:08 heeft Matthias Trute het volgende geschreven: > Hi Jan, > >> Hello, I wont to include 2 asm files.It is for me t

Re: [Amforth] need some help

2012-05-30 Thread Matthias Trute
Hi Jan, > Hello, I wont to include 2 asm files.It is for me the first time to > do this.Can someone help me with a sugestion where to place these so > the compiler is taken them. The files are: 2r_from.asm2to_r.asm > Thanks in advance for anny help. edit your dict_appl.inc file and add the lines

[Amforth] need some help

2012-05-30 Thread Jan Kromhout
Hello, I wont to include 2 asm files.It is for me the first time to do this.Can someone help me with a sugestion where to place these so the compiler is taken them. The files are: 2r_from.asm2to_r.asm Thanks in advance for anny help. Cheers, Jan KromhoutHellevoetsluis-NL