Welcome Guest. Please Login or Register. Apr 5th, 2018, 10:13pm
ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018. Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.
If you require a dump of the post on your message board, please come to the support board and request it.
1st of all, thanks for the fine B2C Basic for Windows system I purchased for a Christmas gift (to myself. Only one supprise here. The command CVI is missing. Or is it? It is needed in my first application reading on-line a well known home Weather Station in order to result a WeatherTalker (via serial COMM) -using a method given in among the BBC BASIC sound examples (SPEAK.BCC) Is there a CVI (Qbasic) kind of command somewhere in this language?
A good way to find equivalents to QBASIC functions is to run QB2BBC (the QBASIC to BBC BASIC translator) and see what happens. In the case of CVI this is what you get:
Code:
A = CVI(B$)
translates to
A = FN_cvi(B$)
So in this case there is an equivalent function in QBLIB. Looking there we find this (rather cryptic) code:
Code:
DEF FN_cvi(A$) = ((!!^A$) << 16) >> 16
The QBASIC to BBC BASIC translator can be found here:
Thanks Richard. meanwhile I planned something like this but not yet tested it with a weather station Yr sentence is anyhow very much shorter! DEF FN_cvi(a$) Hbyte$=LEFT$(a$,1) Lbyte$=RIGHT$(a$,1) Msbyte% = ASC(Lbyte$) Lsbyte% = ASC(Hbyte$) IF Msbyte% >127 THEN Msbyte% = (Msbyte% EOR 255) Iresu% = Msbyte%*256+(Lsbyte% EOR 255) Iresu% = (Iresu%*(-1))-1 ELSE Iresu% = Msbyte%*256 + Lsbyte% ENDIF
Just a note ,after testing succesfully both of those, I found that in the CVIs above , the argument (A$) there must be sum of CHR$s. So if I read via my weather station's serial port #sepo% two numbers i1% and i2% like this i1%=BGET#sepo% i2%=BGET#sepo%
then the CVI argument will be A$= CHR$(i1%)+ CHR$(i2%) Then FN_cvi(A$) results (in my case f.e) -- say the outside temperature nicely in the proper range -60. ....+60 C.
If we just make simply mathematics with formulas like CVI= lowbyte + 256* Highbyte then we will -as an example get - very wrong values now and then below -17.7 C (fahrenheit 0) say number like +3500 C instead of -20 C The challence for anybody (not just to NASAs space sw programmers (with F-mathematics?) is a must to avoid the Fahrenheit 0-problem seen here too, namely that the zero temperature in F-mathematic is allways 0 F (-17.7C) and in C mathematics 0C occurs at +32F. In weather stations /sw.s --tested in normal winter coldness ----15..+++5 C , someone may never have a possibility to meet those kind of zero division problems -even with his/hers Fahrenheit weather mathematics, if products are tested in real life/ outdoors in normal weather conditions (not at least near NASA's Huntsville facilities were we had a nice time while visiting an ICAE seminar in 1999) So lets test our weather station applications in a cold storage or here at 62+N