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 Firmware Update V5.04.05
Page 1 of 2 | |||||
Author | Message | ||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3167 |
There is an updated version of the Micromite firmware which can be downloaded from http://geoffg.net/micromite.html (scroll to the bottom of the page). This is a minor upgrade and is released to fix annoying bugs in the LEFT$() function and the ERASE command. More details are in the Change Log which is included in the firmware download. There has been no significantly new functionality so the manuals have had only minor updates. Geoff Geoff Graham - http://geoffg.net |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 5923 |
Thanks for the I2C mod Geoff. If the weather warnings last night were right, you could be testing a lightning sensor now! Jim VK7JH MMedit MMBasic Help |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3167 |
Yes, the sky is what can only be described as "threateningly black". If I had a dog it would be climbing the walls right now. Geoff Graham - http://geoffg.net |
||||
lew247 Guru Joined: 23/12/2015 Location: United KingdomPosts: 1676 |
Geoff Am I right in thinking there is still no FIELD$() function for the MM? only for the extreme? |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3167 |
No, because it is so easy to implement in BASIC I will not include it in MMBasic. The language does not need to be cluttered with functions that can be encapsulated in a simple subroutine. Geoff Geoff Graham - http://geoffg.net |
||||
Phil23 Guru Joined: 27/03/2016 Location: AustraliaPosts: 1664 |
The only catch with these Simple Subroutines is either knowing they exist, and being able to find them. Maybe this could be addressed by Glenn creating a Sticky Post that can contain those code snippets. That would be a great asset to new comers visiting the site. There is the MMbasic Library Pinned thread, but it's well out of date. If Glenn's able to do this, with either 1 or 2 threads, I'm sure others would volunteer to administer that thread & move of delete posts as appropriate. Cheers Phil. |
||||
CircuitGizmos Guru Joined: 08/09/2011 Location: United StatesPosts: 1421 |
I've offered before and I'll offer again that the CG site can be used for library routines. The site is behind on updating. I would need help from some "librarians" to capture and annotate various library functions. Micromites and Maximites! - Beginning Maximite |
||||
CaptainBoing Guru Joined: 07/09/2016 Location: United KingdomPosts: 1994 |
This was discussed in a post a while back. There are two options detailed there. One I believe better than the other (for various reasons ) As Geoff said at the time when I set up the wiki, the problem is keeping the impetus - people forget to publish what they do. Several regular members of TBS have joined the wiki (membership makes it possible to contribute and critique articles - reading is open to all) there is lots of stuff that gets posted here that should be kept for posterity but isn't and forums are not meant to be code libraries. " * Dedicated to doing one task well. * No single "keeper" - Everyone can add articles at any time. * Everyone can police/correct/modify articles at any time. * Rich articles with pix & graphics to support the thinking behind. * Focused discussion. * Article history with roll-back. * Searchable within the wiki. * Searchable on the web. " At the time I set up the wiki, neither Geoff nor Hugh (the original keepers of the library) had the time or resources to maintain it and having a single person look after it with snippets "sent" in, as it was is frankly archaic - we can all contribute AND share the load - we all should. This wiki is a free, non-commercial, ad-free, up-to-date as we make it (community driven) method of making sure great stuff stays with the community and stays visible. h |
||||
piclover Senior Member Joined: 14/06/2015 Location: FrancePosts: 134 |
@ Geoff I think I found a bug in ACOS: targ is not set there... I also would like to see the two following changes adopted: - Addition of a MM.SPIOPEN flag (super-useful with touch screen that got the touch event processed in an interrupt, while other SPI devices might have opened the SPI port already and thus a SPI transaction in progress). It is super-easy, since the corresponding flag already exists in the firmware. It also costs almost nothing, firmware size wise. - Not resetting the pullup/pulldown status of digital pins when switching form a DIN to a FIN, CIN or PIN mode, which allows getting an easy way (i.e. without having to use a CFunction neither to extend the MMBASIC syntax for SETPIN) to get a pullup or pulldown resistor for the latter modes, by using two consecutive SETPIN commands, the first with DIN and the pull up/down status set, e.g. SETPIN 16,DIN,PULLUP;SETPIN 16,FIN The following patch implements all of the above. diff -durN --strip-trailing-cr Micromite-5.4.5/General/External.c Micromite-5.4.5-patched/General/External.c --- Micromite-5.4.5/General/External.c 2017-06-12 05:08:35.000000000 +0200 +++ Micromite-5.4.5-patched/General/External.c 2017-07-02 11:00:44.671507112 +0200 @@ -918,8 +918,10 @@ if(pin == INT3PIN) ConfigINT3(EXT_INT_PRI_2 | RISING_EDGE_INT | EXT_INT_DISABLE); if(pin == INT4PIN && IrState == IR_CLOSED) ConfigINT4(EXT_INT_PRI_2 | RISING_EDGE_INT | EXT_INT_DISABLE); - // make sure any pullups/pulldowns are removed in case we are changing from a digital input - PinSetBit(pin, CNPUCLR); PinSetBit(pin, CNPDCLR); + if (cfg != EXT_FREQ_IN && cfg != EXT_PER_IN && cfg != EXT_CNT_IN) { + // make sure any pullups/pulldowns are removed in case we are changing from a digital input + PinSetBit(pin, CNPUCLR); PinSetBit(pin, CNPDCLR); + } for(i = 0; i < NBRINTERRUPTS; i++) if(inttbl.pin == pin) diff -durN --strip-trailing-cr Micromite-5.4.5/General/MM_Custom.c Micromite-5.4.5-patched/General/MM_Custom.c --- Micromite-5.4.5/General/MM_Custom.c 2017-03-10 12:30:30.000000000 +0100 +++ Micromite-5.4.5-patched/General/MM_Custom.c 2017-07-02 11:00:44.698173779 +0200 @@ -14,7 +14,7 @@ #include "../MMBasic_Includes.h" #include "../Hardware_Includes.h" - +#include "SPI.h" /*********************************************************************************************************************** ** ************************************************************************************************************************ ** @@ -52,3 +52,7 @@ ************************************************************************************************************************ ********************/ +void fun_spiopen(void) { + iret = SPIOpen; + targ = T_INT; +} diff -durN --strip-trailing-cr Micromite-5.4.5/General/MM_Custom.h Micromite-5.4.5-patched/General/MM_Custom.h --- Micromite-5.4.5/General/MM_Custom.h 2017-05-13 03:12:52.000000000 +0200 +++ Micromite-5.4.5-patched/General/MM_Custom.h 2017-07-02 11:00:44.698173779 +0200 @@ -29,6 +29,8 @@ // void fun_???(void) // void op_???(void) +void fun_spiopen(void); + #endif @@ -55,5 +57,7 @@ // where type is T_NA, T_FUN, T_FNA or T_OPER augmented by the types T_STR and/or T_NBR // and P is the precedence (which is only used for operators) + { "MM.SPIOPEN", T_FNA | T_INT, 0, fun_spiopen }, + #endif diff -durN --strip-trailing-cr Micromite-5.4.5/MMBasic/Functions.c Micromite-5.4.5-patched/MMBasic/Functions.c --- Micromite-5.4.5/MMBasic/Functions.c 2017-06-14 09:32:40.000000000 +0200 +++ Micromite-5.4.5-patched/MMBasic/Functions.c 2017-07-21 01:04:28.364454616 +0200 @@ -702,6 +702,7 @@ } else { fret = 1.5707963268 - arcsinus(f); } + targ = T_NBR; } |
||||
lew247 Guru Joined: 23/12/2015 Location: United KingdomPosts: 1676 |
I've just upgraded my E100 board to V5.04.05 but I'm getting an error when I try and configure the display [quote] OPTION LCDPANEL SSD1963_7, LANDSCAPE, 53 Error: Pin 18 is reserved on startup >[/quote] Anyone got any ideas why or how to overcome this? This is my complete config parameters OPTION AUTORUN ON OPTION LCDPANEL SSD1963_7, LANDSCAPE, 53 OPTION TOUCH 50, 51 OPTION SDCARD 52 |
||||
disco4now Guru Joined: 18/12/2014 Location: AustraliaPosts: 844 |
Hi Lewis, Make sure you don't have any code like this in mm.startup sub mm.startup ' setrd(6)' set up the read pin end sub A CPU RESTART may be required if mm.startup has added anything. Do an OPTION LCDPANEL DISABLE use the following to re-enable LCD with the RD pin enabled OPTION LCDPANEL SSD1963_7,L,,6 'With RD pin for 5.03 onwards I think the options you suggest is not what is required on the E100. Below is what I am using I think. ' Commands for setting up the E100 board 'OPTION SDCARD 47 'OPTION LCDPANEL SSD1963_7,L,,6 'With RD pin for 5.03 onwards 'OPTION TOUCH 01,40 'OPTION TOUCH 01,40,39 'with piezo Latest F4 Latest H7 |
||||
lew247 Guru Joined: 23/12/2015 Location: United KingdomPosts: 1676 |
Thanks Gerry, I'll give that a try in the morning, I'll reflash the MM first then try it |
||||
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1141 |
Hi Geoff, I fear there is a bug in the way the MMBasic 5.04.05 handles "passed string arrays". There are no issues with MMBasic V5.0. The problem only affects strings (AFAIK). Enclosed you will find some demos. I hope they are helpful! 2017-08-29_190600_Bug_Report_passed_arrays.zip (edited!) Maybe this issue is somehow connected with the (very valuable) "Typed Parameters" for CFunctions? I hope you can fix that easily. Best regards Michael Edit: System: MX170/28 PS: I wanted to send this as pm, but it seems that I can not send zip attachments. Maybe something that an admin can change? |
||||
flip Senior Member Joined: 18/07/2016 Location: AustraliaPosts: 114 |
Hi twofingers, I tried your QuickSort - Passed Arrays BUG DEMO2.txt with MMBasic for DOS,and it failed as per output below.(last output for n was 1000 as per first line in below - just before crash) 1000 2027.952927 [54] t=arr(leftNIdx):arr(leftNIdx)=arr(rightNIdx):arr(rightNIdx)=t Error: String too long > trace list 50 [55][56][57][58][59][60][64][65][41][42][43][44][45][68][66][41][42][43][44][45][68][67][68][67][68][67][68][67][68][67][68][67][68][67][68][67][68][66][41][42][43][44][45][46][47][48][50][51][53][54] Interesting bit is the TRACE LIST..the code seems to repeat lines 68 & 67 NINE times !? I would expect that with recursion, but I know MMBasic doesn't support recursion. Lines [EDIT inserted 66] 67 & 68 (note order of these) are as follows: quicksort arr(), pivot + 1, rightN End If End Sub EVEN MORE interestingly,...typing CLEAR (or not) and re-running the program (it still fails at exactly the same point!) but it generates a different TRACE LIST result:(Edited 4:15UTC) [22][23][21][22][23][21][22][23][21][22][23][21][22][23][21][22][23][21][22][23][21][22][23][21][22][23][21][22][23][21][22][23][24][25][26][41][42][43][44][45][46][47][48][49][50][49][50][51][53][54] Hope this helps either you or Geoff diagnose the problem further! EDIT: answered your problem: ....you are attempting to use recursion which I believe is not supported by MMBASIC Geoff might confirm this. Regards, Phil |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 5923 |
I am not sure how deep you can go but recursion is certainly doable. A bit early for a Christmas tree but here it is anyway. (runs on a 240x320 display) Jim VK7JH MMedit MMBasic Help |
||||
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1141 |
Thanks Phil and Jim! @Phil In this case the recursion can't be the problem. All the code in the zip runs perfectly with MMBasic V5.0.0 (MX170/28). It runs also without issues if the string array is globally. But this is not very elegant or flexible: ' Working(!) DEMO for the "Passed Arrays" bug ' String array [q()] is globally '------------------------------------------------------------------------ 'Quicksort for strings using recursion 's. https://rosettacode.org/wiki/Sorting_algorithms/Quicksort ' Option base 0 Dim integer max = 1000 Dim string q(max) length 20, qo For n = 0 To max q(n)=Str$(Rnd()*10000,6) Print n,q(n) Next Timer= 0 Quicksort 0, max tx= Timer/1000 qo="" For n = 0 To max Print "#"n,q(n) If q(n)<qo Then Print" error":End qo=q(n) Next Print tx "sec" End ' Quicksort Sub quicksort (leftN As INTEGER, rightN As integer) Local pivot As integer, leftNIdx As INTEGER, rightNIdx As INTEGER Local t As string leftNIdx = leftN rightNIdx = rightN If (rightN - leftN) > 0 Then pivot = (leftN + rightN) / 2 Do While (leftNIdx <= pivot) And (rightNIdx >= pivot) Do While (q(leftNIdx) < q(pivot)) And (leftNIdx <= pivot) leftNIdx = leftNIdx + 1 Loop Do While (q(rightNIdx) > q(pivot)) And (rightNIdx >= pivot) rightNIdx = rightNIdx - 1 Loop t=q(leftNIdx):q(leftNIdx)=q(rightNIdx):q(rightNIdx)=t leftNIdx = leftNIdx + 1 rightNIdx = rightNIdx - 1 If (leftNIdx - 1) = pivot Then rightNIdx = rightNIdx + 1 pivot = rightNIdx ElseIf (rightNIdx + 1) = pivot Then leftNIdx = leftNIdx - 1 pivot = leftNIdx End If Loop quicksort leftN, pivot - 1 quicksort pivot + 1, rightN End If End Sub Interestingly, the code (Not the code above!) behaves differently depending on whether I run it from the edit window or command line. Very strange. Regards Michael |
||||
flip Senior Member Joined: 18/07/2016 Location: AustraliaPosts: 114 |
Well there you go. Something stuck in my head from early Maximite days about recursion not being available. Indeed it is in the manual. Thanks Michael & Jim for that So out of curiosity I pushed the limits: Dim MaxDepth%=0 Function Recurse(a$) As String Depth%=Depth%+1: If Depth%>MaxDepth% Then MaxDepth%=Depth% If Len(a$)=1 Then Recurse=a$ Else Recurse=Recurse(Mid$(a$,2)) EndIf End Function Dim a$ For i%=32 to 114 a$=a$+Chr$(i%) Depth%=0 ? Recurse(a$); Next i% ? ? "Max recursions tried:";MaxDepth%;", now trying 84..fails" For i%=32 to 115 a$=a$+Chr$(i%) Depth%=0 ? Recurse(a$); Next i% And I got 83 iterations only DOS MMBasic Ver 5.04.05 Beta 7 Copyright 2011-2017 Geoff Graham !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqr Max recursions tried: 83, now trying 84..fails [46] Recurse=Recurse(Mid$(a$,2)) Error: Not enough memory > Of course the stack usage could be consumed more by my program passing a String... So perhaps there are 3 symptoms of one problem? 1...Your original bug in 5.04.05 which I confirm in DOS version of same 2...I also confirm that with Michael's code behaves differently on subsequent runs 3...Stack Space can be used which reduces the 1000 iteration capacity [EDIT] Also tried Michael's test (running from EDIT window) with my code, but it still crashed at 84 iterations.[/EDIT] Hope it helps and just doesn't cause Geoff a wild goose chase! Regards, Phil |
||||
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1141 |
@Phil Thanks! Sometimes 5 eyes can see more than just 2! But please keep in mind that the Comb Sort examples don't use recursion. It took me days to catch this bug because sometimes he does not show up. If I can do something to clearify this issue, please let me know. Michael |
||||
flip Senior Member Joined: 18/07/2016 Location: AustraliaPosts: 114 |
Hi all, [Threadjack] As a matter of forum etiquette, 1. Am I doing the right thing in regards to piggybacking and testing and commenting? I can get over-excited sometimes and may need to tone down. I can get off-track but like to help get to the bottom of things. 2 Bug reports. Would Geoff / anyone be happier taking bug reports, discussions thereof or other off-line? ...reason being is that this is the first chat forum I've ever been involved with, I greatly enjoy all the contributions to this forum and contributors all are similarly interested as me - which is why I joined, and why I ask. MM is the most fun I've had over and above any programming language / Basic dialect. Happy to take any PM on this from anyone if preferred. [/Threadjack] [EDIT] Just saw your post Michael - will do some more thinking and testing [/EDIT]) Regards, Phil |
||||
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1141 |
Hi Phil, Just my opinion: @1: AFAIK you are doing nothing wrong, don't worry! @2: This can only Geoff answer, but AFAIK Geoff is very tough regarding bug reports. I confirm this can be a sensitive subject. In his code is so much work (life time and heart blood). But generally: I think it's always wise to think twice before the (two)fingers touch the keyboard. Michael |
||||
Page 1 of 2 |
Print this page |