Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 04:04 17 Apr 2026 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 : EXECUTE command$

Author Message
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 1838
Posted: 09:12pm 28 Feb 2026
Copy link to clipboard 
Print this post

Looks like it could be useful but how is it used.... typically?

Is it a more efficient approach than something else?

I have the feeling that I'm missing-out  
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3735
Posted: 09:43pm 28 Feb 2026
Copy link to clipboard 
Print this post

I'm using it right now in a program with video output so that a user can arbitrarily inject a command, especially for debugging, by typing at the console, e.g., "!test Execute print a$, b$, c$" or "!test EXECUTE someSubroutine.

It can also be useful for injecting a command into a 2nd connected Picomite. Here's a program from some years back in which a picomite connected to a primary picomite receives serial (while perhaps running a program, not just listening) and in addition to executing canned routines on command, can submit EXECUTE some command if sent, say, "! some command": serial control of 2nd Picomite.

Note: it cannot be multiple commands separated by ":".
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on FOTS
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 3135
Posted: 11:34pm 28 Feb 2026
Copy link to clipboard 
Print this post

I think the Port command and function still require literal GP pin numbers, so to use a string variable for the Port command and function you need EXECUTE.
Eg. from keypad program.
For n=RowPinGP To RowPinGP+rows-1
  SetPin MM.Info(pinno "GP"+Str$(n)),DOUT 'set the Port out pins
Next

For n=ColPinGP To ColPinGP+Cols-1
  SetPin MM.Info(pinno "GP"+Str$(n)), INTH, Key.Pad, PULLDOWN 'set the Port input pins and ISR
Next

'...

   Execute "Port(GP"+Str$(RowPinGP)+",rows) = 1 << y" 'set the row to read
   Execute "x=Port(GP"+Str$(ColPinGP)+",cols)" 'read the columns


Though in the latest firmware you could probably simplify that a bit.
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 1838
Posted: 10:43am 03 Mar 2026
Copy link to clipboard 
Print this post

So, for example:

-I have two PicoMites that are UART linked, Pico #1 and Pico #2
-Pico #2 has a var named cntr
-Pico #1 would like to know the value of cntr on Pico #2
-Pico #1 sends a command$ = "print #[comport], cntr" (to Pico #2)
-Pico #2 EXECUTEs the command$ thus sends the value of cntr to Pico #1

If this is true then presumably Pico #1 can also change the value of a var on Pico #2?

This is exciting....if I understand it correctly  
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3735
Posted: 01:23pm 03 Mar 2026
Copy link to clipboard 
Print this post

  PhenixRising said  presumably Pico #1 can also change the value of a var on Pico #2


Absolutely. The thread I linked to goes over this in some detail. There's a bit of complicated parsing on the part of Pico #1 to get the answer back confirming that the command it sent was executed.
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on FOTS
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 1838
Posted: 02:15pm 03 Mar 2026
Copy link to clipboard 
Print this post

Oh man, this is one of those "I wish it was possible" things for me and I was just about to start doing it the long-winded way.

I'll string a couple together    
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 1838
Posted: 02:26pm 03 Mar 2026
Copy link to clipboard 
Print this post

Wrong thread  
Edited 2026-03-04 00:29 by PhenixRising
 
circuit
Guru

Joined: 10/01/2016
Location: United Kingdom
Posts: 304
Posted: 09:54am 04 Mar 2026
Copy link to clipboard 
Print this post

I was very excited when the EXECUTE command appeared and saw it as most uncomplicated way of controlling several PicoMites that are running different tasks on a simple network.  I have a master 2350 with a USB keyboard using a simple serial link to the other PicoMites.  Keyboard errors are ignored, as are calls to PicoMites other than the one with the appropriate subroutine on board that I am calling.  For me, it is wizard stuff.  I just wish that the EXECUTE command could be retrospectively installed into the MicroMite series; MX270, 470, MZ series and so forth.  I tried to get AI to write me a CSUB without any success.  

'Picomite Simple Serial Master

Option AUTORUN ON
SetPin GP1,GP0,com1 '
Open "com1:115200, 256" As #1
'program the commands here onwards...in the form PRINT #1,"COMMAND+PARAMETERS"




And on the remote picomite



'Picomite Simple Serial Client

Option AUTORUN ON
Dim string cmd

SetPin GP1,GP0,com1 'Set up comms channel 1
Open "com1:115200, 256, ActionCommand, 3" As #1

Do
WatchDog 500        'This recovers from errors not ignored but resets the chip
Loop

Sub ActionCommand   'Message receipt detected
ON ERROR IGNORE     'This avoids system reset if duff command arrives
 Pause 30          'ensure all characters in command have arrived
 Line Input #1,cmd 'Get the command
 Execute cmd       'Action the received command

End Sub             'Return from the interrupt
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 1838
Posted: 11:59am 04 Mar 2026
Copy link to clipboard 
Print this post

Yeah, it's just what I need but in my case, I will prefix an 8bit node address. Need to get to my bench to try this. Pulled in all directions, right now.
 
dddns
Guru

Joined: 20/09/2024
Location: Germany
Posts: 819
Posted: 03:44pm 04 Mar 2026
Copy link to clipboard 
Print this post

Once I used it to dim variables and the variable names were sourced from a text file on a: or b:
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026