Email
 Microcontroller and PC projects Forum Index : Microcontroller and PC projects         Section -- Select Forum -- Off grid living and renewables   - Windmills   - Solar   - EV's Electronics and Microcontrollers   - Electronics   - Microcontroller and PC projects   - PCB Manufacturing Miscellaneous   - Other Stuff   - Site News   - Off topic archive. Classifieds   - Price Watch   - Wanted   - For Sale Guest Book   - Guest Book
 Topic: Micromite eXtreme Firmware V5.03
 << Prev Page 1 2 3 4 5 6 of 6
Author
 Message << Prev Topic | Next Topic >>
matherp
Guru

Joined: 11 December 2012
Location: United Kingdom
Online Status: Offline
Posts: 1573
 Posted: 19 April 2017 at 7:54am | IP Logged
Jim

Thanks for that - side effect of implementing the forced exponential format

The Pi version needs updating with all the changes - I'll post something later today

Attached is the latest re-release 5.3.17 for the 100 and 144-pin parts

2017-04-19_075342_MMX5.3.17.zip

And for the 64-pin part

2017-04-19_075239_MMX645.3.17.zip

TassyJim
Guru

Joined: 07 August 2011
Location: Australia
Online Status: Offline
Posts: 2018
 Posted: 19 April 2017 at 8:36am | IP Logged
That works better!.
I knew I had another program somewhere for engineering notation.
I prefer engineering notation when playing with component values etc.

Here it is
 ' MicroMite  'format number in Engineering notation  ' TassyJim 16 March 2014  DO    READ a    PRINT strE\$(a,12,1)  LOOP UNTIL a = 0END  FUNCTION strE\$(mx,p, eng)  ' mx = number to format  ' p = number of decimal places  ' if eng is not zero, use engineering notation  LOCAL px, sn\$, x  sn\$=" "  x=mx  IF x < 0 THEN    sn\$ = "-"    x = x * -1  ENDIF  IF x<>0 THEN  ' zero is a special case    px=INT(LOG(x)/ LOG(10))    IF eng <> 0 THEN ' engineering notation - multiples of 3      px = INT(px/3)*3    ENDIF    x=x*(10^-px)    strE\$ = sn\$ + STR\$(x, 0, p) + "e" + STR\$(INT(px))  ELSE    strE\$ = sn\$ + STR\$(x, 0, p)  ENDIFEND FUNCTION    DATA      -1.9509150490455762e+04     ,      -1.9101597562906206e+04     ,      -5.3792389600437023e+03  DATA      2.6745479139695885e+03     ,      -4.1107639233861732e+05     ,      1.8039170525238259e+04  DATA      -3.0238550029372377e+05     ,      -6.9277505690488060e+03     ,      -1.0253481529116041e+05  DATA      2.3728918290534584e+03     ,      1.4651420661642793e+05     ,      -5.2052288478643040e+03  DATA      4.7026247303780471e+04     ,      -1.3249750680520442e+03     ,      1.6002341470107360e+04  DATA      -1.2968825492757745e+03     ,      -1.4753267662386909e+04     ,      1.6212085558023923e+02  DATA      -4.0177777613644884e+03     ,      5.4472249566385002e+02     ,      -1.3864294032602171e+03  DATA      2.0944568417002891e+02     ,      1.3025618648952362e+03     ,      1.8186655290580043e+01  DATA      4.0800683272180116e+02     ,      -6.1696138184359625e+01     ,      1.4127897903869770e+02  DATA      -1.6878795485286642e+01     ,      -1.5134023816145989e+02     ,      2.2405113034100004e-01  DATA      -5.2206627243118069e+01     ,      3.6345097141761684e+00     ,      -1.7920513466880599e+01  DATA      8.6779646031902207e-01     ,      2.0283413346424432e+01     ,      -3.2320616223538909e-01  DATA      7.1829675324621513e+00     ,      -1.5021838189568371e-01     ,      2.5567619549789620e+00  DATA      -3.8447105541958342e-02     ,      -2.7613886906044733e+00     ,      -1.7482108419894107e-03  DATA      -9.2551550288252251e-01     ,      1.0983875057371777e-02     ,      -3.8803916473850784e-01  DATA      -2.7603287474318803e-03     ,      3.2272242650062597e-01     ,      1.5775894057393691e-02  DATA      8.2556945377118182e-02     ,      2.8333855651518594e-03     ,      5.3670717564749610e-02  DATA      5.0759404395995213e-03     ,      -1.7796021268059985e-02     ,      -3.4995377309747879e-03  DATA      3.6598594389423460e-03     ,      -3.5999052689432918e-03     ,      -4.7281039878726006e-03  DATA      -2.4012103261026949e-03     ,      -4.3875247543577895e-03     ,      1.6549131673638753e-04  DATA      -4.8342686506137911e-03     ,      1.9899465305137534e-03     ,      -4.8041223375808579e-04  DATA 1, -1, 0

The exponential notation formula is a lot cleaner.

Jim

__________________
It all started with the ZX81....
VK7JH
http://www.c-com.com.au/MMedit.htm

CaptainBoing
Senior Member

Joined: 07 September 2016
Location: United Kingdom
Online Status: Offline
Posts: 105
 Posted: 19 April 2017 at 8:48am | IP Logged
Hello Peter/Geoff.

do you have any plans to increase the size of strings in MMBasic now that we have devices that support much larger memories. Even 1K would be nice, 64K would be amazing. I have used the large string support with CFunctions etc but it is a bit "clunky".

Edited by CaptainBoing on 19 April 2017 at 9:03am

__________________

all you need is duct tape and WD40 (if it moves and shouldn't, use duct tape; if it doesn't move and should, use WD40)

matherp
Guru

Joined: 11 December 2012
Location: United Kingdom
Online Status: Offline
Posts: 1573
 Posted: 19 April 2017 at 9:11am | IP Logged
Quote:
 do you have any plans to increase the size of strings in MMBasic now that we have devices that support much larger memories.

It would be a huge change which would likely introduce bugs throughout the code. Basic strings are stored with a single character length field in the first location giving lengths of 1 to 255.

CaptainBoing
Senior Member

Joined: 07 September 2016
Location: United Kingdom
Online Status: Offline
Posts: 105
 Posted: 19 April 2017 at 10:03am | IP Logged
I figured as much really - it is sort of "hard baked" in the core of things I guess... dunt hurt to ask though not like its a show stopper.

Thanks Peter.

__________________

all you need is duct tape and WD40 (if it moves and shouldn't, use duct tape; if it doesn't move and should, use WD40)

cdeagle
Regular Member

Joined: 22 June 2014
Location: United States
Online Status: Offline
Posts: 92
 Posted: 20 April 2017 at 11:14am | IP Logged
There's a problem when printing zero with the new STR\$ function. Notice the "exponent" on the "position vector z-component" in the following program output.

program npoe - numerical prediction of orbital events
-----------------------------------------------------

degree of gravity model 2
order of gravity model 0

integration tolerance 1.00000e-08
root-finding tolerance 0.0001

initial conditions
------------------

calendar date April 18 2017

UTC 0 hours 0 minutes 0.00 seconds

position vector x-component 5.506706064204379e+03 kilometers
position vector y-component 5.506706064204379e+03 kilometers
position vector z-component 0.000000000000000e--2147483648 kilometers

position vector magnitude 7.787658400000000e+03 kilometers

velocity vector x-component -4.504405239129656e+00 kilometers/second
velocity vector y-component 4.504405239129657e+00 kilometers/second
velocity vector z-component 3.458731500160038e+00 kilometers/second

velocity vector magnitude 7.248596878485981e+00 kilometers/second

semimajor axis 8000.0000 kilometers
eccentricity 0.0265427000
orbital inclination 28.5000 degrees
argument of perigee 0.0000 degrees
RAAN 45.0000 degrees
true anomaly 360.0000 degrees

orbital period 118.6847 minutes

matherp
Guru

Joined: 11 December 2012
Location: United Kingdom
Online Status: Offline
Posts: 1573
 Posted: 20 April 2017 at 5:58pm | IP Logged
Can you confirm you are using the new forced exponential format "str\$(a,b,-c)" ?

cdeagle
Regular Member

Joined: 22 June 2014
Location: United States
Online Status: Offline
Posts: 92
 Posted: 20 April 2017 at 6:26pm | IP Logged
Peter,

Here's the code snippet that prints the numbers.

 print "position vector x-component  ", str\$(r(1), 0, -15), " kilometers"  print "position vector y-component  ", str\$(r(2), 0, -15), " kilometers"  print "position vector z-component  ", str\$(r(3), 0, -15), " kilometers"

TassyJim
Guru

Joined: 07 August 2011
Location: Australia
Online Status: Offline
Posts: 2018
 Posted: 20 April 2017 at 9:11pm | IP Logged
The HEX of -2147483648 is FFFFFFFF80000000 so that might be a clue.

Jim

__________________
It all started with the ZX81....
VK7JH
http://www.c-com.com.au/MMedit.htm

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register