You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
(5) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
(6) |
Mar
(41) |
Apr
(23) |
May
(11) |
Jun
(2) |
Jul
|
Aug
|
Sep
(9) |
Oct
(2) |
Nov
(1) |
Dec
(1) |
2008 |
Jan
(6) |
Feb
(1) |
Mar
(23) |
Apr
(18) |
May
(21) |
Jun
(13) |
Jul
(34) |
Aug
(5) |
Sep
(1) |
Oct
(4) |
Nov
|
Dec
(4) |
2009 |
Jan
|
Feb
(5) |
Mar
(5) |
Apr
(10) |
May
(1) |
Jun
(11) |
Jul
(1) |
Aug
|
Sep
|
Oct
(2) |
Nov
(3) |
Dec
(13) |
2010 |
Jan
(10) |
Feb
(4) |
Mar
(28) |
Apr
(3) |
May
(38) |
Jun
(22) |
Jul
(92) |
Aug
(154) |
Sep
(218) |
Oct
(45) |
Nov
(20) |
Dec
(1) |
2011 |
Jan
(33) |
Feb
(15) |
Mar
(32) |
Apr
(33) |
May
(48) |
Jun
(35) |
Jul
(7) |
Aug
|
Sep
(11) |
Oct
(5) |
Nov
|
Dec
(7) |
2012 |
Jan
(56) |
Feb
(11) |
Mar
(6) |
Apr
|
May
(128) |
Jun
(59) |
Jul
(21) |
Aug
(16) |
Sep
(24) |
Oct
(39) |
Nov
(12) |
Dec
(12) |
2013 |
Jan
(14) |
Feb
(61) |
Mar
(97) |
Apr
(46) |
May
(13) |
Jun
(23) |
Jul
(12) |
Aug
(25) |
Sep
(9) |
Oct
(81) |
Nov
(73) |
Dec
(45) |
2014 |
Jan
(36) |
Feb
(57) |
Mar
(20) |
Apr
(41) |
May
(43) |
Jun
(11) |
Jul
(14) |
Aug
(32) |
Sep
(9) |
Oct
(27) |
Nov
(21) |
Dec
(6) |
2015 |
Jan
(14) |
Feb
(23) |
Mar
(1) |
Apr
(19) |
May
(40) |
Jun
(11) |
Jul
(1) |
Aug
(2) |
Sep
(14) |
Oct
(10) |
Nov
(9) |
Dec
(13) |
2016 |
Jan
(4) |
Feb
(3) |
Mar
(7) |
Apr
|
May
(4) |
Jun
(13) |
Jul
(8) |
Aug
(3) |
Sep
(4) |
Oct
(1) |
Nov
|
Dec
|
2017 |
Jan
(6) |
Feb
(1) |
Mar
(1) |
Apr
(7) |
May
(10) |
Jun
(5) |
Jul
(7) |
Aug
(9) |
Sep
|
Oct
(1) |
Nov
(5) |
Dec
|
2018 |
Jan
|
Feb
|
Mar
(5) |
Apr
|
May
|
Jun
(3) |
Jul
(6) |
Aug
|
Sep
(2) |
Oct
(54) |
Nov
(47) |
Dec
(53) |
2019 |
Jan
(23) |
Feb
(24) |
Mar
(19) |
Apr
(15) |
May
(5) |
Jun
(34) |
Jul
(9) |
Aug
(9) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
(7) |
Apr
(7) |
May
(5) |
Jun
(15) |
Jul
(22) |
Aug
(28) |
Sep
(13) |
Oct
(9) |
Nov
(17) |
Dec
(13) |
2021 |
Jan
(5) |
Feb
(1) |
Mar
(1) |
Apr
(9) |
May
(21) |
Jun
(9) |
Jul
|
Aug
(6) |
Sep
(16) |
Oct
|
Nov
(1) |
Dec
(6) |
2022 |
Jan
|
Feb
|
Mar
|
Apr
(7) |
May
(6) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(11) |
Sep
(21) |
Oct
(5) |
Nov
(1) |
Dec
(1) |
2024 |
Jan
(1) |
Feb
(4) |
Mar
|
Apr
(7) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
From: Matthias T. <mt...@we...> - 2019-06-17 19:31:24
|
Hi Jan, > I need to do a bitmask on register. The simplest operations are the ones documented in the source file \ Use it this way: \ PORTD 7 portpin: PD.7 ( define portD pin #7) \ PD.7 high ( turn portD pin #7 on, i.e. set it high- level) \ PD.7 low ( turn portD pin #7 off, i.e. set it low- level) \ PD.7 <ms> pulse ( turn portD pin #7 for <ms> high and low) \ the following words are for "real" IO pins only \ PD.7 pin_output ( set DDRD so that portD pin #7 is output) \ PD.7 pin_input ( set DDRD so that portD pin #7 is input) \ PD.7 pin_high? ( true if pinD pin #7 is high) \ PD.7 pin_low? ( true if pinD pin #7 is low) \ These word use only one bit. > In bitnames.frt there is a word bitmask: How can I use it to do > the two actions above? Note that the hex coding is used (a single F means $f) \ multi bit operation \ PORTD F bitmask: PD.F ( define the lower nibble of port d ) \ PD.F pin@ ( get the lower nibble bits ) \ 5 PD.F pin! ( put the lower nibble bits, do not change the others ) A bitmask operates on all bits that are 1 in the bitmask. All others are unaffected, c! would overwrite all bits. Matthias |
From: Erich W. <ew....@na...> - 2019-06-17 19:26:11
|
Hello Jan, > I need to do a bitmask on register. > > These are the constants, and mask > > $24 constant ddrb > $25 constant portb > > \ bit masks > %000100 constant mSS ( PB2 ) > %100000 constant mSCK ( PB5 ) > > I wont > 1. to set the bits in ddrb with the bitmask mSS > 2. to clear bits in portb with the bitmask mSCK > > In bitnames.frt there is a word bitmask: How can I use it to do > the two actions above? > > This is mor as a learning to understand working with bitmask. > > Thanks for any help. There are only 4 lines of text in amforth/trunk/avr8/lib/bitnames.frt > \ multi bit operation > \ PORTD F bitmask: PD.F ( define the lower nibble of port d ) > \ PD.F pin@ ( get the lower nibble bits ) > \ 5 PD.F pin! ( put the lower nibble bits, do not change the others ) There is a functional example on this page http://amforth.sourceforge.net/Projects/ClockWorks/08_timezones.html see "Code Details" and therein "Pins to select timezone" Well, in the end there are only 3 important lines: #include bitnames.frt \ define bits 0 and 1 of PORTA as a bitmask named _tz PORTA $03 bitmask: _tz \ set the pins as "input" _tz pin_input \ read the pins --- they are conncted to pullup resistors \ through switches _tz pin@ the result is either 0 1 2 or 3 in this particular case, depending on which of the two bits read as "1". Hope this helps, Erich -- May the Forth be with you ... |
From: Peter C. H. <pet...@un...> - 2019-06-17 18:34:35
|
Jan, For a general idea on masks you might want to consult p. 92 of "Starting Forth". If I remember correctly "bitmask:" will create a bitmask, but not do the bit-setting for you. One has to write to the registers to do that (not sure anymore if it is just "c!" or a special version of store for accessing the registers). Peter > On 17 Jun 2019, at 20:13, Jan Kromhout via Amforth-devel <amf...@li...> wrote: > > Hello, > > I need to do a bitmask on register. > > These are the constants, and mask > > $24 constant ddrb > $25 constant portb > > \ bit masks > %000100 constant mSS ( PB2 ) > %100000 constant mSCK ( PB5 ) > > I wont > 1. to set the bits in ddrb with the bitmask mSS > 2. to clear bits in portb with the bitmask mSCK > > In bitnames.frt there is a word bitmask: How can I use it to do > the two actions above? > > This is mor as a learning to understand working with bitmask. > > Thanks for any help. > > Jan > > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel |
From: Jan K. <jan...@ic...> - 2019-06-17 18:13:11
|
Hello, I need to do a bitmask on register. These are the constants, and mask $24 constant ddrb $25 constant portb \ bit masks %000100 constant mSS ( PB2 ) %100000 constant mSCK ( PB5 ) I wont 1. to set the bits in ddrb with the bitmask mSS 2. to clear bits in portb with the bitmask mSCK In bitnames.frt there is a word bitmask: How can I use it to do the two actions above? This is mor as a learning to understand working with bitmask. Thanks for any help. Jan |
From: Peter M. <spa...@pm...> - 2019-06-15 20:39:49
|
>> Corresponding web page: >> http://amforth.sourceforge.net/TG/recipes/Turnkey.html >> >> >> The error message is the non-descriptive: >> >> ?? -13 23 >> >> 'Evalue' was found in: >> >> \lib\forth2012\core\avr-values.frt >> > On 12/06/2019 01:37, Tristan Williams wrote: > Hello Peter and welcome, > > I have just tried the turnkey example from the docs > > http://amforth.sourceforge.net/TG/recipes/Turnkey.html > > and it works for me. > > Your error message[1] ?? -13 23 after the line > > ' turnkey defer@ Evalue tk.amforth > > suggests that you are missing the word Evalue Yes, it turned out I was on the second flash of AmForth (on a separate chip), with "Evalue" being defined on the first chip... (something went wrong and I had to flash AmForth again). > Have you loaded these files on your mcu? > > avr-values.frt > is.frt > ms.frt > defers.frt > > as the line > > ' turnkey defer@ Evalue tk.amforth > > depends on words defined in these files. I have done that now, and it works now! That was probably the crucial step (though I don't understand why(?)). I could also define "tk.custom" and set it up with " ' tk.custom is turnkey ", putting my main init and infinite control loop in there, all in word "mainApplication". After a power cycle, the control loop ran immediately, as it should. The control loop can be terminated by removing a jumper that pulls a digital input low (pulled up externally with 10 kΩ). The jumper is located on my custom Arduino shield. Also, connecting the Arduino Uno to USB while in the control loop (mainApplication) does not reset the I/O and does not disrupt the operation (unlike normally, where, even if powered from a 9 V battery source, connecting will reset - though I cannot rule out power glitches). When the jumper is removed the normal interactive stuff is available. Everything works as it should!! For this try, I had to flash AmForth a third time (due to another incident, an unfortunate paste error...) and used the opportunity to see if I could repeat it. This was also to automate as much as possible (.BAT script calling AVRDUDE for the flashing, launching PuTTY with the profile for this (38400 baud, etc.), and running several AutoIt scripts for the source pasting). There were a few corrections. The fourth time, with a few more changes for automation (mostly focus changes in Windows), should reduce it to moving the chip from the ISP programmer to the Arduino and a single press of Enter when it has been moved. But this is not needed for this first deployment, only for subsequent versions (if there will ever be more). With direct ICSP, just starting the script should be enough. : tk.custom \ Call the previous turnkey action. tk.amforth execute \ Now something specific e.g. \ I_O-setup mainApplication ; Regards, Peter |
From: Tristan W. <ho...@tj...> - 2019-06-11 23:38:03
|
Hello Peter and welcome, I have just tried the turnkey example from the docs http://amforth.sourceforge.net/TG/recipes/Turnkey.html and it works for me. Your error message[1] ?? -13 23 after the line ' turnkey defer@ Evalue tk.amforth suggests that you are missing the word Evalue Have you loaded these files on your mcu? avr-values.frt is.frt ms.frt defers.frt as the line ' turnkey defer@ Evalue tk.amforth depends on words defined in these files. Secondly, this mailing list message (at the bottom of the message) shows an alternative approach https://sourceforge.net/p/amforth/mailman/message/35161327/ : tk.custom applturnkey \ your code goes here ; ' tk.custom is turnkey Best wishes, Tristan [1] http://amforth.sourceforge.net/TG/Architecture.html#exceptions On 11Jun19 21:08, Peter Mortensen wrote: > > > I think revision 2122, 2016-06-26 (the latest for that file) for > page "Turnkey applications" wiped out the 'variable' line for > the containing old turnkey thingy (now 'tk.amforth') - > > > https://svn.code.sf.net/p/amforth/code/trunk/doc/source/TG/recipes/Turnkey.rst > > > Corresponding web page: > http://amforth.sourceforge.net/TG/recipes/Turnkey.html > > > Thus, before the line " ' turnkey defer@ Evalue tk.amforth " > (line 38/39) there should probably be this line(?): > > > variable tk.amforth > > > > The error message is the non-descriptive: > > ?? -13 23 > > 'Evalue' was found in: > > \lib\forth2012\core\avr-values.frt > > > > (I have done my first real Forth project (the first version > is based on Arduino Uno hardware), and it is going to be > deployed to the real world! In exactly one instance. It > involves sending RC codes (433.92 MHz) to a 220 V relay. > > The turnkey thing is the last hurdle. And perhaps avoiding > hardware reset (I/O ports, etc.) when connecting through > USB. > > I have also installed Mecrisp Stellaris Forth on the 1Bitsy > (<https://www.kickstarter.com/projects/esden/1bitsy-and-black-magic-probe-demystifying-arm-prog>), > intended for some CAN bus work, but this is the first real > project. > ) > > > > Regards, > Peter Mortensen > > > > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel |
From: Peter M. <spa...@pm...> - 2019-06-11 19:44:11
|
I think revision 2122, 2016-06-26 (the latest for that file) for page "Turnkey applications" wiped out the 'variable' line for the containing old turnkey thingy (now 'tk.amforth') - https://svn.code.sf.net/p/amforth/code/trunk/doc/source/TG/recipes/Turnkey.rst Corresponding web page: http://amforth.sourceforge.net/TG/recipes/Turnkey.html Thus, before the line " ' turnkey defer@ Evalue tk.amforth " (line 38/39) there should probably be this line(?): variable tk.amforth The error message is the non-descriptive: ?? -13 23 'Evalue' was found in: \lib\forth2012\core\avr-values.frt (I have done my first real Forth project (the first version is based on Arduino Uno hardware), and it is going to be deployed to the real world! In exactly one instance. It involves sending RC codes (433.92 MHz) to a 220 V relay. The turnkey thing is the last hurdle. And perhaps avoiding hardware reset (I/O ports, etc.) when connecting through USB. I have also installed Mecrisp Stellaris Forth on the 1Bitsy (<https://www.kickstarter.com/projects/esden/1bitsy-and-black-magic-probe-demystifying-arm-prog>), intended for some CAN bus work, but this is the first real project. ) Regards, Peter Mortensen |
From: Ian J. <ij...@sa...> - 2019-06-09 22:45:00
|
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 squeezing a lot of functionality out of this little chip which was probably not wise though I thought it was quite fun. I came to appreciate those data sheets which I found at first intimidating but later I began to really appreciate them and the excellent writing in them. I have not touched embedded stuff for a few years now but I stay on this list just for such posts. Keeps my gray matter functional. Ian On 6/9/19 4:42 PM, Erich Wälde wrote: > 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 controller. You mentioned > "arduino" at the beginning of this thread, so I *guess* > you are using a "atmega328p" controller. > >> http://ww1.microchip.com/downloads/en/DeviceDoc/ATmega48A-PA-88A-PA-168A-PA-328-P-DS-DS40002061A.pdf > yes I know, this is a big thing with >600 pages. And no, noone > expects you (or anyone else) to learn all of this by heart. > However, I do expect you to read the relevant sections. > > The table of contents will suggest you look at chapter 19. SPI > --- Serial Peripheral Interface. > > SPI is a piece of hardware, which will do the clocking and byte > transfers for you, no need to bit bang (i.e. setting pins high > and low) it yourself. The price for this nicety is that you need > to configure it properly. > > - is the first bit in transfer the *most* or *least* significant > bit? > - is the data valid at rising of falling edges of the clock? > (19.4 Data Modes) > - which speed should the interface be clocked with? > - is a transfer currently ongoing or can I write the next Byte > to register SPDR > and so on. > > I can give you my routines, but I guess you will be unable to > use them if you do not understand these details, I'm afraid. > > > So any spi transfer goes through these steps: > > setup bitorder, data mode, speed, maybe more (once) > turn the spi module on (once or before every tx session) > > for every byte to transfer > - fetch the next byte from a meaningful place > - write the next byte to SPDR > - wait until tx has completed > - read the answer byte from SPDR (yes the same register!) > - store the answer byte in a meaningful place > repeat until no bytes are left to transmit. > > c!@spi will do one transfer: it sends the lower byte of the top > of stack element to spi and places the result byte on the stack > afterwards. It handles the body of the loop outlined above. > > !@spi will transfer 2 bytes == 1 word instead. > > it is "!" store "@" fetch spi, every transmit ("!") will provide > an answer ("@"). > > That is why you want "!@spi" and "c!@spi" compiled into your > AmForth. > > The example at >> http://amforth.sourceforge.net/TG/recipes/SPI.html > might be a bit terse, however, it does point you to > > trunk/avr8/lib/hardware/spi.frt > which defines words and constants for all the details. > > trunk/avr8/lib/hardware/mmc.frt and > trunk/common/lib/hardware/mmc-test.frt > create an elaborate example, how to use the spi interface. > > > As others have said: the datasheet is your friend, and once you > understand, how to configure a certain piece of the controller > for your project, setting the appropriate bits in its Control > Register are not a big deal any more. The big deal is to find > out, which bits to set. The C libraries do all of this for you, > but you need to read the source and the datasheet to understand, > why it is working. Once you understand this for SPI you will > find that all the other parts of the controller are operated > similarly: there is one or a few control registers, a set of > data registers, a few flag bits here and there, and possibly a > connection to one or few interrupts, to make all of this work. > > > Also, the amforth source is full of examples and use cases. If > you are on Linux, grep and find are your friends to find > relevant places. If you are on MacOS or Windows, there are other > tools to search file names or content, I'm sure. > > > So, don't give up too soon. We have all been through this stage. > > Cheers, > Erich > > >> What to do with >> >> \ check SPI device datasheet for mode settings >> : spi.setmode ( spi-mode -- ) >> spi.mode pin! >> ; >> >> With kindly regards, >> >> Jan >> >> >> >> >> >> Op 8 jun. 2019, om 20:45 heeft Matthias Trute <mt...@we...<mailto:mt...@we...>> het volgende geschreven: >> >> 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 ms SPDR c@ >> ; >> >> SPDR is a constant holding the address of the SPI data register (&78) >> >> Thanks, I've added some comments to the spi.frt file. >> >> Matthias >> >> >> _______________________________________________ >> Amforth-devel mailing list for http://amforth.sf.net/ >> Amf...@li...<mailto:Amf...@li...> >> https://lists.sourceforge.net/lists/listinfo/amforth-devel >> >> >> _______________________________________________ >> Amforth-devel mailing list for http://amforth.sf.net/ >> Amf...@li... >> https://lists.sourceforge.net/lists/listinfo/amforth-devel > > -- > May the Forth be with you ... > > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel |
From: Erich W. <ew....@na...> - 2019-06-09 20:42:15
|
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 controller. You mentioned "arduino" at the beginning of this thread, so I *guess* you are using a "atmega328p" controller. > http://ww1.microchip.com/downloads/en/DeviceDoc/ATmega48A-PA-88A-PA-168A-PA-328-P-DS-DS40002061A.pdf yes I know, this is a big thing with >600 pages. And no, noone expects you (or anyone else) to learn all of this by heart. However, I do expect you to read the relevant sections. The table of contents will suggest you look at chapter 19. SPI --- Serial Peripheral Interface. SPI is a piece of hardware, which will do the clocking and byte transfers for you, no need to bit bang (i.e. setting pins high and low) it yourself. The price for this nicety is that you need to configure it properly. - is the first bit in transfer the *most* or *least* significant bit? - is the data valid at rising of falling edges of the clock? (19.4 Data Modes) - which speed should the interface be clocked with? - is a transfer currently ongoing or can I write the next Byte to register SPDR and so on. I can give you my routines, but I guess you will be unable to use them if you do not understand these details, I'm afraid. So any spi transfer goes through these steps: setup bitorder, data mode, speed, maybe more (once) turn the spi module on (once or before every tx session) for every byte to transfer - fetch the next byte from a meaningful place - write the next byte to SPDR - wait until tx has completed - read the answer byte from SPDR (yes the same register!) - store the answer byte in a meaningful place repeat until no bytes are left to transmit. c!@spi will do one transfer: it sends the lower byte of the top of stack element to spi and places the result byte on the stack afterwards. It handles the body of the loop outlined above. !@spi will transfer 2 bytes == 1 word instead. it is "!" store "@" fetch spi, every transmit ("!") will provide an answer ("@"). That is why you want "!@spi" and "c!@spi" compiled into your AmForth. The example at > http://amforth.sourceforge.net/TG/recipes/SPI.html might be a bit terse, however, it does point you to trunk/avr8/lib/hardware/spi.frt which defines words and constants for all the details. trunk/avr8/lib/hardware/mmc.frt and trunk/common/lib/hardware/mmc-test.frt create an elaborate example, how to use the spi interface. As others have said: the datasheet is your friend, and once you understand, how to configure a certain piece of the controller for your project, setting the appropriate bits in its Control Register are not a big deal any more. The big deal is to find out, which bits to set. The C libraries do all of this for you, but you need to read the source and the datasheet to understand, why it is working. Once you understand this for SPI you will find that all the other parts of the controller are operated similarly: there is one or a few control registers, a set of data registers, a few flag bits here and there, and possibly a connection to one or few interrupts, to make all of this work. Also, the amforth source is full of examples and use cases. If you are on Linux, grep and find are your friends to find relevant places. If you are on MacOS or Windows, there are other tools to search file names or content, I'm sure. So, don't give up too soon. We have all been through this stage. Cheers, Erich > > What to do with > > \ check SPI device datasheet for mode settings > : spi.setmode ( spi-mode -- ) > spi.mode pin! > ; > > With kindly regards, > > Jan > > > > > > Op 8 jun. 2019, om 20:45 heeft Matthias Trute <mt...@we...<mailto:mt...@we...>> het volgende geschreven: > > 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 ms SPDR c@ > ; > > SPDR is a constant holding the address of the SPI data register (&78) > > Thanks, I've added some comments to the spi.frt file. > > Matthias > > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li...<mailto:Amf...@li...> > https://lists.sourceforge.net/lists/listinfo/amforth-devel > > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel -- May the Forth be with you ... |
From: Peter C. H. <pet...@un...> - 2019-06-09 19:51:41
|
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. Peter > On 9 Jun 2019, at 20:52, Jan Kromhout <kro...@ho...> wrote: > > 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! > ; > > With kindly regards, > > Jan > > > > > > Op 8 jun. 2019, om 20:45 heeft Matthias Trute <mt...@we...<mailto:mt...@we...>> het volgende geschreven: > > 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 ms SPDR c@ > ; > > SPDR is a constant holding the address of the SPI data register (&78) > > Thanks, I've added some comments to the spi.frt file. > > Matthias > > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li...<mailto:Amf...@li...> > https://lists.sourceforge.net/lists/listinfo/amforth-devel > > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel |
From: Jan K. <kro...@ho...> - 2019-06-09 18:52:57
|
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! ; With kindly regards, Jan Op 8 jun. 2019, om 20:45 heeft Matthias Trute <mt...@we...<mailto:mt...@we...>> het volgende geschreven: 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 ms SPDR c@ ; SPDR is a constant holding the address of the SPI data register (&78) Thanks, I've added some comments to the spi.frt file. Matthias _______________________________________________ Amforth-devel mailing list for http://amforth.sf.net/ Amf...@li...<mailto:Amf...@li...> https://lists.sourceforge.net/lists/listinfo/amforth-devel |
From: Matthias T. <mt...@we...> - 2019-06-08 18:45:28
|
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 ms SPDR c@ > ; > > SPDR is a constant holding the address of the SPI data register (&78) Thanks, I've added some comments to the spi.frt file. Matthias |
From: Peter C. H. <pet...@un...> - 2019-06-08 08:00:12
|
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 a constant holding the address of the SPI data register (&78) Peter Below the complete package, which we have been using successfully (turn on and off SPI before reading or writing via SPI with +SPI and -SPI): \ basic SPI operations for a single device \ after Trute, but not using the assembly word c!@spi, \ which is not available preloaded for Arduino Uno \ and did not work when included in a newly assembled package -spiwords marker -spiwords \ SPI &78 constant SPDR \ SPI Data Register &77 constant SPSR \ SPI Status Register $80 constant SPSR_SPIF \ SPI Interrupt Flag $40 constant SPSR_WCOL \ Write Collision Flag $01 constant SPSR_SPI2X \ Double SPI Speed Bit &76 constant SPCR \ SPI Control Register $80 constant SPCR_SPIE \ SPI Interrupt Enable $40 constant SPCR_SPE \ SPI Enable $20 constant SPCR_DORD \ Data Order $10 constant SPCR_MSTR \ Master/Slave Select $08 constant SPCR_CPOL \ Clock polarity $04 constant SPCR_CPHA \ Clock Phase $03 constant SPCR_SPR \ SPI Clock Rate Selects \ SPI hardware pins PORTB 5 portpin: spi.clk PORTB 3 portpin: spi.mosi PORTB 4 portpin: spi.miso PORTB 2 portpin: spi.ss \ default SPSR 0 portpin: spi.2x SPCR 6 portpin: spi.enable SPCR 5 portpin: spi.dord SPCR 4 portpin: spi.master SPCR %00001100 bitmask: spi.mode SPCR %00000011 bitmask: spi.speed $0 constant spi.mode0 \ sample rising/-- $4 constant spi.mode1 \ --/sample falling $8 constant spi.mode2 \ sample falling/-- $c constant spi.mode3 \ --/sample rising 0 constant spi.f/4 1 constant spi.f/16 2 constant spi.f/64 3 constant spi.f/128 \ check SPI device datasheet for mode settings : spi.setmode ( spi-mode -- ) spi.mode pin! ; \ speed relative to f_cpu, constants see above : spi.setspeed ( spi.speed -- ) spi.speed pin! ; : +spi \ Slave select *must* be *always* at a controlled level when SPI is activated. \ Changing a pin into output mode change its level to low. that makes a SPI think \ a communication has started which is not the case when this word is called. spi.ss high \ deselect slave spi.ss pin_output \ possibly short low pulse spi.ss high \ spi.f/64 spi.setspeed spi.clk pin_output spi.mosi pin_output spi.miso pin_input spi.miso pin_pullup_on \ now its save to turn on the SPI module spi.master high spi.enable high ; : -spi spi.ss high ; \ 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@ ; > On 7 Jun 2019, at 20:16, Jan Kromhout via Amforth-devel <amf...@li...> wrote: > > 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 > > > > >> Op 7 jun. 2019, om 19:50 heeft Erich Wälde <ew....@na...> het volgende geschreven: >> >> 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. 2019, om 19:25 heeft Tristan Williams <ho...@tj...<mailto:ho...@tj...>> 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 >> >> you see the filename? "words/spirw.asm"? Please note: .asm >> suffix. This means that in your project directory, you need to >> add one line to the file "dict_appl.inc". Then you need to >> reassemble the project and load the resulting .hex files to your >> controller. I strongly recommend learning this workflow, if you >> didn't already. >> >> Cheers, >> Erich >> >> >>> >>> 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 <ho...@tj...<mailto:ho...@tj...>> 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/ >>> Amf...@li...<mailto:Amf...@li...> >>> https://lists.sourceforge.net/lists/listinfo/amforth-devel >>> >>> >>> _______________________________________________ >>> Amforth-devel mailing list for http://amforth.sf.net/ >>> Amf...@li...<mailto:Amf...@li...> >>> https://lists.sourceforge.net/lists/listinfo/amforth-devel >>> >>> >>> >>> _______________________________________________ >>> Amforth-devel mailing list for http://amforth.sf.net/ >>> Amf...@li...<mailto:Amf...@li...> >>> https://lists.sourceforge.net/lists/listinfo/amforth-devel >>> >>> >>> _______________________________________________ >>> Amforth-devel mailing list for http://amforth.sf.net/ >>> Amf...@li...<mailto:Amf...@li...> >>> https://lists.sourceforge.net/lists/listinfo/amforth-devel >>> >>> >>> _______________________________________________ >>> Amforth-devel mailing list for http://amforth.sf.net/ >>> Amf...@li... >>> https://lists.sourceforge.net/lists/listinfo/amforth-devel >> >> >> -- >> May the Forth be with you ... >> >> >> _______________________________________________ >> Amforth-devel mailing list for http://amforth.sf.net/ <http://amforth.sf.net/> >> Amf...@li... <mailto:Amf...@li...> >> https://lists.sourceforge.net/lists/listinfo/amforth-devel <https://lists.sourceforge.net/lists/listinfo/amforth-devel> > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel |
From: Jan K. <jan...@ic...> - 2019-06-08 06:34:46
|
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 computer !! Please someone can help me out with this. With kindly regards, Jan > Op 8 jun. 2019, om 00:29 heeft Tristan Williams <ho...@tj...> het volgende geschreven: > > 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 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=3D ?? -13 6 >> >> In avr8/words you will find 3 files: >>> 2spirw.asm n-spi.asm spirw.asm >> which in turn will define 4 words: >>> !@spi n@spi n!spi c!@spi >> all of these come to life if you include their .asm files and >> reassemble. >> >> Rebuilding your project: yes, it might look intimidating the >> first time. However, think about the gains: >> >> - you can chose another board with a different controller >> >> - you can change the clock crystal to another frequency, e.g. I >> strongly prefer baud rate crystals, e.g. 11059200 Hz. >> >> - you can change the baud rate of the serial interface (within >> limits). >> >> - you can extend your AmForth system with a large number or words >> to fit your project. >> >> - you are not locked to use somehow prebuild .hex files >> >> The sky is the limit! So: Don't give up too soon, please! >> >> This might help if you are linux based: >> http://amforth.sourceforge.net/UG/linux.html >> A very long time ago I wrote this: >> http://amforth.sourceforge.net/pr/Fosdem2011-proceedings-amforth.pdf >> >> If you are Windows based, have a look at=20 >> http://amforth.sourceforge.net/UG/windows.html >> >> Cheers, >> Erich >> >>> >>> Is this also a assembler word? >>> >>> Kindly regards, >>> >>> Jan >>> >>> >>> >>> >>>> Op 7 jun. 2019, om 19:50 heeft Erich Wälde <ew....@na...> het volgende geschreven: >>>> >>>> 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. 2019, om 19:25 heeft Tristan Williams <ho...@tj...<mailto:ho...@tj...>> 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 >>>> >>>> you see the filename? "words/spirw.asm"? Please note: .asm >>>> suffix. This means that in your project directory, you need to >>>> add one line to the file "dict_appl.inc". Then you need to >>>> reassemble the project and load the resulting .hex files to your >>>> controller. I strongly recommend learning this workflow, if you >>>> didn't already. >>>> >>>> Cheers, >>>> Erich >>>> >>>> >>>>> >>>>> 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 <ho...@tj...<mailto:ho...@tj...>> 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/ >>>>> Amf...@li...<mailto:Amf...@li...> >>>>> https://lists.sourceforge.net/lists/listinfo/amforth-devel >>>>> >>>>> >>>>> _______________________________________________ >>>>> Amforth-devel mailing list for http://amforth.sf.net/ >>>>> Amf...@li...<mailto:Amf...@li...> >>>>> https://lists.sourceforge.net/lists/listinfo/amforth-devel >>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> Amforth-devel mailing list for http://amforth.sf.net/ >>>>> Amf...@li...<mailto:Amf...@li...> >>>>> https://lists.sourceforge.net/lists/listinfo/amforth-devel >>>>> >>>>> >>>>> _______________________________________________ >>>>> Amforth-devel mailing list for http://amforth.sf.net/ >>>>> Amf...@li...<mailto:Amf...@li...> >>>>> https://lists.sourceforge.net/lists/listinfo/amforth-devel >>>>> >>>>> >>>>> _______________________________________________ >>>>> Amforth-devel mailing list for http://amforth.sf.net/ >>>>> Amf...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/amforth-devel >>>> >>>> >>>> -- >>>> May the Forth be with you ... >>>> >>>> >>>> _______________________________________________ >>>> Amforth-devel mailing list for http://amforth.sf.net/ <http://amforth.sf.net/> >>>> Amf...@li... <mailto:Amf...@li...> >>>> https://lists.sourceforge.net/lists/listinfo/amforth-devel <https://lists.sourceforge.net/lists/listinfo/amforth-devel> >>> >>> _______________________________________________ >>> Amforth-devel mailing list for http://amforth.sf.net/ >>> Amf...@li... >>> https://lists.sourceforge.net/lists/listinfo/amforth-devel >> >> >> -- >> May the Forth be with you ... >> >> >> _______________________________________________ >> Amforth-devel mailing list for http://amforth.sf.net/ >> Amf...@li... >> https://lists.sourceforge.net/lists/listinfo/amforth-devel > > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel |
From: Tristan W. <ho...@tj...> - 2019-06-07 22:29:37
|
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 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=3D ?? -13 6 > > In avr8/words you will find 3 files: > > 2spirw.asm n-spi.asm spirw.asm > which in turn will define 4 words: > > !@spi n@spi n!spi c!@spi > all of these come to life if you include their .asm files and > reassemble. > > Rebuilding your project: yes, it might look intimidating the > first time. However, think about the gains: > > - you can chose another board with a different controller > > - you can change the clock crystal to another frequency, e.g. I > strongly prefer baud rate crystals, e.g. 11059200 Hz. > > - you can change the baud rate of the serial interface (within > limits). > > - you can extend your AmForth system with a large number or words > to fit your project. > > - you are not locked to use somehow prebuild .hex files > > The sky is the limit! So: Don't give up too soon, please! > > This might help if you are linux based: > http://amforth.sourceforge.net/UG/linux.html > A very long time ago I wrote this: > http://amforth.sourceforge.net/pr/Fosdem2011-proceedings-amforth.pdf > > If you are Windows based, have a look at=20 > http://amforth.sourceforge.net/UG/windows.html > > Cheers, > Erich > > > > > Is this also a assembler word? > > > > Kindly regards, > > > > Jan > > > > > > > > > >> Op 7 jun. 2019, om 19:50 heeft Erich Wälde <ew....@na...> het volgende geschreven: > >> > >> 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. 2019, om 19:25 heeft Tristan Williams <ho...@tj...<mailto:ho...@tj...>> 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 > >> > >> you see the filename? "words/spirw.asm"? Please note: .asm > >> suffix. This means that in your project directory, you need to > >> add one line to the file "dict_appl.inc". Then you need to > >> reassemble the project and load the resulting .hex files to your > >> controller. I strongly recommend learning this workflow, if you > >> didn't already. > >> > >> Cheers, > >> Erich > >> > >> > >>> > >>> 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 <ho...@tj...<mailto:ho...@tj...>> 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/ > >>> Amf...@li...<mailto:Amf...@li...> > >>> https://lists.sourceforge.net/lists/listinfo/amforth-devel > >>> > >>> > >>> _______________________________________________ > >>> Amforth-devel mailing list for http://amforth.sf.net/ > >>> Amf...@li...<mailto:Amf...@li...> > >>> https://lists.sourceforge.net/lists/listinfo/amforth-devel > >>> > >>> > >>> > >>> _______________________________________________ > >>> Amforth-devel mailing list for http://amforth.sf.net/ > >>> Amf...@li...<mailto:Amf...@li...> > >>> https://lists.sourceforge.net/lists/listinfo/amforth-devel > >>> > >>> > >>> _______________________________________________ > >>> Amforth-devel mailing list for http://amforth.sf.net/ > >>> Amf...@li...<mailto:Amf...@li...> > >>> https://lists.sourceforge.net/lists/listinfo/amforth-devel > >>> > >>> > >>> _______________________________________________ > >>> Amforth-devel mailing list for http://amforth.sf.net/ > >>> Amf...@li... > >>> https://lists.sourceforge.net/lists/listinfo/amforth-devel > >> > >> > >> -- > >> May the Forth be with you ... > >> > >> > >> _______________________________________________ > >> Amforth-devel mailing list for http://amforth.sf.net/ <http://amforth.sf.net/> > >> Amf...@li... <mailto:Amf...@li...> > >> https://lists.sourceforge.net/lists/listinfo/amforth-devel <https://lists.sourceforge.net/lists/listinfo/amforth-devel> > > > > _______________________________________________ > > Amforth-devel mailing list for http://amforth.sf.net/ > > Amf...@li... > > https://lists.sourceforge.net/lists/listinfo/amforth-devel > > > -- > May the Forth be with you ... > > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel |
From: Erich W. <ew....@na...> - 2019-06-07 19:37:58
|
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 > |E=3D ?? -13 6 In avr8/words you will find 3 files: > 2spirw.asm n-spi.asm spirw.asm which in turn will define 4 words: > !@spi n@spi n!spi c!@spi all of these come to life if you include their .asm files and reassemble. Rebuilding your project: yes, it might look intimidating the first time. However, think about the gains: - you can chose another board with a different controller - you can change the clock crystal to another frequency, e.g. I strongly prefer baud rate crystals, e.g. 11059200 Hz. - you can change the baud rate of the serial interface (within limits). - you can extend your AmForth system with a large number or words to fit your project. - you are not locked to use somehow prebuild .hex files The sky is the limit! So: Don't give up too soon, please! This might help if you are linux based: http://amforth.sourceforge.net/UG/linux.html A very long time ago I wrote this: http://amforth.sourceforge.net/pr/Fosdem2011-proceedings-amforth.pdf If you are Windows based, have a look at=20 http://amforth.sourceforge.net/UG/windows.html Cheers, Erich > > Is this also a assembler word? > > Kindly regards, > > Jan > > > > >> Op 7 jun. 2019, om 19:50 heeft Erich Wälde <ew....@na...> het volgende geschreven: >> >> 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. 2019, om 19:25 heeft Tristan Williams <ho...@tj...<mailto:ho...@tj...>> 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 >> >> you see the filename? "words/spirw.asm"? Please note: .asm >> suffix. This means that in your project directory, you need to >> add one line to the file "dict_appl.inc". Then you need to >> reassemble the project and load the resulting .hex files to your >> controller. I strongly recommend learning this workflow, if you >> didn't already. >> >> Cheers, >> Erich >> >> >>> >>> 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 <ho...@tj...<mailto:ho...@tj...>> 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/ >>> Amf...@li...<mailto:Amf...@li...> >>> https://lists.sourceforge.net/lists/listinfo/amforth-devel >>> >>> >>> _______________________________________________ >>> Amforth-devel mailing list for http://amforth.sf.net/ >>> Amf...@li...<mailto:Amf...@li...> >>> https://lists.sourceforge.net/lists/listinfo/amforth-devel >>> >>> >>> >>> _______________________________________________ >>> Amforth-devel mailing list for http://amforth.sf.net/ >>> Amf...@li...<mailto:Amf...@li...> >>> https://lists.sourceforge.net/lists/listinfo/amforth-devel >>> >>> >>> _______________________________________________ >>> Amforth-devel mailing list for http://amforth.sf.net/ >>> Amf...@li...<mailto:Amf...@li...> >>> https://lists.sourceforge.net/lists/listinfo/amforth-devel >>> >>> >>> _______________________________________________ >>> Amforth-devel mailing list for http://amforth.sf.net/ >>> Amf...@li... >>> https://lists.sourceforge.net/lists/listinfo/amforth-devel >> >> >> -- >> May the Forth be with you ... >> >> >> _______________________________________________ >> Amforth-devel mailing list for http://amforth.sf.net/ <http://amforth.sf.net/> >> Amf...@li... <mailto:Amf...@li...> >> https://lists.sourceforge.net/lists/listinfo/amforth-devel <https://lists.sourceforge.net/lists/listinfo/amforth-devel> > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel -- May the Forth be with you ... |
From: Jan K. <jan...@ic...> - 2019-06-07 18:16:17
|
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 > Op 7 jun. 2019, om 19:50 heeft Erich Wälde <ew....@na...> het volgende geschreven: > > 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. 2019, om 19:25 heeft Tristan Williams <ho...@tj...<mailto:ho...@tj...>> 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 > > you see the filename? "words/spirw.asm"? Please note: .asm > suffix. This means that in your project directory, you need to > add one line to the file "dict_appl.inc". Then you need to > reassemble the project and load the resulting .hex files to your > controller. I strongly recommend learning this workflow, if you > didn't already. > > Cheers, > Erich > > >> >> 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 <ho...@tj...<mailto:ho...@tj...>> 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/ >> Amf...@li...<mailto:Amf...@li...> >> https://lists.sourceforge.net/lists/listinfo/amforth-devel >> >> >> _______________________________________________ >> Amforth-devel mailing list for http://amforth.sf.net/ >> Amf...@li...<mailto:Amf...@li...> >> https://lists.sourceforge.net/lists/listinfo/amforth-devel >> >> >> >> _______________________________________________ >> Amforth-devel mailing list for http://amforth.sf.net/ >> Amf...@li...<mailto:Amf...@li...> >> https://lists.sourceforge.net/lists/listinfo/amforth-devel >> >> >> _______________________________________________ >> Amforth-devel mailing list for http://amforth.sf.net/ >> Amf...@li...<mailto:Amf...@li...> >> https://lists.sourceforge.net/lists/listinfo/amforth-devel >> >> >> _______________________________________________ >> Amforth-devel mailing list for http://amforth.sf.net/ >> Amf...@li... >> https://lists.sourceforge.net/lists/listinfo/amforth-devel > > > -- > May the Forth be with you ... > > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ <http://amforth.sf.net/> > Amf...@li... <mailto:Amf...@li...> > https://lists.sourceforge.net/lists/listinfo/amforth-devel <https://lists.sourceforge.net/lists/listinfo/amforth-devel> |
From: Erich W. <ew....@na...> - 2019-06-07 18:04:31
|
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. 2019, om 19:25 heeft Tristan Williams <ho...@tj...<mailto:ho...@tj...>> 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 you see the filename? "words/spirw.asm"? Please note: .asm suffix. This means that in your project directory, you need to add one line to the file "dict_appl.inc". Then you need to reassemble the project and load the resulting .hex files to your controller. I strongly recommend learning this workflow, if you didn't already. Cheers, Erich > > 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 <ho...@tj...<mailto:ho...@tj...>> 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/ > Amf...@li...<mailto:Amf...@li...> > https://lists.sourceforge.net/lists/listinfo/amforth-devel > > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li...<mailto:Amf...@li...> > https://lists.sourceforge.net/lists/listinfo/amforth-devel > > > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li...<mailto:Amf...@li...> > https://lists.sourceforge.net/lists/listinfo/amforth-devel > > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li...<mailto:Amf...@li...> > https://lists.sourceforge.net/lists/listinfo/amforth-devel > > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel -- May the Forth be with you ... |
From: Jan K. <kro...@ho...> - 2019-06-07 17:34:41
|
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 <ho...@tj...<mailto:ho...@tj...>> 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 <ho...@tj...<mailto:ho...@tj...>> 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/ Amf...@li...<mailto:Amf...@li...> https://lists.sourceforge.net/lists/listinfo/amforth-devel _______________________________________________ Amforth-devel mailing list for http://amforth.sf.net/ Amf...@li...<mailto:Amf...@li...> https://lists.sourceforge.net/lists/listinfo/amforth-devel _______________________________________________ Amforth-devel mailing list for http://amforth.sf.net/ Amf...@li...<mailto:Amf...@li...> https://lists.sourceforge.net/lists/listinfo/amforth-devel _______________________________________________ Amforth-devel mailing list for http://amforth.sf.net/ Amf...@li...<mailto:Amf...@li...> https://lists.sourceforge.net/lists/listinfo/amforth-devel |
From: Tristan W. <ho...@tj...> - 2019-06-07 17:26:10
|
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 <ho...@tj...> 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/ > >> Amf...@li... > >> https://lists.sourceforge.net/lists/listinfo/amforth-devel > > > > > > _______________________________________________ > > Amforth-devel mailing list for http://amforth.sf.net/ > > Amf...@li... > > https://lists.sourceforge.net/lists/listinfo/amforth-devel > > > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel |
From: Jan K. <jan...@ic...> - 2019-06-07 15:44:53
|
Hello Tristan, No don’t have. Why? Verstuurd vanaf mijn iPad > Op 7 jun. 2019 om 17:25 heeft Tristan Williams <ho...@tj...> 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/ >> Amf...@li... >> https://lists.sourceforge.net/lists/listinfo/amforth-devel > > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel |
From: Tristan W. <ho...@tj...> - 2019-06-07 15:43:10
|
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/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel |
From: Peter C. H. <pet...@un...> - 2019-06-07 15:29:12
|
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 language examples often are based on libraries which are not transparent, and thus a direct translation to Forth is not possible. Peter > On 7 Jun 2019, at 17:06, Jan Kromhout via Amforth-devel <amf...@li...> 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/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel |
From: Jan K. <jan...@ic...> - 2019-06-07 15:06:33
|
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); } |
From: Jan K. <jan...@ic...> - 2019-06-04 19:18:51
|
Thanks, it is working now! > Op 4 jun. 2019, om 21:11 heeft Matthias Trute <mt...@we...> het volgende geschreven: > > Am Dienstag, den 04.06.2019, 18:39 +0000 schrieb Jan Kromhout: >> Hello, >> >> Ho do I set the parameters for the speed if the I2C to 400 >> kHz? Thanks for any help. >> >> : init_i2c ( --- ) >> \ init at 100 kHz >> i2c.prescaler/1 #72 i2c.init >> ; >> > > Did you check http://amforth.sourceforge.net/TG/recipes/TWI.html#twi ? > (Javascript required) > > Matthias > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel |