|
Forum Index : Microcontroller and PC projects : New Version Micromite Firmware V5.05.01
| Page 1 of 2 |
|||||
| Author | Message | ||||
| Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3308 |
A new version of MMBasic (ver 5.05.01) for the Micromite, Micromite Plus and Windows/DOS is available and can be downloaded by following this link: http://geoffg.net/micromite.html (scroll to the bottom of the page). This release is basically the last beta release (V5.04.10 Beta 13) with the documentation updated. Compared to V5.04.09 this fixes a number of bugs and introduces some new features including multicolour analogue gauge controls for the Micromite Plus. One of the bugs fixed in this release could cause out of memory errors when string expressions were used in the parameter list of user defined subroutines and functions. This was a serious bug and for this reason it is recommended that systems using V5.04.09 be upgraded to this version. The source on http://mmbasic.com has been updated for anyone who is interested. Again, thanks to everyone who tried the beta versions and even more thanks to the guys who found bugs and reported them. Hopefully this release will be bug free but that is often a vain hope so if you do find a bug please let me know in this thread. Geoff Geoff Graham - http://geoffg.net |
||||
| Paul_L Guru Joined: 03/03/2016 Location: United StatesPosts: 769 |
Sorry Geoff but I think I found a couple of bugs, one when loading a program, one concerning the manuals. I tested the DOS v5.05.01 and v5.04.08 as follows. I have this autorun.bas file in the directory. print "autorun.bas is loading t1.bas" load "t1.bas" list all I also have this t1.bas file in the directory. t1=Timer For i=1 To 10000 Print i; Next i t2=Timer Print t2-t1 When I start MMBasic v5.05.01 or v5.04.08 both fail to list the program like this. DOS MMBasic Ver 5.04.08 Copyright 2011-2017 Geoff Graham autorun.bas is loading t1.bas [4] Next i Error: Invalid character ╬ A subsequent list command lists the t1.bas program perfectly, and a subsequent run command runs t1.bas perfectly. If I edit t1.bas with the built in editor to remove the i variable after NEXT, then save t1.bas, quit MMBasic, and restart MMBasic it lists the program as it should. If I edit t1.bas with the built in editor to remove the i variable after NEXT, and then reinsert the i variable after NEXT, then save t1.bas, quit MMBasic, and restart MMBasic it produces a different error message as follows. autorun.bas is loading t1.bas [4] Next i Error: Invalid syntax File this under things that make you go hmmmmmm.... =========================== A peculiarity of the interpreter is exposed when you run t1.bas. The first run under 5.04.08 produces a time of 1891 ms, the second run 1720 ms, the third and later 1680 ms. V 5.05.01 is slightly faster than 5.0408. I presume the interpreter maps the jumps on the first run which slows it down. =========================== The presence of the graphic ╬ (chr$ 206) in the error report caused me to check the DOS manual for the NEXT command. I thought you might have eliminated the ability to specify a variable after the NEXT keyword. I couldn't find NEXT in the commands in the manual for DOS v5.04.08 or v5.05.01. NAME is followed by OPEN fnam$ and then OPEN comspec$. After searching for NEXT I found it out of alphabetical order. OPEN comspec$ is followed by NEW, then by NEXT, then by ON ERROR ABORT. The manual for ver 4.5 (non DOS version) has the correct alphabetical order, that is NAME old$ AS new$, then NEW, then NEXT, then ON nbr GOTO|GOSUB, then ON KEY. I suspect that when you generated the DOS manual from the PIC manual year ago somehow the order got mixed up, probably when you removed the ON ERROR command from the DOS version. ============================ Why did you remove the ON ERROR command from the DOS version? Paul in NY |
||||
| Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1646 |
While we are picking on the manual: In the Micromite MMBasic manual the commands: CSUB and CFUNCTION are not in alphabetical order. I was looking for the CLOSE command and got down to CSUB and thought 'it's not here' and resorted to using 'find' in the PDF document and of course it was there just a couple of commands down. OK, maybe I'm old and easily confused but it did confuse me for a while. ON ERROR is in the DOS version isn't it? Thanks for clearing up the LOF() explanation but isn't the transmit buffer fixed at 256 bytes? Bill Keep safe. Live long and prosper. |
||||
| Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3308 |
Thanks, this is actually a failure to generate an error message. The second line in autoexec.bas causes MMBasic to load t1.bas while it is still running the original program (autorun.bas). As a result MMBasic gets confused because the code that it is executing has suddenly changed. LOAD "file" should generate an error message if it is run from inside a program. LOAD "file",R is OK as that can be run from both the command prompt and within a program. Thanks for the errors in the manuals. ON ERROR is in the DOS version - it was just not sorted into the correct position in the manual. The differing times are probably just an artefact of Windows. It is running lots of processes and sometimes MMBasic.exe gets less attention than the rest. Thanks for that Bill, I will change the manual. While I am at it I think that I will change the CLOSE on a serial port to wait until all characters have left the UART. In some cases it might introduce a slight delay but it is better than someone having their transmission chopped off abruptly because they were not aware of the buffering on the output. Geoff Geoff Graham - http://geoffg.net |
||||
Grogster![]() Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9753 |
The latest firmware Change Log talks about Configuration Options in a Program.pdf and gauges.pdf - but I cannot find them in this zip. Does not really matter - the updated manual probably told me what I needed to know, but.... Smoke makes things work. When the smoke gets out, it stops! |
||||
| Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1646 |
@Grogster, The change log says the gauges pdf is in the BETA distribution. It appears to be the same as what is included in the manual. Bill Keep safe. Live long and prosper. |
||||
Grogster![]() Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9753 |
Oh, thanks. ![]() I will dig out the beta zip then. It does say exactly that in the Change Log......my eyes sometimes..... Smoke makes things work. When the smoke gets out, it stops! |
||||
| Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3308 |
That text was left over from the beta program The manuals have been updated so look in the Micromite Plus Manual for the details. Geoff Graham - http://geoffg.net |
||||
| GoodToGo! Senior Member Joined: 23/04/2017 Location: AustraliaPosts: 188 |
Hmmm, Got an issue with some code after I upgraded from 5.04.09 to 5.05.01. Unfortunately I wasn't able to try the various 5.04.10 Betas on this unit. The function causing the issue is this:- function Current_mA(Channel) 'Gets the current value in mA ReadRegister(Channel, INA219_REGISTER_CURRENT, Value) if BitGet(Value,15) = 1 then Value = - (Value xor &hFFFF) + 1 'Change negative number (in 2's complement) to positive number if debug then print "Channel = "+str$(Channel) if debug then print "Value = "+str$(Value) if debug then print "INA219_currentDivider_mA = "+str$(INA219_currentDivider_mA) Current_mA(Channel) = (Value / INA219_currentDivider_mA) end function With the result being:- > ? mm.ver 5.0501 > > run Measuring Startup Current Channel 1 Channel = 1 Value = 0 INA219_currentDivider_mA = 10 [663] Current_mA(Channel) = (Value / INA219_currentDivider_mA) Error: Array dimensions > I can't understand why it's complaining about Array dimensions? The function name is correct, and the variable 'channel' is 1. If I downgrade back to 5.04.09 then the code runs fine. The only 5.04.10 Beta I had was Beta 9, which when loaded gave me the Out of Memory error bug. I note from the change log:- But OPTION EXPLICIT is in force. Maybe this is the issue? Does this mean that I have to declare any function name that is an array? Confused GTG! ...... Don't worry mate, it'll be GoodToGo! |
||||
| Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3308 |
When you set the return value of a function you do it by assigning the value to the name of the function. In your program that is Current_mA (ie, you do not include the parameter list). So your line should look like this: Current_mA = (Value / INA219_currentDivider_mA) In previous versions MMBasic would have noted that Current_mA was not an array (which is what the brackets implied) and quietly carried on. In the latest version I tightened up the error checking which is good because it highlighted something not right. No, the function is not an array - it is a program module and you are passing a value for it to work on. I agree that it is confusing because in BASIC an array and a function look the same (blame Bill, he defined much of this syntax). Geoff Graham - http://geoffg.net |
||||
| GoodToGo! Senior Member Joined: 23/04/2017 Location: AustraliaPosts: 188 |
Further to above, I think I've had a eureka moment. I have a feeling the code should probably be:- function Current_mA(Channel) 'Gets the current value in mA ReadRegister(Channel, INA219_REGISTER_CURRENT, Value) if BitGet(Value,15) = 1 then Value = - (Value xor &hFFFF) + 1 'Change negative number (in 2's complement) to positive number Current_mA = (Value / INA219_currentDivider_mA) end function As the return from the Function should be in Current_mA and not Current_mA(Channel) Stupid me. I take it that some array checking has been tightened up in the latest release? I had better go through the code and work out what other stuff-ups this will highlight now..... Cheers, GTG! ...... Don't worry mate, it'll be GoodToGo! |
||||
| GoodToGo! Senior Member Joined: 23/04/2017 Location: AustraliaPosts: 188 |
LOL! I must've been having my eureka moment while you were typing your reply!! Thanks Geoff! ...... Don't worry mate, it'll be GoodToGo! |
||||
| Paul_L Guru Joined: 03/03/2016 Location: United StatesPosts: 769 |
That would confuse me too. Got it! Nope! It is repeatable even with a changing number of iterations or the commenting out of the print command. The first run of the program is always 15% slower than any subsequent run for either v5.04 or v5.05. I'm guessing that the first run resolves some jumps and stores the results and it doesn't have to resolve the jumps in subsequent runs as long as the program is not edited or reloaded. BTW, V5.04 is always about 10% slower than v5.05. You must have cleaned something up! Beautiful job!!!!! Paul in NY |
||||
| Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3308 |
MMBasic does scan the code for subs, functions, etc but it does this every time the program is run. I still believe that the difference is down to some trickery inside Windows... another reason why I like interacting directly with the silicon - there is no one else's code involved. Geoff Geoff Graham - http://geoffg.net |
||||
| astro1 Regular Member Joined: 26/06/2016 Location: AustraliaPosts: 53 |
After a play command is run, the touch stops responding. do print touch(x) print touch(y) if touch(x) > 100 then play wav "am.wav" loop |
||||
| Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3308 |
Damn, I thought that I had fixed that one. Let me look at it and I will report back. Geoff Geoff Graham - http://geoffg.net |
||||
| Zonker Guru Joined: 18/08/2012 Location: United StatesPosts: 772 |
Was wondering if others have seen this... (maybe not)... I am on vacation this week, so I had some time to play with the new Gauges code... On the Temp bar gauge screen, I have 6 horizontal bar gauges (4 CHT - 2 EGT) All the gauges show up correctly on the screen just fine, but for some reason, I can't seem to put any values into the the 4 CHT gauges... But, the last 2 EGT gauges are working just fine... I wanted others to have a look/see of the attached code for the first part of the program... As far as I can tell, everything seems right to me... Thanks for any feed back on this..!! ' EIS Test Program v1 beta 9 - for MM+470 (64 pin device) ' Core firmware v5.05.01 ' option setups for the hardware... ' option console off (pin 6 used for SDcard) ' option display 36,127 (Teraterm) rows,colums ' option lcdpanel ILI9341,RLandscape,28,31,27 ' option SDcard 6,44 Option explicit ' must define all named values ' Define screen positions for bargraph gauges Const gaugebar_x=40 Const gaugebar_lenght=270 Const cht1_y=15 Const cht2_y=45 Const cht3_y=75 Const cht4_y=105 Const egt1_y=135 Const egt2_y=165 ' Define label names used as index #s for EIS screen objects Const flight_time=1 ' Objects for time display Const engine_hours=2 Const cht_led_frame=3 ' Objects for LED Status Const cht1_led=4 Const cht2_led=5 Const cht3_led=6 Const cht4_led=7 Const egt_led_frame=8 Const egt1_led=9 Const egt2_led=10 Const oil_led=11 Const bat_led=12 Const cht_digital_frame=13 ' Objects for digital readouts Const cht1_digital=14 Const cht1_caption=15 Const cht2_digital=16 Const cht2_caption=17 Const cht3_digital=18 Const cht3_caption=19 Const cht4_digital=20 Const cht4_caption=21 Const egt_digital_frame=22 Const egt1_digital=23 Const egt1_caption=24 Const egt2_digital=25 Const egt2_caption=26 Const oil_digital=27 Const oil_caption=28 Const bat_digital=29 Const bat_caption=30 Const bar_frame=31 ' objects for horzontal temp bargauges Const cht1_barcap=32 Const cht1_bar=33 Const cht2_barcap=34 Const cht2_bar=35 Const cht3_barcap=36 Const cht3_bar=37 Const cht4_barcap=38 Const cht4_bar=39 Const egt1_barcap=40 Const egt1_bar=41 Const egt2_barcap=42 Const egt2_bar=43 Const rpm_frame=44 ' objects for rpm and oil pressure gauges Const rpm_gauge=45 Const oil_bar=46 Const oil_cap=47 ' other fixed values Const liters_per_pluse=0.0025 ' flow sensor values Const gallons_per_pulse=0.00946352946 Const liters_in_gallon=3.785411784 ' convertion ' math should be 1514 pulses per gallon (1514.1647136) ' MM RAM Memory Dim current_screen=4 ' RPM/OIL display screen Dim kbdflag Dim button Dim display_led Dim LTCaverage Dim kbd_data$ ' byte storage for console input Dim op_data ' Oil Pressure Dim op_data_old Dim op_avg ' threshold values for showing 4 colors on the GUI objects ' White, green, yellow, red Dim cht_wg_sp=100 ' CHT Temp threshold value - white to green Dim cht_gy_sp=250 ' green to yellow Dim cht_yr_sp=350 ' yellow to red Dim egt_wg_sp=200 ' EGT Temp threshold value - white to green Dim egt_gy_sp=900 ' green to yellow Dim egt_yr_sp=1100 ' yellow to red Dim oil_rg_sp=15 ' OIL pressure threshold value - red to green Dim oil_gy_sp=60 ' green to yellow Dim oil_yr_sp=80 ' yellow to red Dim bat_ry_sp=10 ' BATTERY volts threshold value - red to yellow Dim bat_yg_sp=12 ' yellow to green Dim bat_gr_sp=15 ' green to red Dim rpm_max=7000 ' max rpm value shown on gauge scale Dim rpm_wg_sp=200 ' RPM threshold value - white to green Dim rpm_gy_sp=5000 ' green to yellow Dim rpm_yr_sp=6500 ' yellow to red Dim temp_cal=0 ' set to default temp offset Dim temp_comp_C ' temp compensation temp value in C Dim temp_comp_F ' temp compensation temp value in F Dim temp_CHT1_C ' temp value in C Dim temp_CHT1_F ' temp value in F Dim temp_CHT2_C Dim temp_CHT2_F Dim temp_CHT3_C Dim temp_CHT3_F Dim temp_CHT4_C Dim temp_CHT4_F Dim temp_EGT1_C Dim temp_EGT1_F Dim temp_EGT2_C Dim temp_EGT2_F Dim pulse_count ' fuel flow sensor count Dim pulse_count_old Dim liters_count ' 0.0025 liters per pulse Dim gallon_count ' 0.00946352946 gallons per pulse Dim fl_data ' Fuel Level % Dim fl_data_old Dim fl_avg Dim bl_data ' Battery Level % Dim bl_data_old Dim bl_avg ' LTC2983 temp IC memory Dim LTC_setup_change ' flag Dim LTC_ok ' IC present flag Dim junk ' junk data reg Dim LTCrxdata ' LTC Recieved data reg Dim byte0,byte1,byte2,byte3 ' data bytes from IC Dim LTCchannel_fault_data Dim LTCchannel_temp_data Dim ch1flt,ch1flt_old,ch1dat,ch1dat_old ' Temp Comp Sensor Dim ch10flt,ch10flt_old,ch10dat,ch10dat_old ' EGT 2 Dim ch12flt,ch12flt_old,ch12dat,ch12dat_old ' EGT 1 Dim ch14flt,ch14flt_old,ch14dat,ch14dat_old ' CHT 4 Dim ch16flt,ch16flt_old,ch16dat,ch16dat_old ' CHT 3 Dim ch18flt,ch18flt_old,ch18dat,ch18dat_old ' CHT 2 Dim ch20flt,ch20flt_old,ch20dat,ch20dat_old ' CHT 1 Dim LTC_conversion_completed ' Flag for LTC INT routine ' Memory Arrays to hold setup values of the sensor types used in the LTC2983 Dim diode(3) = (231,80,12,73) ' type 28,single ended,AVG on I factor=1.003 Dim jtype_D(3) = (8,96,0,0) ' J type,differental,comp channel=1,OC check ON Dim ktype_D(3) = (16,80,0,0) ' K type,differental,comp channel=1,OC check ON SetPin 48,dout ' LCD Display backlight Pin(48)=1 ' turn ON (for now) Font 4 CLS Time$="00:00:00" '--------- setup screen objects used to display EIS information to the user --------- 'GUI setup 1 ' time based objects GUI textbox flight_time,0,205,150,30,RGB(yellow) GUI numberbox engine_hours,170,205,150,30,RGB(yellow) CtrlVal(flight_time)=Time$ ' for now just set a value CtrlVal(engine_hours)=12345.6 'GUI setup 2 ' LED status objects GUI frame cht_led_frame,"",0,7,150,180,RGB(yellow) GUI led cht1_led,"CHT1",35,35,15,RGB(black) GUI led cht2_led,"CHT2",35,75,15,RGB(black) GUI led cht3_led,"CHT3",35,115,15,RGB(black) GUI led cht4_led,"CHT4",35,155,15,RGB(black) GUI frame egt_led_frame,"",170,7,150,180,RGB(yellow) GUI led egt1_led,"EGT1",205,35,15,RGB(black) GUI led egt2_led,"EGT2",205,75,15,RGB(black) GUI led oil_led,"OIL",205,115,15,RGB(black) GUI led bat_led,"BAT",205,155,15,RGB(black) CtrlVal(cht1_led)=1 ' for now just turn them on CtrlVal(cht2_led)=1 CtrlVal(cht3_led)=1 CtrlVal(cht4_led)=1 CtrlVal(egt1_led)=1 CtrlVal(egt2_led)=1 CtrlVal(oil_led)=1 CtrlVal(bat_led)=1 hide_led_objects 'GUI setup 3 ' digital readout based temp objects GUI frame cht_digital_frame,"",0,7,150,180,RGB(yellow) GUI numberbox cht1_digital,8,25,70,30,RGB(white) GUI caption cht1_caption,"CHT1",82,28 GUI numberbox cht2_digital,8,65,70,30,RGB(white) GUI caption cht2_caption,"CHT2",82,68 GUI numberbox cht3_digital,8,105,70,30,RGB(white) GUI caption cht3_caption,"CHT3",82,108 GUI numberbox cht4_digital,8,145,70,30,RGB(white) GUI caption cht4_caption,"CHT4",82,148 GUI frame egt_digital_frame,"",170,7,150,180,RGB(yellow) GUI numberbox egt1_digital,178,25,70,30,RGB(white) GUI caption egt1_caption,"EGT1",250,28 GUI numberbox egt2_digital,178,65,70,30,RGB(white) GUI caption egt2_caption,"EGT1",250,68 GUI numberbox oil_digital,178,105,70,30,RGB(white) GUI caption oil_caption,"OIL",260,108 GUI numberbox bat_digital,178,145,70,30,RGB(white) GUI caption bat_caption,"BAT",260,148 hide_digital_objects 'GUI setup 4 ' bargauge temp objects GUI frame bar_frame,"",0,7,320,186,RGB(yellow) GUI caption cht1_barcap,"C1",5,cht1_y GUI bargauge cht1_bar,gaugebar_x,cht1_y,gaugebar_lenght,18,,,100,400,RGB(white),cht_wg_sp,RGB(green),cht_gy_sp,RGB(yellow),cht_yr_sp, RGB(red) GUI caption cht2_barcap,"C2",5,cht2_y GUI bargauge cht2_bar,gaugebar_x,cht2_y,gaugebar_lenght,18,,,100,400,RGB(white),cht_wg_sp,RGB(green),cht_gy_sp,RGB(yellow),cht_yr_sp, RGB(red) GUI caption cht3_barcap,"C3",5,cht3_y GUI bargauge cht3_bar,gaugebar_x,cht3_y,gaugebar_lenght,18,,,100,400,RGB(white),cht_wg_sp,RGB(green),cht_gy_sp,RGB(yellow),cht_yr_sp, RGB(red) GUI caption cht4_barcap,"C4",5,cht4_y GUI bargauge cht4_bar,gaugebar_x,cht4_y,gaugebar_lenght,18,,,100,400,RGB(white),cht_wg_sp,RGB(green),cht_gy_sp,RGB(yellow),cht_yr_sp, RGB(red) GUI caption egt1_barcap,"E1",5,egt1_y GUI bargauge egt1_bar,gaugebar_x,egt1_y,gaugebar_lenght,18,,,100,1200,RGB(white),egt_wg_sp,RGB(green),egt_gy_sp,RGB(yellow),egt_yr_sp ,RGB(red) GUI caption egt2_barcap,"E2",5,egt2_y GUI bargauge egt2_bar,gaugebar_x,egt2_y,gaugebar_lenght,18,,,100,1200,RGB(white),egt_wg_sp,RGB(green),egt_gy_sp,RGB(yellow),egt_yr_sp ,RGB(red) CtrlVal(cht1_bar)=250 CtrlVal(cht2_bar)=250 CtrlVal(cht3_bar)=250 CtrlVal(cht4_bar)=250 CtrlVal(egt1_bar)=250 CtrlVal(egt2_bar)=250 End |
||||
| Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3308 |
No, it works fine. Did you actually test your example? Your program will fall over because it tries to play the sound while it is still playing from a previous loop. Also the repeated printing to the screen hides what is going on. This short program makes it much easier to test: Do If Touch(x) <> -1 Then Print Touch(x), Touch(y) If Touch(x) > 100 Then On Error Skip Play WAV "am.wav" EndIf EndIf Loop And this works fine (touch keeps responding). Geoff Geoff Graham - http://geoffg.net |
||||
| Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3308 |
I think that the problem is with this line: Dim cht_wg_sp=100 ' CHT Temp threshold value - white to green The minimum value for the gauge is 100 and you have set the first threshold also to 100. If you set the threshold a little higher than the minimum value it works: Dim cht_wg_sp=110 ' CHT Temp threshold value - white to green MMBasic should handle this better and I will look into it. Geoff Geoff Graham - http://geoffg.net |
||||
| Zonker Guru Joined: 18/08/2012 Location: United StatesPosts: 772 |
Big thanks Geoff..!! Looks like me being a dummy again.. |
||||
| Page 1 of 2 |
|||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |