Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 23:17 02 Aug 2025 Privacy Policy
Jump to

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 MMBasic Ver 5.04.10 Beta

     Page 2 of 4    
Author Message
Azure

Guru

Joined: 09/11/2017
Location: Australia
Posts: 446
Posted: 05:28am 19 Aug 2018
Copy link to clipboard 
Print this post

  Zonker said  I wanted to code up an EIS to use for Ultralight aircraft use... It has 3 boards in the design, the MPU engine board, power plus board and the temp input board..


Not sure if you have seen it or if this SC Project is of any use (you will only be able to see a preview of it).
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5091
Posted: 09:00am 22 Aug 2018
Copy link to clipboard 
Print this post

Dear Geoff,

This is basically a feature request.
For this MMBasic release could you think of a fix for te command line problem with defines in a library.

I currently use a 170. 5.04.09.
In MMBasic the chip pin no's are used to define the IO pin.
In Maximite Basic the header pin no's are used to define an IO pin.

If I want to put the 170 on a board, I will route the chip pins to header pins.

My question is a possibility to translate the header pin number (i.e. H1) to the chip pin number (i.e. 26) that works in RUN mode, but aso in command line mode.
I usually do a lot of prototyping on command line, try out things before I start writing the program. I would like to store these "translations" in a library, so they are available at cold boot.

Regards,

Volhout

PicomiteVGA PETSCII ROBOTS
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2442
Posted: 02:48pm 23 Aug 2018
Copy link to clipboard 
Print this post

is this a bug, or just a case of GIGO (garbage in, garbage out):


> Input "1) X10"+Chr$(13)+Chr$(10)+"2) VT200", a$
1) X10"º†13)º†10)º"2) VT200



cheers,
rob :-)
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2944
Posted: 07:15pm 23 Aug 2018
Copy link to clipboard 
Print this post

  Volhout said  My question is a possibility to translate the header pin number (i.e. H1) to the chip pin number (i.e. 26) that works in RUN mode, but aso in command line mode.


Check out the MicroMite User Manual and look at Library and especially read about MM.StartUp within the 'Special Functions and the Library' section (Pages 45 & 46 in v5.4 manual).

This was something I needed in the very early development days of the Library feature and it seemed to work just fine (both at RUN time and at Command Prompt )

I do however remember that the Library feature was developed further after my initial tests so I hope this will still perform in the same way for you.

WW
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5091
Posted: 08:36am 24 Aug 2018
Copy link to clipboard 
Print this post

Hi WhiteWizzard,

I tried with a little code in MM.STARTUP

Sub MM.STARTUP
Const H1=26
End Sub


Did a library save (after deleting all libraries, so this is the only one in the library), checked with memory that there is actually a library (1k size) added, and rebooted the mx170.

Then typed
> print H1
0

That did not result in H1 getting a value in either commandline or in program run mode. Then I read the note in the MM.STARTUP section:

  Quote  Note that you should not use MM.STARTUP for general setup of MMBasic (like dimensioning arrays, opening
communication channels, etc) before running a program. The reason is that when you use the RUN command
MMBasic will clear the interpreter's state ready for a fresh start. If you do want to setup MMBasic like this you
can place the code for this in the LIBRARY (but not in a subroutine or function) as this is run after the RUN
command has reset the interpreter's state but before the program in main memory is run.


So that is not an option.
Edited by Volhout 2018-08-25
PicomiteVGA PETSCII ROBOTS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10315
Posted: 08:58am 24 Aug 2018
Copy link to clipboard 
Print this post

Try this in the library

Sub MM.STARTUP
DIM INTEGER H1=26
End Sub
Edited by matherp 2018-08-25
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5091
Posted: 09:22am 24 Aug 2018
Copy link to clipboard 
Print this post

Hi matherp,

When I try
Sub MM.STARTUP
DIM INTEGER H1=26
End Sub


library save, and reboot

then the result is
commandline: print H1 gives 26
run a program: print H1 gives 0
library delete

Sub MM.STARTUP
CONST H1=26
End Sub


library save, and reboot

then the result is
commandline: print H1 gives 0
run a program: print H1 gives 0
library delete

Sub MM.STARTUP
H1=26
End Sub


library save, and reboot

then the result is
commandline: print H1 gives 26
run a program: print H1 gives 0

Using
Micromite MKII MMBasic Ver 5.04.10 Beta 9
Copyright 2011-2018 Geoff Graham

The latest....

PicomiteVGA PETSCII ROBOTS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10315
Posted: 10:01am 24 Aug 2018
Copy link to clipboard 
Print this post

  Quote  then the result is
commandline: print H1 gives 26
run a program: print H1 gives 0
library delete


Just add a call to MM.STARTUP at the top of your program then H1 will be set after reset and in a program
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5091
Posted: 10:47am 24 Aug 2018
Copy link to clipboard 
Print this post

you are correct, that works.

The thing I do not understand is that it does not work with CONST H1=26

Using a CONST was great because it cannot be changed afterwards.
It gives robustness and prevents double use of variables especially in larger programs.
Remember, once it is saved in the library, the variables existence is invisible to the outside world (meaning commandline and the running program).

Anyway, a solution is found....

Thanks you

Volhout


PicomiteVGA PETSCII ROBOTS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10315
Posted: 10:57am 24 Aug 2018
Copy link to clipboard 
Print this post

  Quote  The thing I do not understand is that it does not work with CONST H1=26


Constants only have scope within the subroutine in which they are defined. Global constants are defined in the main program but that doesn't work with MM.STARTUP

  Quote  prevents double use of variables especially in larger programs.


Use OPTION EXPLICIT and LOCAL and this protects you properlyEdited by matherp 2018-08-25
 
PicFan
Senior Member

Joined: 18/03/2014
Location: Austria
Posts: 133
Posted: 07:40pm 24 Aug 2018
Copy link to clipboard 
Print this post

Try this:

CONST H1 = 25
. . .


Library save

Rem main prog.
print H1

reboot
run

WolfgangEdited by PicFan 2018-08-26
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5091
Posted: 07:19am 27 Aug 2018
Copy link to clipboard 
Print this post

Result is the same.
Works in the running program,
But not from commandline...

Volhout
PicomiteVGA PETSCII ROBOTS
 
Azure

Guru

Joined: 09/11/2017
Location: Australia
Posts: 446
Posted: 07:47am 27 Aug 2018
Copy link to clipboard 
Print this post

@Volhout

What you are trying to do is not a part of the 5.04.10 Beta. It is the way MM Basic (and most other basic interpreters) normally work.

This thread is supposed to be about new releases to beta 10 and testing the new features and changes in 5.04.10 Beta or if something is broken in this version that worked in previous verions.

I think it would be better if you continued any new posts about this in a new thread as it relates to all versions and is a feature request. That way it can continue the discussion without taking this thread off topic.
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5091
Posted: 08:21am 27 Aug 2018
Copy link to clipboard 
Print this post

Dear Azure,

You are correct. Apologies.
It started out as a feature request for this beta to Geoff.
And resulted in a lot of well meant good advise for work arounds.
Geoff, sorry I hijacked your thread.

Let's focus on the features of 5.04.10 beta.....

Regards,

Volhout.
PicomiteVGA PETSCII ROBOTS
 
PicFan
Senior Member

Joined: 18/03/2014
Location: Austria
Posts: 133
Posted: 10:00am 28 Aug 2018
Copy link to clipboard 
Print this post

  PicFan said   Try this:

CONST H1 = 25
. . .


Library save

Rem main prog.
print H1

reboot
run

Wolfgang


Ctrl-C
MM-Edit Command line: print H1
25
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9610
Posted: 07:40am 04 Sep 2018
Copy link to clipboard 
Print this post

Pleased to be able to report that everything seems to work fine in this beta.

I must say that I LOVE the new textbox qwerty layout. Having the DEL key on both pages of keyboard makes for nice easy backspace when you type something wrong.

Also rather like the new cancel(Can) key. That too will be useful to have.(although, dealing with wrong input was easy enough once you touched Ent, but this is a nicer way to do it.)
Smoke makes things work. When the smoke gets out, it stops!
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 1003
Posted: 10:20am 11 Oct 2018
Copy link to clipboard 
Print this post

out of memory errors when a string was passed to a SUB or FUNCTION
An error fixed in 5.04.08 now appears in 5.04.09 and 5.04.10 Beta9
with MX170 chip.


Change log for Micromite MMBasic Ver 5.04.08

Bug Fixes:

* Corrected a bug which caused EXIT DO to skip the first line after the LOOP command.

* Corrected a bug which caused EXIT FOR to fail if the whole FOR loop was on a single line
(with colons as command separators).

* Fixed a bug which could cause out of memory errors when a string was passed to a SUB or FUNCTION.


The code below loops forever on 5.04.08
Running on 5.04.09 or 5.04.10 beta9 it fails with Error: Not enough memory
on the third iteration of the loop


  Quote  Option Explicit
DIM STRING cleartext
DIM integer gain1(4)=(257,247,225,180,22)
DIM integer x

do
x=x+
1
DisplayValue
300,134,"CH1 "+str$(gain1(0))+" "+str$(gain1(1))+" "+str$(gain1(2))+" "+str$(gain1(3))+" "+str$(gain1(4))
print x
loop

SUB DisplayValue x As integer, y As integer, s As STRING
'TEXT x,y,cleartext,CM,fStandard,,RGB(blue),RGB(blue)
'TEXT x,y,s,CM,fStandard,,RGB(white),cBGnd
cleartext=string$(len(s)," ")
END SUB



The error showed up when I upgraded a larger program, but this code is enough to
reproduce it. An LCD is not required, just an MX170 chip with MMMbasic.

Can someone confirm they get the same thing.

Regards
Gerry



Latest F4 Latest H7 FotS
 
Vito
Newbie

Joined: 11/10/2016
Location: Australia
Posts: 17
Posted: 10:45am 11 Oct 2018
Copy link to clipboard 
Print this post

Yes on version 5.4.1

Something is not freeing RAM after executing SUB.

Place a memory statement after x=x+1 in DO loop, will print whats happening to RAM.

Option Explicit
DIM STRING cleartext
DIM integer gain1(4)=(257,247,225,180,22)
DIM integer x

do
x=x+1
Memory
DisplayValue 300,134,"CH1 "+str$(gain1(0))+" "+str$(gain1(1))+" "+str$(gain1(2))+" "+str$(gain1(3))+" "+str$(gain1(4))
print x
loop

SUB DisplayValue x As integer, y As integer, s As STRING
'TEXT x,y,cleartext,CM,fStandard,,RGB(blue),RGB(blue)
'TEXT x,y,s,CM,fStandard,,RGB(white),cBGnd
cleartext=string$(len(s)," ")
END SUB
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 1003
Posted: 06:44am 14 Oct 2018
Copy link to clipboard 
Print this post

Hi Geoff,

Here is another code snippet that runs OK under 5.04.08 but fails under 5.04.09 and 5.04.10 beta 9.

It is using the longstring Cfunctions.Not sure if it is connected to out of memory error above or something different.

  Quote  ' This code run OK on MMbasic 5.04.08 however
'it fails on MMBasic 5.04.09 and 5.04.10 Beta9
CONST longStringMaxLen=4096
option autorun on

dim float htmlBuffer(longStringMaxLen/4)
dim AS INTEGER i

readHTMLTemplate

?
"DONE",mm.ver
end

sub readHTMLTemplate
LOCAL string A(16)
for i= 1 to 16
A(i)=
string$(254,"X")
next i

SClear htmlBuffer()

for i = 1 to 16
? i,
" - ";
pause 1000
SAddStr htmlBuffer(), A(i)
? SLen(htmlBuffer())
next i
end sub

CSub SAddStr float, string
00000000
10800011 00000000 10A0000F 00000000 90A30000 8C820000 00623021 1060000A
AC860000
24420004 00822021 24A50001 00831821 90A20000 A0820000 24840001
1483FFFC 24A50001 03E00008 00000000
end CSub

CSub SClear float
00000000 54800001 AC800000 03E00008 00000000
end CSub

CFunction SLen (float) INTEGER
00000000
10800005 00003821 8C860000 00C01021 03E00008 00E01821 00003021 00C01021
03E00008 00E01821
end CFunction





It gives the following error

> RUN
1 - 254
2 - 508
3 - 762
4 -

CPU exception #6 (bus error on ifetch) at address 0x58585858
Processor restarted


It originally came to light here

Regards
Gerry


Edited by disco4now 2018-10-15
Latest F4 Latest H7 FotS
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3292
Posted: 06:41am 22 Oct 2018
Copy link to clipboard 
Print this post

Thanks guys, both examples fail for me also.

This is half the battle - getting something simple that demonstrates the problem. Now that I have this I can start chasing the cause.

I will get back to you.

GeoffEdited by Geoffg 2018-10-23
Geoff Graham - http://geoffg.net
 
     Page 2 of 4    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025