Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 09:39 03 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 V5.04.09 Beta 19

     Page 4 of 5    
Author Message
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1882
Posted: 02:43am 24 Jun 2018
Copy link to clipboard 
Print this post

Pardon if this has been asked before, I'm using MMBasic Ver 5.04.09 Beta 19.

When a number like 12.1 is entered into the Keypad, the revised floating point number overwrites way past the limits of the button, so basically I have to use a button size that can fit 12 digits, this limits screen layout.

Is there a way to limit the value that the Keypad / Numberbox returns into the Numberbox control Button. I just want 12.1 to display not 12.10000038




NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3292
Posted: 03:55am 24 Jun 2018
Copy link to clipboard 
Print this post

Good point. I will look into it.

I'm about to release the final version of V5.04.09 and I will see if I can get the fix for this included.

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

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1882
Posted: 06:09am 24 Jun 2018
Copy link to clipboard 
Print this post

Thanks Geoff.
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1882
Posted: 02:14am 25 Jun 2018
Copy link to clipboard 
Print this post

Still having the problem with the NumberBox control changing from wanting a number assignment in normal code to a string inside the MM.KEYPRESS ISR.

Outside of MM.KEYPRESS -> CtrlVal(NumberBoxButton) = 1.23456

INSIDE of MM.KEYPRESS -> CtrlVal(NumberBoxButton) = 1.23456, now gives an error "Expecting a String"

Changing it to CtrlVal(NumberBoxButton) = "1.23456" and it's happy inside the ISR.

NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1882
Posted: 10:45am 25 Jun 2018
Copy link to clipboard 
Print this post

Is anyone else having trouble reading the value returned from a Numberbox, I mean retrieving it from the control into a variable? All I get is 1 or 0.

Same code as the version of MM.Basic I was using 8 months ago.
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1882
Posted: 08:42am 26 Jun 2018
Copy link to clipboard 
Print this post

It works outside of MM.Keypress and the control returns the correct numeric value, inside MM.Keypress the control returns only 1 or 0, the change from numeric to string for the control assignment also only happens inside MM.Keypress.

NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3292
Posted: 08:52am 26 Jun 2018
Copy link to clipboard 
Print this post

Thanks, let me look into it (I thought that I had fixed that issue). Might need another beta release to validate this many bug fixes.
Geoff Graham - http://geoffg.net
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1882
Posted: 09:04am 26 Jun 2018
Copy link to clipboard 
Print this post

Yes it's no big deal now I know, and it's just as easy to read outside of the ISR.

One more strange thing I forgot to add: I'm doing nothing inside MM.Keypress now, so no code or anything holding the ISR after ent is pressed.

The Keypad is randomly crashing the program back to the prompt, NO error, occasionally there is a ghosted keypad when RUN is entered to restart after the crash, I control-C out and restart, it runs again for hours running all program until the next time I open the Keypad a few times. Like I said, it's random, but sooner or later it crashes to the prompt if the keypad is opened a number of times.
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3292
Posted: 10:46am 26 Jun 2018
Copy link to clipboard 
Print this post

  KeepIS said  The Keypad is randomly crashing the program

That is not good... and will be hard to find.

It is weird that it is random. The way that MMBasic works is that there is nothing random going on anywhere. It would be worth trying a different power supply (eg, a solid lab supply) and checking Vcap (it should be a high quality ceramic cap, eg X5R). Induced noise from an external source (eg, a motor) could also cause random resets.

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

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1882
Posted: 10:09pm 26 Jun 2018
Copy link to clipboard 
Print this post

When I say random, it's only with respect to the keypad. If I don't open the keypad then the rest of the code runs forever. Lot of code generating two clock streams and decoding 24 bit data streams from Digital position scales, it's only the keypad that causes a break to prompt. I have LAB supplies and I use a Digital storage / real time CRO when decoding different hardware that I interface to, everything is clean including the supply. This runs without a crash on an older version of MM Basic so I'll flash the know good version and retest.

If I find anything I'll let you know, and that includes if I've made a blunder somewhere that is causing this in some strange way.

Mike.
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1882
Posted: 11:50pm 26 Jun 2018
Copy link to clipboard 
Print this post

For what it's worth and just to make it clear: The exit to prompt only happens when the Numberbox is touched (Keypad appears) OR when I press "Ent" or "Can" and the Keypad starts to close, but it doesn't, it stays on screen and I'm dumped to the Command Prompt. Once again, I removed all code associated with the numberbox in the program, just the MM.Keypress SUB which does nothing but check for "Ent" pressed.

If I'm the only one having a problem that it must be something associated with the timing of other code, I can easily knock a simple keypad to do what I want for this one application.

Thanks Geoff.

Mike.
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
Azure

Guru

Joined: 09/11/2017
Location: Australia
Posts: 446
Posted: 12:16am 27 Jun 2018
Copy link to clipboard 
Print this post

Don't want to add something that is not relevant, but just in case it helps (ignore otherwise) I have noticed some problems with the "ent" button locking up the program in some other programs like the superclock. Have not played further to investigate but assumed it was something in the way I had set it up as I have been playing around and swapping between the MM Backpack V2 and the MM+ LCD Backpacks with code that was written for the LCD Backpack.

I can try and reproduce the problem I have been seeing tomorrow trying it with different versions of firmware to see if there is something that I can confirm is firmware revision related or if it is just my playing around causing the problem I have noticed.
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1882
Posted: 01:10am 27 Jun 2018
Copy link to clipboard 
Print this post

(1) I have a one second Interrupt in the program that enables stuff and sets a few flags in a timed fashion based on the flags set in the GUI PenDown() function

(2) Nothing in that 1 sec ISR does anything when the Keypad is open.

(2A) I can even remove all code and just leave the 1 Sec ISR doing nothing, it still crashes every so often when the keypad is open.

This is what is randomly causing the Keypad to crash, it appears to be the random nature of exactly when the 1 Sec Interrupt fires and the exact state of the Keypad being invoked or removed.

(3) The Following appears to solve it - I stop the 1 sec ISR until Ent is pressed, this also gives the internal Keypad function time to complete before the interrupt runs, simply don't let a program defined interrupt run while the Keypad is open.


SUB MM.KEYPRESS KREF AS INTEGER, CAPVal$ AS STRING

SetTick 0, OneSec_INT,1 ' Stop the interrupt

Select case KREF
case HeightKpad
if CAPVal$ = "Ent" THEN
ButtonCMD = PadIsClosed ' Tell Timer we closed the Keypad
ButtonPress = 1 ' and to open Msgbox prompt
SetTick 1000, OneSec_INT,1
end if

Case FenceKpad
if CAPVal$ = "Ent" THEN
ButtonCMD = PadIsClosed
ButtonPress = 1
SetTick 1000, OneSec_INT,1
endif

end select
END SUB

Edited by KeepIS 2018-06-28
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1882
Posted: 01:38am 27 Jun 2018
Copy link to clipboard 
Print this post

Since stopping and restarting the 1 Sec interrupt I have not had a problem.

NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1115
Posted: 04:12am 27 Jun 2018
Copy link to clipboard 
Print this post

Geoff,

The following program demonstrates the NumberBox and MM.Keypress issue.

If the program below is run as-is, it crashes as soon as the number box is touched with the following error message

>
[19] Loop
Error: Argument list

On the LCD display, the only things visible are a red block where the numberbox is and the Alt block of the numberbox keypad. Pressing the Alt block on the LCD screen brings up the full numberbox keypad and and all presses on any numbers etc. including the Ent key do nothing other than send the same error message back to the console (even though the program has crashed, the message Error: Argument list is sent to the console on every touch).

If the SUB MM.KEYPRESS is commented out, everything works as it should.

This was run on a MM+ (Peter's 470 backpack) running 5.04.09 B19 with an SSD1963 7" LCD attached.

' Test Code
Option explicit
Const TimerOnTimeNB = 25 ' duration of "on" time

Dim InsideNB = 0 ' set when inside a NumberBox, cleared on Enter
Dim TouchDetected = 0
''''''''''''''''''''''''''''''''''''''''''''''
' Carry out initialisation routines here - enable interrupt last
StartPoint:
CLS
Font 3
GUI numberbox TimerOnTimeNB,10,120,180,40,RGB(red),RGB(Black)
BackLight 50

GUI interrupt TouchDown,TouchUp ' subroutine to handle touch int

Main:
Do 'Main program loop,
Do While TouchDetected = 0 ' wait until data request sent
Loop
' should only get here if touch detected
If InsideNB = 0 Then
TouchDetected = 0
EndIf
Loop
' end of main process loop

' Interrupt handling subroutines
Sub TouchDown
Select Case Touch(REF)
Case TimerOnTimeNB '
InsideNB = 1
End Select
TouchDetected = 1
End Sub ' end of touch down subroutine

Sub TouchUp
InsideNB = 0 ' was inside a NumberBox
End Sub

Sub MM.KEYPRESS

End Sub




... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 04:34am 27 Jun 2018
Copy link to clipboard 
Print this post

panky,
I think you need to have the full argument list specified in the SUB
SUB MM.KEYPRESS ref AS INTEGER, caption AS STRING


Missing that will explain the error you are getting.

Jim
VK7JH
MMedit
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1882
Posted: 06:08am 27 Jun 2018
Copy link to clipboard 
Print this post

As TassyJim said, that will likely crash it.

I've been using the Numberbox in a various large projects and they ran fine.

Since halting the "1_sec timer ISR" on entry to MM.Keypress then starting it on exit from MM.Keypress, the Numberbox Keypad has been 100% reliable. I've used it to death since that software mod and it's perfect (except for the string thing)







NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1115
Posted: 06:14am 27 Jun 2018
Copy link to clipboard 
Print this post

... sorry guys (and Geoff), the danger of trying to help with insufficient knowledge.

Cheers, panky
... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1882
Posted: 04:00am 28 Jun 2018
Copy link to clipboard 
Print this post

Looks like I'm suffering from a bit of RTF-Manual syndrome

Quote Geoff manual: With bold highlight from me.

In the case of a Number Box the CtrlVal(#ref) function and command will act as a string inside the MM.KEYPRESS function (normally the value of this control is a floating point number).

Soooooo The only problem I have is explained 5 Posts previous.

BTW Would still like an option added to limit the number of decimal places returned into the control if possible.

Apology to Geoff for not reading the manual re control and string behaviour.
Edited by KeepIS 2018-06-29
NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1882
Posted: 04:40am 01 Jul 2018
Copy link to clipboard 
Print this post

I have a similar problem with the Textbox when a user defined interrupt is running

If I don't stop the user interrupt as the Textbox opens, I will be dropped to the Command prompt as I use the Textbox, same as the Numberbox

Stopping the TEST EMPTY user timer interrupt solves the problem.

There appears to be NO way to stop the user from typing right off the screen in the Textbox?

While MM.Keypress is running the TextBox contents are not returned, you can set the contents, but you can't read them, so there appears to be no way to limit the string length in the textbox, unless you want to add every key stroke and calculate the length while allowing for the number of DEL key presses as well.

Just wondering if this is correct behaviour in previous versions?


NANO Inverter: Full download - Only Hex Ver 8.1Ks
 
     Page 4 of 5    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025