Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Micromite eXtreme Firmware V5.03

Page 4 of 4
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 2995
 Posted: 09:54pm 18 Apr 2017 Copy link to clipboard Print this post

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/08/2011
Location: Australia
Posts: 3153
 Posted: 10:36pm 18 Apr 2017 Copy link to clipboard Print this post

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
PRINT strE\$(a,12,1)
LOOP UNTIL a = 0
END

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)
ENDIF
END 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

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 1043
 Posted: 10:48pm 18 Apr 2017 Copy link to clipboard Print this post

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".

matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 2995
 Posted: 11:11pm 18 Apr 2017 Copy link to clipboard Print this post

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

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 1043
 Posted: 12:03am 19 Apr 2017 Copy link to clipboard Print this post

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.

cdeagle
Senior Member

Joined: 22/06/2014
Location: United States
Posts: 197
 Posted: 01:14am 20 Apr 2017 Copy link to clipboard Print this post

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/12/2012
Location: United Kingdom
Posts: 2995
 Posted: 07:58am 20 Apr 2017 Copy link to clipboard Print this post

Can you confirm you are using the new forced exponential format "str\$(a,b,-c)" ?

cdeagle
Senior Member

Joined: 22/06/2014
Location: United States
Posts: 197
 Posted: 08:26am 20 Apr 2017 Copy link to clipboard Print this post

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/08/2011
Location: Australia
Posts: 3153
 Posted: 11:11am 20 Apr 2017 Copy link to clipboard Print this post

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

matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 2995
 Posted: 09:24pm 23 Apr 2017 Copy link to clipboard Print this post

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

Fixes the bug in IR SEND
Fixes bug in printing 0.0 in exponential format

2017-04-24_072316_MMX5.2.18.zip

And for the 64-pin part

2017-04-24_072416_MMX545.3.18.zip

cdeagle
Senior Member

Joined: 22/06/2014
Location: United States
Posts: 197
 Posted: 12:28am 24 Apr 2017 Copy link to clipboard Print this post

Thanks Peter.

matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 2995
 Posted: 07:53am 08 May 2017 Copy link to clipboard Print this post

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

2017-05-08_175002_MMX5.3.19.zip

And for the 64-pin part

2017-05-08_175213_MMX645.3.19.zip

This release includes a couple of requested items as follows:

100/144 pin only:
GUI VGA OFF 'turns off the VGA output to allow a monitor to go to sleep
GUI VGA ON 'turns the monitor back on again

Note the memory image of the screen is maintained and can even be updated when the screen is off

All versions:
OPTION SERIAL PULLUP DISABLE 'permanently stored option that disables pullups on all serial ports
OPTION SERIAL PULLUP ENABLE 'default: permanently stored option that enables pullups on all serial ports

The OPTION SERIAL PULLUP command should be run once and then the status will be remembered (unless the chip is re-flashed. The option affects all serial ports (com1 - com4) but not the console.

In addition there is a bug fix relating to passing a float in an array element to a subroutine requiring an integer

Edited by matherp 2017-05-09

retepsnikrep

Regular Member

Joined: 31/12/2007
Location: United Kingdom
Posts: 95
 Posted: 07:29pm 08 May 2017 Copy link to clipboard Print this post

Thanks very much for that...
Gen1 Honda Insights.

Cherokeecruiser
Newbie

Joined: 25/02/2015
Location: Australia
Posts: 25
 Posted: 09:56pm 08 May 2017 Copy link to clipboard Print this post

Thanks very much for those additions

matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 2995
 Posted: 06:17am 12 May 2017 Copy link to clipboard Print this post

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

2017-05-12_160746_MMX5.3.20.zip

And for the 64-pin part

2017-05-12_160859_MMX645.3.20.zip

This now allows xmodem send and receive of files to be called from within a program. Of course normal use of XMODEM to load a program cannot be used in this way

In addition, this version implements a complete set of routines for handling long strings. These are taken from Geoff's long string CFunctions, but because CFunctions are difficult/impossible in the MMX they are included in the firmware.

The syntax is pretty much the same as the CFunctions although the way they are called is somewhat different.

Geoff's document is attached:

2017-05-12_161240_Long_Strings.pdf

and the changes are best understood by my test program. There is one additional routine which allows you to substitute characters into an existing string

LONGSTRING REPLACE array%() , newstring\$, start-position

Note that unlike the CFunctions these calls all use integer arrays to hold the long strings. The calls all check for the arrays being big enough and give an error if any call would exceed the array limits.

Dim a%(100) 'enough for 800 character string
Dim b%(10)
Print "chars 4-9 are: ", LGetStr\$(a%(),4,6)
s\$="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
LongString append a%(),s\$
Print "stringlength now :", LLen(a%())
If LInStr(a%(),"ghij") Then
Print "ghij found"
Else
EndIf
Print "convert string to lower case"
LongString lcase a%()
If LInStr(a%(),"ghij") Then
Print "ghij now found"
Else
EndIf
LongString append a%(),s\$
LongString append a%(),s\$
LongString append a%(),s\$
LongString append a%(),s\$
LongString append a%(),s\$
LongString append a%(),s\$
LongString append a%(),s\$
LongString append a%(),s\$
LongString append a%(),s\$
LongString append a%(),s\$
Print "stringlength now :", LLen(a%())
start=1
Do
p=LInStr(a%(),"ABC",start)
If p Then Print "ABC found at position ",p
start=p+1
Loop While p>0
Print "Convert to upper case"
LongString ucase a%()
p=LInStr(a%(),"ABC",start)
If p Then Print "ABC now found at position ",p
LongString left b%(),a%(),20
Print "left-most 20 characters of a% are ",LGetStr\$(b%(),1,20)
LongString right b%(),a%(),20
Print "right-most 20 characters of a% are ",LGetStr\$(b%(),1,20)
LongString mid b%(),a%(),20,20
Print "chars 20-39 characters of a% are ",LGetStr\$(b%(),1,20)
Print "Now clear a%"
LongString clear a%()
Print "a% is now ",LLen(a%()), " characters long"
Print "copy b% to a%"
LongString copy a%(),b%()
If LCompare(a%(),b%())=0 Then Print "Compare :the strings are the same"
Print "a% is now ",LLen(a%()), " characters long"
LongString concat a%(),b%()
Print "a% is now ",LLen(a%()), " characters long"
If LCompare(a%(),b%())=1 Then Print "a% now bigger than b%"
If LCompare(b%(),a%())=-1 Then Print "b% now smaller than a%"
Print "b% is currently ",LGetStr\$(b%(),1,30)
LongString replace b%(),"hello",5
Print "b% is now ",LGetStr\$(b%(),1,30)

Edited by matherp 2017-05-13

CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1118
 Posted: 08:31am 12 May 2017 Copy link to clipboard Print this post

matherp said   because CFunctions are difficult/impossible in the MMX

Why?

Micromites and Maximites! - Beginning Maximite

TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 3153
 Posted: 07:42pm 12 May 2017 Copy link to clipboard Print this post

After a successful XMODEM SEND file from within a program, control C doesn't work.

If you abort a transfer or let it time out by starting but not responding, ^C works.
To get control back, I started a second transfer and the aborted with three ^X's

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

matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 2995
 Posted: 06:10am 13 May 2017 Copy link to clipboard Print this post

Quote  After a successful XMODEM SEND file from within a program, control C doesn't work.

Thanks Jim - One line missing to restore break after the transfer. I'll include in the next update.

Best Regards

Peter

matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 2995
 Posted: 05:55am 15 May 2017 Copy link to clipboard Print this post

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

2017-05-15_155141_MMX5.3.21.zip

And for the 64-pin part

2017-05-15_155243_MMX645.3.21.zip

Changes are:

BUGFIX:
Restored CTRL-C action after using XMODEM to send or receive a file

LONGSTRING TRIM nnnn

This removes nnnn characters from the left of a long string. This is very useful for processing incoming datastreams such as net traffic or GPS. The attached code snippet is for finding the next HTTP request but the concept can be used for any datastream

Do While Not Eof(2) 'if anything to process append it to the long string
LongString append a%(), Input\$(10,2)
Loop
p%=LInStr(a%(),"GET",1) 'identify the start of what we are interested in
t%=LInStr(a%(),"HTTP",1) 'identify the end of what we are interested in
s\$=LGetStr\$(a%(),p%,t%-p%+4) 'get the interesting data as a normal string
LongString trim a%(),t%+4 'strip this from the front of the long string

Page 4 of 4