![]() |
Forum Index : Microcontroller and PC projects : Micromite and Micromite Plus Beta 30
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
CFLY![]() Regular Member ![]() Joined: 20/05/2015 Location: FrancePosts: 41 |
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: FrancePosts: 41 |
Same pb with B29. Ok with with B23. |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10315 |
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: FrancePosts: 41 |
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 KingdomPosts: 10315 |
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 AfricaPosts: 280 |
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: AustraliaPosts: 3292 |
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: AustraliaPosts: 6283 |
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 KingdomPosts: 2944 |
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. ![]() WW |
||||
WhiteWizzard Guru ![]() Joined: 05/04/2013 Location: United KingdomPosts: 2944 |
![]() 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 ZealandPosts: 2442 |
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: ThailandPosts: 2209 |
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 AfricaPosts: 280 |
.... 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 KingdomPosts: 2944 |
![]() 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!!) |
||||
WhiteWizzard Guru ![]() Joined: 05/04/2013 Location: United KingdomPosts: 2944 |
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) WW |
||||
MicroBlocks![]() Guru ![]() Joined: 12/05/2012 Location: ThailandPosts: 2209 |
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 AfricaPosts: 280 |
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. http://caroper.blogspot.com/ |
||||
kiiid Guru ![]() Joined: 11/05/2013 Location: United KingdomPosts: 671 |
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 ZealandPosts: 2442 |
![]() 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 KingdomPosts: 2944 |
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'. . . . |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |