Advanced NXT Buttons NXT-G Block
Advanced NXT Buttons NXT-G Block
Does anyone know of an NXT-G block that allows you to use the Clear (dark grey) button in your program? I know it is not possible with the standed NXT firmware, but is it possible with the enhanced NXC/NBC firmware?
Last edited by bungeshea on 08 Apr 2011, 06:28, edited 1 time in total.
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: Advanced NXT Buttons NXT-G Block
I am quite sure you can't with NXT-G. However, I know you can with NXC.
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: 141
- Joined: 01 Oct 2010, 14:38
- Location: Pennsylvania - The United States of America
- Contact:
Re: Advanced NXT Buttons NXT-G Block
No, it is not possible to use that button with the standard NXT firmware. It will always make the program 'exit'. However, I wonder if an NXT-G block could be made that makes use of the SetLongAbort(true) functionality of the enhanced NXC/NBC firmware...
Have a nice day,
~Sidneys1
Have a nice day,
~Sidneys1
My Mindstorms website: http://sidneys1.com
Re: Advanced NXT Buttons NXT-G Block
Yeah, I thought it might be possible with the enhanced firmware, the only problem is I don't know how.sidneys1 wrote:No, it is not possible to use that button with the standard NXT firmware. It will always make the program 'exit'. However, I wonder if an NXT-G block could be made that makes use of the SetLongAbort(true) functionality of the enhanced NXC/NBC firmware...
Have a nice day,
~Sidneys1
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: Advanced NXT Buttons NXT-G Block
The EFW supports it, but not NXT-G. There is a lot of stuff the EFW supports that NXT-G doesn't.studbrickmaster wrote:Yeah, I thought it might be possible with the enhanced firmware, the only problem is I don't know how.
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: Advanced NXT Buttons NXT-G Block
What is EFW?!mattallen37 wrote:The EFW supports it, but not NXT-G. There is a lot of stuff the EFW supports that NXT-G doesn't.studbrickmaster wrote:Yeah, I thought it might be possible with the enhanced firmware, the only problem is I don't know how.
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: Advanced NXT Buttons NXT-G Block
Enhanced firmware.studbrickmaster wrote:What is EFW?!
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: 346
- Joined: 27 Sep 2010, 03:05
- Contact:
Re: Advanced NXT Buttons NXT-G Block
It wouldn't work to try to make an NXT-G block, because the NXT-G compiler would not know how to create a command for the enhanced firmware.sidneys1 wrote:No, it is not possible to use that button with the standard NXT firmware. It will always make the program 'exit'. However, I wonder if an NXT-G block could be made that makes use of the SetLongAbort(true) functionality of the enhanced NXC/NBC firmware...
Steve
---> Link to lots of MINDSTORMS stuff under my picture --->
Re: Advanced NXT Buttons NXT-G Block
So long as the enhanced firmware functionality is entirely usable or controllable via the standard IOMapRead or IOMapWrite calls then it should be possible to access that functionality via an NXT-G block. The ability to set the enhanced firmware into a state where the Exit button can be used within a user-program only requires that you set a field that I added to the UI module IOMap. The offset is shown below. It is one byte.
The pressed state flags are here:
By default the AbortFlag field at offset 40 in the UI module IOMap is set to PRESSED_EV. The code in the Command module checks the state of BTN1 (or BTNEXIT) for this state and exits the program if it contains whatever state AbortFlag is set to. These state flags can be ORed together since the button may be in both the LONG_PRESSED_EV state and the PRESSED_EV state at the same time, of course.
The NXC API function SetLongAbort simply sets AbortFlag to LONG_PRESSED_EV (or, technically, BTNSTATE_LONG_PRESSED_EV, since that is the way I named the above firmware constants in the NBCCommon.h header file). If you want to completely disable the firmware handling of an abort key in your program then you could set AbortFlag to a value that cannot be achieved via the Button module code. That would be any value that does not include the above state values, such as 0x10.
I am pretty sure that the NXT-G compiler does not check the offset value against some compiler hard-coded maximum offset for an IOMapWrite. It would be very odd if it did since the module name is passed in as a string and each module has a different maximum offset. So it should be possible to create an NXT-G block that uses IOMapWrite to set the enhanced NBC/NXC firmware's UI module's AbortFlag field to something other than BTNSTATE_PRESSED_EV.
John Hansen
Code: Select all
#define UIOffsetAbortFlag 40 /*!< RW - Long Abort (true == use long press to abort) (1 byte) */
Code: Select all
PRESSED_EV = 0x01,
SHORT_RELEASED_EV = 0x02,
LONG_PRESSED_EV = 0x04,
LONG_RELEASED_EV = 0x08,
The NXC API function SetLongAbort simply sets AbortFlag to LONG_PRESSED_EV (or, technically, BTNSTATE_LONG_PRESSED_EV, since that is the way I named the above firmware constants in the NBCCommon.h header file). If you want to completely disable the firmware handling of an abort key in your program then you could set AbortFlag to a value that cannot be achieved via the Button module code. That would be any value that does not include the above state values, such as 0x10.
I am pretty sure that the NXT-G compiler does not check the offset value against some compiler hard-coded maximum offset for an IOMapWrite. It would be very odd if it did since the module name is passed in as a string and each module has a different maximum offset. So it should be possible to create an NXT-G block that uses IOMapWrite to set the enhanced NBC/NXC firmware's UI module's AbortFlag field to something other than BTNSTATE_PRESSED_EV.
John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
http://bricxcc.sourceforge.net/
-
- Posts: 141
- Joined: 01 Oct 2010, 14:38
- Location: Pennsylvania - The United States of America
- Contact:
Re: Advanced NXT Buttons NXT-G Block
Interesting.. Time to drag out my old copy of NXT-G v1 (can't find my 1.1 cd) and Labview and see what I can do.
Have a nice day,
~Sidneys1
Have a nice day,
~Sidneys1
My Mindstorms website: http://sidneys1.com
Who is online
Users browsing this forum: No registered users and 1 guest