Menu
JAQForum Ver 19.10.27

Forum Index : Microcontroller and PC projects : MMBasic V6.03.00 release candidates

   Page 25 of 26    
Posted: 09:53am
17 Jun 2026
Copy link to clipboard
matherp
Guru

V6.03.00RC21
PicoMiteRP2040V6.03.00RC21.zip
PicoMiteRP2350V6.03.00RC21a.zip
PicoMiteRP2350V6.03.00RC21b.zip
PicoMite_User_Manual.pdf

Fixes minor colouring issue in FM
Adds STEPPER TUNE command
Changes STEPPER functionality to ensure steps cannot be missed by drivers that need a pause between step pulses. Note this limits the maximum pulse rate to 50KHz (100KHz interrupt rate). The code will warn you if you specify a maximum axis speed which when multiplied by the steps/unit exceeds this.

Stepper_Reference.pdf

Adds BLIT MEMORY332 which Blits RLE-RGB332 memory to the display (as used in the video demo) works on HDMI mode 5 and buffered display drivers
Reduces memory footprint of the json$ function (was in RC20 but not mentioned)
Edited 2026-06-17 19:54 by matherp
 
Posted: 11:38am
17 Jun 2026
Copy link to clipboard
toml_12953
Guru

  matherp said  V6.03.00RC21


Trying to compile source and getting this error in MM.MISC.c

error: 'struct stats_' has no member named 'mem'
8600 |         iret = (int64_t)(uint32_t)lwip_stats.mem.max;
 
Posted: 12:04pm
17 Jun 2026
Copy link to clipboard
bfwolf
Senior Member

  matherp said  V6.03.00RC21
...
PicoMite_User_Manual.pdf
...


Just a minor cosmetic thing: The PDF manual has no index entries for commands and functions below "Detailed Listing" (for each single command/function), as in the "official" manual of previous releases.
Would be nice to have to quickly navigate when viewing for "inconsistencies"..
Regards.
Edited 2026-06-17 22:05 by bfwolf
 
Posted: 01:54pm
17 Jun 2026
Copy link to clipboard
matherp
Guru

 
Posted: 03:11pm
17 Jun 2026
Copy link to clipboard
bfwolf
Senior Member

  matherp said  PicoMite_User_Manual.pdf

Thx !!!
 
Posted: 03:27pm
17 Jun 2026
Copy link to clipboard
Bleep
Guru


Hi Peter,
I'm still having problems with Math(crossing), B21, RP2040 standard and Min.
as per my earlier post as previously using

Dim Float percentv(8)=(25.0,25.6,26.0,26.2,26.4,26.5,26.6,26.7,26.8)

the first 2 crossing array elements both return 1, assuming I'm using it right I would think the first sould be 0, above element 1 it is now working fine up to 7 (which didn't work previously) but I would think I should get 8 if I use
?math(crossing percentv(),26.85,1)
Unless this is considered out of bounds? which I can easily fix by adding an extra element with a value of say 100.
I also still always get -1 if I specify the direction as -1
?math(crossing percentv(),26.55,-1)
I think this should produce 6, unless I don't understand what the direction does?
Maybe the manual could expand a bit on what to expect from this command.
Regards Kevin.
 
Posted: 04:08pm
17 Jun 2026
Copy link to clipboard
matherp
Guru

  Quote  This returns the array index at which the values in the array pass the "level" in the direction specified.


I think that explains your first point. 25.0 hasn't "passed" 25.0
-1 means passing the value in a negative direction i.e. a value has been found that is bigger than the target and then a value that is less. Think scope trigger direction. Nothing in your list is bigger than 26,85 so -1 is the correct answer
 
Posted: 04:39pm
17 Jun 2026
Copy link to clipboard
Bleep
Guru


Hi Peter,
I first test 25.0 then I test 25.01
25.0 returns -1 fair enough, 25.01 I think should return 0 but actually returns 1.

?math(crossing percentv(),26.85,1) (note direction is 1)
This has crossed 26.8, so I would think it should return 8, unless it is now considered out of bounds?

As for the direction of -1 as in
?math(crossing percentv(),26.55,-1)
This is in the middle of the array of values, so should return something other than -1 I think, unless I still don't understand?

There is no value I can find that will give me anything other than -1 returned if I use the reverse direction ie -1 for direction.
Regards Kevin.
 
Posted: 05:44pm
17 Jun 2026
Copy link to clipboard
matherp
Guru

No: what is the element number of the first element that is bigger than 25.0

Your values are all increasing. There is no negative going edge. 26.8 is less than 26.85. You are looking for values in an array that have crossed your threshold level. Again - think about an oscilloscope. The value in the command is the setting of the trigger level. Unless the analogue input get bigger than the trigger level the scope won't trigger. The direction then specifies if it triggers on the way up or on the way down but there has to be an element either side of the trigger level
 
Posted: 07:54pm
17 Jun 2026
Copy link to clipboard
Bleep
Guru


Ok thanks I think I understand the -1 direction.
But I still have a problem with the first elements of the array in the forward direction.

> Dim Float percentv(8)=(25.0,25.6,26.0,26.2,26.4,26.5,26.6,26.7,26.8)
> ?math(crossing percentv(),25.5,1)
1
> ?math(crossing percentv(),25.6,1)
1
> ?math(crossing percentv(),25.7,1)
1
> ?math(crossing percentv(),25.8,1)
1
> ?math(crossing percentv(),25.9,1)
1
> ?math(crossing percentv(),26.0,1)
2
> ?math(crossing percentv(),26.1,1)
2
> ?math(crossing percentv(),26.2,1)
3
> ?math(crossing percentv(),26.3,1)
3

As above I get 1 returned a soon as I pass 25.0, but it stays at 1 when I pass 25.6
shouldn't I get 2 when the value passes 25.6, not when it subsequently gets to (not passes) 26.0? similarly at 26.2 etc.
Again assuming I have any understand what it is doing. :-(
 
Posted: 12:38am
18 Jun 2026
Copy link to clipboard
vegipete
Guru


Thank you for the new RC21. I am though still seeing odd behaviour.
Much the same program as before, same options also.

Also, thank you so much for the StallGuard as found in the TMC2209! I was starting to wade through the TMC data sheet to figure out how to use it, and suddenly, there it is, already in the firmware! WOW!

> list all
Const M_EN = MM.Info(PINNO GP30)   ' stepper enable
Const M_STEP = MM.Info(PINNO GP26) ' stepper step
Const M_DIR = MM.Info(PINNO GP27)  ' stepper direction

On error skip
Stepper Close
Stepper Init
Stepper Axis A,M_STEP,M_DIR,M_EN,,16,20000,1000
Stepper Position Home
Stepper Run 1   ' disable stepper when not moving

Pause 200
For i = 1 To 100
 Stepper gs "g1 f12500 g91 a" + Str$(i)
'  Stepper gs "g1 f12500 g90 a" + Str$(i)
 Do : Loop While Peek(stepper active) > 0   ' wait for motion to stop
 Pause 200  ' wait some more
 Print i,Peek(stepper a)
Next i
>

I put a logic analyzer on the STEP pin to see what's going on. Some move requests loose 2 steps. The capture below is for the first move of 1 unit. There are only 14 step pulses generated. There should be 16. (Note also the 3 stray pulses at the beginning, when the stepper system is initialized. I didn't check the state of the enable pin during these pulses - sorry.)



Here's a comparison of the output with RC20 and RC21. No change.
"x" on the right indicates a move request with 2 missing pulses. The error is consistent each run. "Pulses out" is the pulse count from the logic analyzer.
I haven't seen an error on moves above 32.

Note my configuration of 16 steps per "unit". This means a move of 100 on the A-axis turns the motor exactly once. Also, X,Y and Z are not used and unconfigured.

Just checked something:
Moves of A.5 and A.75 work fine, A.25 loses 2 steps.

PicoMite MMBasic RP2350B  V6.03.00
       RC21        RC20     Pulses out
1      0.875       0.875        14   x
2      2.875       2.875        32
3      5.875       5.875        48
4      9.75        9.75         62   x
5      14.75       14.75        80
6      20.625      20.625       94   x
7      27.5        27.5         110  x
8      35.5        35.5         128  
9      44.5        44.5         144  
10     54.5        54.5         160  
11     65.375      65.375       174  x
12     77.375      77.375       192  
13     90.25       90.25        206  x
14     104.25      104.25       224  
15     119.25      119.25       240  
16     135.125     135.125      254  x
17     152.125     152.125      272
18     170.125     170.125      288  
19     189.125     189.125      304  
20     209.125     209.125      320  
21     230.125     230.125      336  
22     252.125     252.125      352  
23     275.125     275.125      368  
24     299         299          382  x
25     323.875     323.875      398  x
26     349.75      349.75       414  x
27     376.75      376.75       432  
28     404.625     404.625      446  x
29     433.625     433.625      464  
30     463.625     463.625      480
31     494.5       494.5        494  x
32     526.5       526.5        512
33     559.5       559.5        528
34     593.5       593.5        544
35     628.5       628.5        560
36     664.5       664.5        576
37     701.5       701.5        592
38     739.5       739.5        608
39     778.5       778.5        624
40     818.5       818.5        640
{Observation: A-axis should be at 820 at the end. 1.5 is missing.}
 
Posted: 06:34am
18 Jun 2026
Copy link to clipboard
ville56
Guru

* without any parameter is not working as described in the manual

The star/asterisk command is a shortcut for RUN that may only be used at the
MMBasic prompt. eg,
* RUN


results in

> *
Error : Neither file nor function found
>

RUN behaves normal and starts the code, as well as the other variants of * with parameters.

Platform:

PicoMite MMBasic RP2350A V6.03.00RC21
OPTION SYSTEM SPI GP2,GP3,GP4
OPTION SYSTEM I2C GP0,GP1
OPTION FLASH SIZE 16777216
OPTION COLOURCODE ON
OPTION HEARTBEAT OFF
OPTION CPUSPEED (KHz) 252000
OPTION DISPLAY 40, 145
OPTION LCDPANEL ST7789, LANDSCAPE,GP5,GP6,GP7,GP8,INVERT
OPTION SDCARD GP11
 
Posted: 07:04am
18 Jun 2026
Copy link to clipboard
Volhout
Guru

Hi Gerald,

This is how you use it...

> files
A:/
  <DIR>  .
  <DIR>  ..
00:00 01-01-2024          4  bootcount
00:00 01-01-2024        301  euler.bas
2 directories, 2 files, 2949120 bytes free
> *euler
calculate euler numbers
sum =  233168
in  72.05 ms
>


So
*euler


is the same as
RUN "euler.bas"


It is correct the user manual is confusing. * RUN is nothing. * is nothing. But * followed by a program name executes that program.

Volhout
Edited 2026-06-18 17:09 by Volhout
 
Posted: 07:15am
18 Jun 2026
Copy link to clipboard
TassyJim
Guru


* on it's own used to RUN the currently load program.
I assume that the introduction of the Calculator functions resulted in * without filename$ being dropped.

Jim
 
Posted: 07:28am
18 Jun 2026
Copy link to clipboard
matherp
Guru

  Quote  * on it's own used to RUN the currently load program.

Not by intent. Single key run is F2

vegipete: Thanks for the excellent diagnostic. I'm working on it and will try and post a fix later today

Bleep: looking at it again and will also update the manual entry to make it clearer
Edited 2026-06-18 17:49 by matherp
 
Posted: 09:01am
18 Jun 2026
Copy link to clipboard
Bleep
Guru


Thanks Peter, I probably won't have a use for the reverse crossing, I was only trying to work out how it worked and what it did, however as you can probably see, the array values are resting voltages for a 24v battery so I am using the forward crossing to give me an array number which then references into a approximate % state of charge, which I can then use to decide if the battery needs a boost charge overnight, on Economy7. :-) I was going to do it the manual way, but then noticed the Math(crossing) command & thought that might work. :-)
Thanks for investigating.
Regards Kevin.
 
Posted: 09:11am
18 Jun 2026
Copy link to clipboard
matherp
Guru

Bleep, The use for it is specifically with the continuous background ADC. In this case a "miss" of the index by a place is completely irrelevant. Note the new manual entry and the additional parameter
  Quote  MATH(CROSSING array() [, level] [, direction] [, confirm])

Returns the array index of the first sample at which the values in array() cross level in the direction specified, where the crossing is sustained for confirm consecutive samples.

level — the threshold to detect. Defaults to 0.
direction — 1 detects a rising crossing (values passing from below the level to at/above it); -1 detects a falling crossing (from above to at/below). Defaults to 1. Valid values are -1 and 1.
confirm — the number of consecutive samples that must remain on the far side of the level for the crossing to be accepted. Values greater than 1 reject brief noise spikes. Defaults to 1 (any single-sample crossing is accepted).
Returns -1 if no qualifying crossing is found. A crossing occurring within the final (confirm-1) samples of the array cannot be confirmed and is not reported.

 
Posted: 10:08am
18 Jun 2026
Copy link to clipboard
Bleep
Guru


Ok thanks Peter, I think it will still be ok for my use, I'll test it thoroughly to be sure, I can, already have, added extra 'guard' elements to the voltage array at either end. If not I'll go back to the manual method.
Regards Kevin.
Edited 2026-06-18 20:08 by Bleep
 
Posted: 10:14am
18 Jun 2026
Copy link to clipboard
matherp
Guru

Try this

PicoMiteRP2350V6.03.00RC21.zip
Edited 2026-06-18 20:15 by matherp
 
Posted: 10:59am
18 Jun 2026
Copy link to clipboard
ville56
Guru

thanks to all for the explanations.

  matherp said  
  Quote  * on it's own used to RUN the currently load program.

Not by intent. Single key run is F2


So the manual should be corrected for the "*file" entry, meaning

   *    RUN

should be removed. This would make it consistent, as "file" in this context is not within [] thus not optional.
 
   Page 25 of 26    
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026