NXC : Start Program command(?)
NXC : Start Program command(?)
Hello,
For my current project it would be pretty handy to have a command that could tell the NXT to stop the current running program and switch to an alternative one? Would this be possible, I can't find the command in the NXC references that are available.
Help appreciated.
For my current project it would be pretty handy to have a command that could tell the NXT to stop the current running program and switch to an alternative one? Would this be possible, I can't find the command in the NXC references that are available.
Help appreciated.
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: NXC : Start Program command(?)
There is no command to start another program directly from a running program.
I can think of a couple alternatives though:
I can think of a couple alternatives though:
- I am pretty sure you can start a program from another NXT (through BT, and maybe now through RS-485). You could have one NXT tell the other one which program to make it start.
You could build a state machine. Make one program that contains all of the code, and at a certain command, it could switch to running a different set of code (still the same program).
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Re: NXC : Start Program command(?)
Matt:
There is a RemoteStart() API command. It use it alot.
Web:
Try that. Right click (in BricxCC) and select 'Help Topics'
There is a RemoteStart() API command. It use it alot.
Web:
Try that. Right click (in BricxCC) and select 'Help Topics'
2Labz.com, My Website
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: NXC : Start Program command(?)
Hmm, never heard of it before. I looked in both the HTML and the online help and couldn't find it. The closest I could find, was RemoteStartProgram, which is the command I was talking about (done by another NXT).
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: NXC : Start Program command(?)
Actually, I can think of one possible solution; try writing to the IO map from the program.
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Re: NXC : Start Program command(?)
If RemoteStartProgram() is used via BT, but a program is already running on the remote brick, then the program that you attempted to start will run as soon as the current program quits.mattallen37 wrote:Actually, I can think of one possible solution; try writing to the IO map from the program.
Thus if the same actions that RemoteStartProgram takes can somhow be emulated on the local brick then it should be possible to cause a running program to get the brick into a state whereby it'll run a different program when the present one quits.
Ron.
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: NXC : Start Program command(?)
That is what I meant about using the IO map directly. However, I have only used it for more basic things (such as the program knowing if it is plugged into USB...). Perhaps John can tell us if it is possible.
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Re: NXC : Start Program command(?)
Is it possible to write commands on the BT input "message box"/whatever the heck it's called to your own NXT?
Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE
Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: NXC : Start Program command(?)
Well, that's what I am wondering. John said RS485 writes directly to the IO map... In that case, the FW must either be looking at the data as it is coming in, or reading the IO map to see if it contains the right string to trigger a direct command. If it is looking at the IO map, then it should be fairly simple in theory.
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Re: NXC : Start Program command(?)
CommBTWrite looks promising.
The NXC docs don't have much info, so I'll quote LEGO's SDK RXE Specs:
-----
Also, there's Comm Module ID...
Now if I could just find the right offsets... EDIT: Hmmm... No luck so far. Gotta do my homework.
The NXC docs don't have much info, so I'll quote LEGO's SDK RXE Specs:
Not sure what to do about the underlined part, though...NXTCommBTWrite
Return Value:
Status Code SBYTE
Parameters:
Connection: Buffer
UBYTE: UBYTE array
input: input
Port. The four valid ports are 0, 1, 2, and 3.: Up to 256 bytes for writing to specified port.
[Try to make sense of that ]
This syscall method copies data from the buffer input to an internal Bluetooth buffer and instructs the NXT
firmware to send the data to the device configured on the specified port.
If the return value is 0, the method successfully started a communication transaction. Use
NXTCommBTCheckStatus to monitor the status of the transaction.
-----
Also, there's Comm Module ID...
Now if I could just find the right offsets... EDIT: Hmmm... No luck so far. Gotta do my homework.
Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE
Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
Who is online
Users browsing this forum: No registered users and 11 guests