From: Jan K. <jan...@ic...> - 2018-12-21 13:14:54
|
Hello Erich, Thanks, I’m just binding in the assembler file. That is done for now. Will give it a try this afternoon. The last definition is : place-rec ( xt -- ) get-recognizer dup >r 1- n>r swap nr> drop r> 1+ set-recognizer ; But when I take a look in recognizer.frt the words are "get-recognizers" and "set-recognizers". I think that these are the same as mention in “place-rec”. The reason to use the FP package is to educate and entertaining. Try to implement the BMP280 in forth, and would do that with FP. Have trouble to do that in double math. (perhaps later on) Cheers, Jan > Op 21 dec. 2018, om 14:03 heeft Erich Wälde <ew....@na...> het volgende geschreven: > > Hello Jan, > > >> Found the missing words!! > Cool. > >> The package is now loading complete. >> But it is not working. >> When input a float or a double the system is crashing. > not cool. >> >> Has someone some experience with this package? > Not me. But see below. > > >> I have read there is also a FP package in assembler, where could I >> find that? > There is another repository with "community contributed" files. > On the amforth homepage > http://amforth.sourceforge.net/ <http://amforth.sourceforge.net/> > > Click on "Community" (the first entry in the title area), this will > point you to > https://sourceforge.net/p/amforth/community/HEAD/tree/ <https://sourceforge.net/p/amforth/community/HEAD/tree/> > > where you find a subdirectory "floatingpoint" > > This is old and possibly outdated material, so do not despair. > > > --- > > I would like to make you aware, that floating point calculations can > often be replaced by "scaled integer" operations. > > Examples: > > 1. handle a Temperature in 1/10 or 1/100 degrees > > Say a thermometer sensor is providing readings with 1/10 degree > resolution. That means, a reading of 245 really means 24.5 C. > Then there is no need to convert this to floating point, because you can > create a function to "print" the value with 1 digit behind the decimal > point. > >>> ver >> amforth 6.6 ATmega644P ok >>> : .f1 <# # [char] . hold #s #> type ; >> ok >>> 245 s>d .f1 >> 24.5 ok > > (I had to remember that <# ... #> formatting handles double values :-) > > > > 2. to handle calculations in scaled integer, the programmer decides, how > many bits of a given value are considered to be the fractional part. For > a complex example look here: > https://sourceforge.net/p/amforth/community/HEAD/tree/ewlib/sht75.fs <https://sourceforge.net/p/amforth/community/HEAD/tree/ewlib/sht75.fs> > > The word sht.H.raw>lin converts the sensor reading from its raw value to > the "linear" value by applying a correction. > > \ H_25 [%] = c1 + c2*Hraw + c3*Hraw^2 > \ 12bit: c1=-4 c2=0.0405 c3=-2.8e-6 > > I have scaled the calculation by 10^7 and thus eliminated the need to > work with floating point. > > > I'm not saying you must always use scaled integer. I'm just saying: if > you don't know this technique, check it out, and maybe it fits your > needs. > > See > Leo Brodie -- Starting Forth: > http://home.iae.nl/users/mhx/sf.html <http://home.iae.nl/users/mhx/sf.html> > Chapter 7. > > > > Cheers, > Erich > > > > >> >> Cheers, >> >> Jan >> >> >>> Op 21 dec. 2018, om 10:55 heeft Jan Kromhout <kro...@ho...> het volgende geschreven: >>> >>> Hello, >>> >>> Try to load the Floating point package. >>> How do, or find I the words get-recognizer and set-recognizer? >>> >>> What is the meaning of the word "place-rec" and what is the input? >>> >>> Thanks for any help. >>> >>> Cheers >>> >>> Jan >>> >>> >>> |S| 930|: place-rec ( xt -- ) >>> |S| 931| get-recognizer >>> |E= ?? -13 14 >>> **** /Users/jankromhout/Documents/amforth-6.7/tools >>> Error: Error in line sent >>> >>> >>> >>> : place-rec ( xt -- ) >>> get-recognizer >>> dup >r >>> 1- n>r >>> swap >>> nr> drop r> 1+ >>> set-recognizer >>> ; >>> >>> _______________________________________________ >>> 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 > > > -- > 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> |