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 <h...@tjnw.co.uk<mailto:h...@tjnw.co.uk>> het volgende geschreven: 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_Interface will help a lot, as will starting with a simple SPI device (e.g. io expander, digital potentiometer) first. Kind regards, Tristan Verstuurd vanaf mijn iPad Op 7 jun. 2019 om 17:25 heeft Tristan Williams <h...@tjnw.co.uk<mailto:h...@tjnw.co.uk>> het volgende geschreven: 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 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 simple example? The interface is using the standard pins for the SPI. I mark the part of the code with <===========? where I have trouble to convert to amForth. Thanks for any help. Cheers, Jan #include "SPI.h" #define SCK_PIN 13 #define MISO_PIN 12 #define MOSI_PIN 11 #define SS_PIN 10 void umFPU_begin(void) { digitalWrite(SS_PIN, HIGH); pinMode(SS_PIN, OUTPUT); umFPU_reset(); } //------------------- reset ------------------------------------------------- void umFPU_reset() { digitalWrite(SS_PIN, LOW); // disable SPI.Master SPI.end(); <===========? // reset the FPU digitalWrite(MOSI_PIN, HIGH); for (byte i = 0; i < 80; i++) { digitalWrite(SCK_PIN, HIGH); digitalWrite(SCK_PIN, LOW); } digitalWrite(MOSI_PIN, LOW); delay(10); // enable SPI.Master SPI.setDataMode(SPI_MODE0); SPI.setBitOrder(MSBFIRST); SPI.setClockDivider(SPI_CLOCK_DIV4); SPI.begin(); <===========? digitalWrite(SS_PIN, HIGH); } byte umFPU_read(void) { byte bval; digitalWrite(SS_PIN, LOW); umFPU_readDelay(); bval = SPI.transfer(0); <===========? digitalWrite(SS_PIN, HIGH); return bval; } void umFPU_write_1(byte b1) { digitalWrite(SS_PIN, LOW); SPI.transfer(b1); <===========? digitalWrite(SS_PIN, HIGH); } _______________________________________________ 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