Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 07:09 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 and Micromite Plus Beta 30

     Page 2 of 3    
Author Message
CFLY

Regular Member

Joined: 20/05/2015
Location: France
Posts: 41
Posted: 02:49am 17 Sep 2015
Copy link to clipboard 
Print this post

With MMBasic V4.7 B30, display 5' (480x800), after gui calibration ok, pb with touch(x) ... same value as touch(y) !!!
 
CFLY

Regular Member

Joined: 20/05/2015
Location: France
Posts: 41
Posted: 03:03am 17 Sep 2015
Copy link to clipboard 
Print this post

Same pb with B29.
Ok with with B23.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10315
Posted: 03:15am 17 Sep 2015
Copy link to clipboard 
Print this post

  Quote  Same pb with B29.
Ok with with B23.


I've let Geoff know about this, I think it is a bug relating to some rework of Touch he did for me to help support loadable drivers

I assume "GUI TEST TOUCH" works fine?
 
CFLY

Regular Member

Joined: 20/05/2015
Location: France
Posts: 41
Posted: 03:19am 17 Sep 2015
Copy link to clipboard 
Print this post

Yes "GUI TEST TOUCH" works fine for B29 and B30 ... but with B23, there is the old pb gap for X position ...
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10315
Posted: 03:21am 17 Sep 2015
Copy link to clipboard 
Print this post

  Quote  That makes sense so I tried this:


Const ds4 = 4
Const ds3 = 5
Const ds2 = 6
Const ds1 = 7
Const sw1 = 16
Const rp1 = 26

Sub mm.startup
Print "LPCDB Edition"
setpin ds4, dout
setpin ds3, dout
setpin ds2, dout
setpin ds1, dout
setpin sw1, din
setpin rp1, ain
End Sub



Try this


if not ds1 then
Const ds4 = 4
Const ds3 = 5
Const ds2 = 6
Const ds1 = 7
Const sw1 = 16
Const rp1 = 26
endif
Print "LPCDB Edition"
setpin ds4, dout
setpin ds3, dout
setpin ds2, dout
setpin ds1, dout
setpin sw1, din
setpin rp1, ain


works for me
 
Chris Roper
Senior Member

Joined: 19/05/2015
Location: South Africa
Posts: 280
Posted: 04:21am 17 Sep 2015
Copy link to clipboard 
Print this post

  matherp said   Try this


if not ds1 then
Const ds4 = 4
Const ds3 = 5
Const ds2 = 6
Const ds1 = 7
Const sw1 = 16
Const rp1 = 26
endif
Print "LPCDB Edition"
setpin ds4, dout
setpin ds3, dout
setpin ds2, dout
setpin ds1, dout
setpin sw1, din
setpin rp1, ain


works for me


Not for me
[code]
> list
If Not ds1 Then
Const ds4 = 4
Const ds3 = 5
Const ds2 = 6
Const ds1 = 7
Const sw1 = 16
Const rp1 = 26
EndIf
Print "LPCDB Edition"
SetPin ds4, dout
SetPin ds3, dout
SetPin ds2, dout
SetPin ds1, dout
SetPin sw1, din
SetPin rp1, ain
> library save
> Micromite MKII MMBasic Ver 4.7 Beta 30
Copyright 2011-2015 Geoff Graham

> ? ds1
0
>
[/code]

What am I doing wrong ?

Cheers
Chris

http://caroper.blogspot.com/
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3292
Posted: 01:06pm 17 Sep 2015
Copy link to clipboard 
Print this post

Gosh, so many comments in such a short time! I only have a short time this morning before I have to leave for the day so I will try to get to the bottom of the biggest issue and answer the other points later.

Regarding the clearing of I/O pins and variables - The way that MMBasic works is this:

- On power up MMBasic resets everything (incl I/O and the variable table). Then MM.STARTUP is run but any code in the library is NOT run.

- When a program terminates (for any reason) MMBasic does NOT clear the I/O or variable table. This is so that you can use the CONTINUE command if you need to.

- When you use a command at the command prompt MMBasic does not clear the I/O or variable table. This is so that you can examine variables (eg, PRINT Var) and test I/O. It also means that you can use the CONTINUE command to actually continue.

- When you type RUN (or use F2 within the editor) MMBasic will first reset everything (incl I/O and the variable table including constants). This is so that the program starts in a known state. Then the code in the library area which is not part of any sub/fun is run. Then the program in main memory is run from the beginning.

So, the following sequence occurs in a normal power on situation where a program is in memory and you type RUN:
- At power up all I/O and variables are cleared.
- The code in MM.STARTUP is run.
- The command prompt is displayed.
- You type RUN.
- All I/O and variables are cleared.
- The library code is run.
- The program in main memory is run.

The same sequence occurs if AUTORUN ON is used except that the command prompt is not displayed and you do not have to type RUN.

As you can see, there is no point in setting constants or I/O in MM.STARTUP because they will be cleared when RUN is executed. MM.STARTUP is intended for running things like Peter's initialisation code for his CFunction display drivers, setting the internal clock, asking for a password, etc. You can also print a special banner, cause a startup delay, etc.

You should use the library code if you want to setup I/O, define constants, set options (like OPTION EXPLICIT), set colours, etc. These will always be set when a program starts running for whatever reason (RUN, AUTORUN, editor F2, etc). If you wanted these features to be set at the command prompt at first startup you could duplicate them in MM.STARTUP (the only exception is CONST which is local to the subroutine).

I must run now but I will get back to the other points later.

Geoff
Geoff Graham - http://geoffg.net
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 01:33pm 17 Sep 2015
Copy link to clipboard 
Print this post

  CFLY said   Geoff, Jim

With MMbasic V4.7 B30, MMEdit 3.6.4 and Micromite+ Explore64 (just received) connected by the USB:
When I make:
PUSH RESET SWITCH => card disconnected
CPU RESTART => card disconnected
OPTION LIST => card disconnected
After, I disconnect the card, I restart MMEdit, and I redo the connection.

Pb known?


There is a problem with MM+ and windows 10 but that is not your main issue.
Whenever you reset the MM+, the USB is also reset. Windows doesn't like this so any terminal program will have problems.

I find that a separate USB-TTL adapter is easier to use.
There has been discussion about this here but I am away from home and using a small screen so I fin it difficult to look for the posts.

I also have to wait till I return home to play with beta30

Jim

VK7JH
MMedit
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2944
Posted: 02:16pm 17 Sep 2015
Copy link to clipboard 
Print this post

  Geoffg said  . . .You should use the library code if you want to . . set colours, etc. . .If you wanted these features to be set at the command prompt at first startup you could duplicate them in MM.STARTUP (the only exception is CONST which is local to the subroutine).


Unfortunately when I set COLOUR x,y in MM.Startup, it does not keep the colour settings after power-up/reset. It defaults to white on black. Is this a bug?

WW
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2944
Posted: 02:29pm 17 Sep 2015
Copy link to clipboard 
Print this post

  Geoffg said  As you can see, there is no point in setting constants or I/O in MM.STARTUP because they will be cleared when RUN is executed.


It would be extremely useful to define pin names (I would assume with CONST?) so that you can 'address' pins by name at the command prompt (as well as a running program). I know this is something Chris is also trying to achieve and no doubt many others will probably find this a useful feature.

Obviously this is easy to achieve for a running program (tested and works brilliantly) - it is the command prompt that is the 'missing' thing at the moment I believe (unless there is a secret way to achieve it )


 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2442
Posted: 04:57pm 17 Sep 2015
Copy link to clipboard 
Print this post

  WhiteWizzard said  It would be extremely useful to define pin names (I would assume with CONST?) so that you can 'address' pins by name at the command prompt (as well as a running program). I know this is something Chris is also trying to achieve and no doubt many others will probably find this a useful feature.

Const ds4 = 4
Const ds3 = 5
Const ds2 = 6
Const ds1 = 7
Const sw1 = 16
Const rp1 = 26


why???

why not just have the definitions at the start of your basic code? after running the code those constants are then available for use at the command prompt. after your code defines the constants it could even prompt the user asking if they wish to stop or carry on running.

these constant names, presumably, are quite specific to a given project/application so don't really seem to be something you'd want to have defined in a static library that sits permanently in your micromite beyond the scope of the current program you are developing.

or do you wish to have something arduino-like, where pins have names of D0, D1, D3... and A0, A1, A3...? i'm guessing this is avoided in mmbasic because with the 28-pin DIP it would just add a layer of confusion; there is clarity in using the numbering of the pins on the IC package. this, of course, breaks down when one goes to an SMD package on a PCB assembly.


cheers,
rob :-)
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 06:15pm 17 Sep 2015
Copy link to clipboard 
Print this post

  WhiteWizzard said  
  Geoffg said  As you can see, there is no point in setting constants or I/O in MM.STARTUP because they will be cleared when RUN is executed.

It would be extremely useful to define pin names (I would assume with CONST?) so that you can 'address' pins by name at the command prompt (as well as a running program). I know this is something Chris is also trying to achieve and no doubt many others will probably find this a useful feature.

Obviously this is easy to achieve for a running program (tested and works brilliantly) - it is the command prompt that is the 'missing' thing at the moment I believe (unless there is a secret way to achieve it )

If you want it at the command prompt would using DIM instead of CONST not work?

Microblocks. Build with logic.
 
Chris Roper
Senior Member

Joined: 19/05/2015
Location: South Africa
Posts: 280
Posted: 08:51pm 17 Sep 2015
Copy link to clipboard 
Print this post

  robert.rozee said   why???
....
these constant names, presumably, are quite specific to a given project/application so don't really seem to be something you'd want to have defined in a static library that sits permanently in your micromite beyond the scope of the current program you are developing.
cheers,
rob :-)


For Education and Experimentation.

One of the nicest features of BASIC for education is the immediate mode.
You can teach the student to type:

? 5 * 2 <enter>

and they get an immediate result without having to write a program.
How much more enlightening (pun Intended) to be able to type:

LED1 = ON

With a suitable board set up with Buttons, Lights, Buzzers, Pots, etc. It is a great platform to explore interacting with hardware, before actually stringing those actions together in a program.

the other reason being, in my case, the same board can accept virtually any device, PIC12, PIC16, PIC18, Micromite, Chipkit, Arduino ... and access the same hardware. but that hardware will be on different pins or ports for each device used, so naming them on start-up is far easier than digging out lookup tables each time a new device is used.

So yes, the definitions can go way beyond the scope of the current program.

Cheers
Chris






http://caroper.blogspot.com/
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2944
Posted: 08:52pm 17 Sep 2015
Copy link to clipboard 
Print this post

  robert.rozee said  . . . why not just have the definitions at the start of your basic code? after running the code those constants are then available for use at the command prompt. . .
But they are immediately 'lost' as soon as the editor is fired up (editor resets everything to obtain working space). There is a requirement to refer to pins at ANY time at the command prompt in a high volume (MicroMite based) product used by other people (i.e. not me)

  robert.rozee said  these constant names, presumably, are quite specific to a given project/application so don't really seem to be something you'd want to have defined in a static library that sits permanently in your micromite beyond the scope of the current program you are developing.
No. I need them PERMANENTLY named both inside the program (which as we all know is easy), AND named at the command prompt. The application is using the MicroMite as a learning tool to a user that will be in the Editor, the Command Prompt, and running their code. This is not a hobbyist environment running a dedicated program so pin A1 needs to always mean Pin 11 (for example)

  robert.rozee said  or do you wish to have something arduino-like, where pins have names of D0, D1, D3... and A0, A1, A3...?
Yes - something similar indeed. I have three mounting blocks referred to as Block A, B, and C. Each has five I/O pins. I want to refer to the fifteen I/Os as A1, A2, . . . C4, C5

  robert.rozee said  i'm guessing this is avoided in mmbasic because with the 28-pin DIP it would just add a layer of confusion; there is clarity in using the numbering of the pins on the IC package. . .
Totally agree - the pin numbering way of addressing pins is fantastic - especially in a hobbyist (or embedded controller) environment. However, for an educational tool (which is using 100% of the MicroMite features) used by 'beginners' learning to code; it is far easier to refer to Pins A1, A2, A3, A4 etc on the product that has been developed. Geoff has seen the product and we have discussed this pin referencing. I was simply hoping to use the new Library feature to address this requirement.

Hopefully this makes it a little clearer

WW

EDIT: Thanks Chris - explained the point which if two of us are talking about it then no doubt others will require it (hello MMAndy!!)Edited by WhiteWizzard 2015-09-19
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2944
Posted: 08:59pm 17 Sep 2015
Copy link to clipboard 
Print this post

  TZAdvantage said  If you want it at the command prompt would using DIM instead of CONST not work?

Yes it does work (as per an earlier post) BUT has the big disadvantage that the editor 'resets' all values to zero. Hence an earlier post seeing if it is possible to have a Library sub that can run automatically whenever the Command Prompt is entered so we can set the pin references up again for use at the command prompt i.e. SUB MM.CPrompt (similar to SUB MM.StartUp). Obviously there is no need to reference pins by name within the editor. However, it would also be useful (for numerous reasons I could mention) to have a SUB MM.EDITOR too - then total 'customisation' is possible to the MMBasic environment (not really useful in an embedded environment - BUT extremely useful in the 'using a MM as a computer' scenario!

If this were possible then everything would work with DIM as required. Issue then becomes can we then use CONST somehow without MMBasic saying Const already defined (using something like PMather has highlighted)

WWEdited by WhiteWizzard 2015-09-19
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 09:09pm 17 Sep 2015
Copy link to clipboard 
Print this post

I can understand Geoff's point. CONST is already a part of basic and changing it to suit this particular problem is probably not worth it.
It might be better to solve this problem using another keyword or maybe use OPTION.
Maybe a DEFINE can be used.
[code]
DEFINE LED1 = 11
[/code]
or
[code]
OPTION DEFINE LED1 = 11
[/code]
Just as an example
OPTION might be a good keyword as that has already the facility to store the values in flash.



Microblocks. Build with logic.
 
Chris Roper
Senior Member

Joined: 19/05/2015
Location: South Africa
Posts: 280
Posted: 09:11pm 17 Sep 2015
Copy link to clipboard 
Print this post

Wouldn't the simplest answer be to just change the scope and say Constants are Global?

Persistent variables could be useful but not essential, but constants are generally expected to be part of the system and used anywhere, such as TRUE, FALSE, ON, OFF and user extensions such as LED1, LDR1 etc.

Are constants stored in the variable Table at Runtime or in Flash?
How about a new command:

Const Global LED1 = 7

Cheers
Chris

P.S. Just realized that ZTA said basically the same thing at the same time :)
I do like the Define Idea, but Geoff prefers to extend current commands to save tokens.
Edited by Chris Roper 2015-09-19
http://caroper.blogspot.com/
 
kiiid

Guru

Joined: 11/05/2013
Location: United Kingdom
Posts: 671
Posted: 11:36pm 17 Sep 2015
Copy link to clipboard 
Print this post

Geoff, would it be possible and easy enough to have local constants (something like CONST LOCAL or LOCAL CONST construction), and enumerated constants, for example something like CONST ENUM vehicle = (car, truck, bike, motorcycle)
Thanks
http://rittle.org

--------------
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2442
Posted: 03:30am 18 Sep 2015
Copy link to clipboard 
Print this post

  WhiteWizzard said  No. I need them PERMANENTLY named both inside the program (which as we all know is easy), AND named at the command prompt. The application is using the MicroMite as a learning tool to a user that will be in the Editor, the Command Prompt, and running their code. This is not a hobbyist environment running a dedicated program so pin A1 needs to always mean Pin 11 (for example)


what happens when one of the many many many* kids types LIBRARY DELETE or LIBRARY SAVE at the command prompt? or holds down '!' while the micromite is starting up? and what if that same kid is just a litttle bit naughty, and quietly does the same thing to every one of the micromites in the class set?

i am afraid that of the many many many* kids that come into contact with the micromites set up like this, one of those kids will do just this. and then another one. and another.

in an educational environment things need to be (a) bulletproof, and, (b) easy to recover back to the initial setup when requirement (a) fails. what you are discussing can, as far as i can see, only really be accomplished with a customized version of micromite basic with your constants hard-coded into the C source code. or giving each teacher a PICkit 3 preloaded with a previously configured image, but then that creates a whole new can of worms.


cheers,
rob :-)
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2944
Posted: 03:46am 18 Sep 2015
Copy link to clipboard 
Print this post

  robert.rozee said  in an educational environment things need to be (a) bulletproof, and, (b) easy to recover back to the initial setup when requirement (a) fails. what you are discussing can, as far as i can see, only really be accomplished with a customized version of micromite basic

Bullet-proof is something we are working on for the obvious reasons you highlight. Now consider a 'customised' version with certain things turned off/disabled

So with no Library SAVE or DELETE, no '!' reset feature, and a few other things disabled too it can become 'bullet-proof'. . . .

 
     Page 2 of 3    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025