Plz Help; How to use NXT block in NXC ?

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
onewinged
Posts: 11
Joined: 02 Dec 2011, 15:50

Plz Help; How to use NXT block in NXC ?

Post by onewinged »

hello, :$
Plz help me again
I made blocks using "NXT 2.0 Programming";
and I want to call them in NXC ? what's the code for it ?and what are some examples ?
h-g-t
Posts: 552
Joined: 07 Jan 2011, 08:59
Location: Albania

Re: Plz Help; How to use NXT block in NXC ?

Post by h-g-t »

You can't, the two programming environments do not work together.

Just re-write it what you want to do in NXC.
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: Plz Help; How to use NXT block in NXC ?

Post by afanofosc »

It is actually sort of possible to use NXT-G blocks in NXC but probably not in the way that you desire. You can decompile the RXE produced by a simple NXT-G program that uses your desired block and then wrap the resulting NBC assembly language code, with some (perhaps a lot of) manual editing, in an NXC "asm" block. I know Ron McRae has done things like this before. It is non-trivial but can in some cases be a worthwhile project.

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
onewinged
Posts: 11
Joined: 02 Dec 2011, 15:50

Re: Plz Help; How to use NXT block in NXC ?

Post by onewinged »

afanofosc wrote:It is actually sort of possible to use NXT-G blocks in NXC but probably not in the way that you desire. You can decompile the RXE produced by a simple NXT-G program that uses your desired block and then wrap the resulting NBC assembly language code, with some (perhaps a lot of) manual editing, in an NXC "asm" block. I know Ron McRae has done things like this before. It is non-trivial but can in some cases be a worthwhile project.

John Hansen
that's very helpful .. though I don't know how to do it I'm not very good with compiling and seems like it will need effort and time :""(
bungeshea
Posts: 207
Joined: 14 Aug 2011, 08:45
Location: Australia
Contact:

Re: Plz Help; How to use NXT block in NXC ?

Post by bungeshea »

You'll need the RXEDumper utility.

Using this tool (put it in [LEGO MINDSTORMS directory]\engine\project\ and use it through the Tools menu in NXT-G),
download the RXE to your computer, and then run it through RXEDumper. You'll be rewarded with some confusing NBC code.

To use the NBC assembly code in NXC, wrap in an asm statement. More about asm...

Code: Select all

 asm { 
  one or more lines of NBC assembly language
 }
However, you may find it easier just to look at what the NXT-G code does, and try to convert that into NXC statements.
h-g-t
Posts: 552
Joined: 07 Jan 2011, 08:59
Location: Albania

Re: Plz Help; How to use NXT block in NXC ?

Post by h-g-t »

However, you may find it easier just to look at what the NXT-G code does, and try to convert that into NXC statements.
Yup, that's what I did.

Understanding the steps to take s the hardest part, re-writing the code in a different language is relatively easy.
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
onewinged
Posts: 11
Joined: 02 Dec 2011, 15:50

Re: Plz Help; How to use NXT block in NXC ?

Post by onewinged »

is it possible to do the opposite ?
to Make NXC blocks and use them in NXT-G?
h-g-t
Posts: 552
Joined: 07 Jan 2011, 08:59
Location: Albania

Re: Plz Help; How to use NXT block in NXC ?

Post by h-g-t »

I don't think so, apart from NXT-G, the only way is to use Labview (a free version is available just for this purpose).

http://blog.electricbricks.com/en/2010/ ... g-labview/
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
onewinged
Posts: 11
Joined: 02 Dec 2011, 15:50

Re: Plz Help; How to use NXT block in NXC ?

Post by onewinged »

h-g-t wrote:I don't think so, apart from NXT-G, the only way is to use Labview (a free version is available just for this purpose).

http://blog.electricbricks.com/en/2010/ ... g-labview/
I'll use Labview for my project next
thanks for always helping :]
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests