Page 1 of 1

Plz Help; How to use NXT block in NXC ?

Posted: 05 Dec 2011, 20:29
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 ?

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

Posted: 05 Dec 2011, 21:14
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.

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

Posted: 07 Dec 2011, 18:29
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

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

Posted: 08 Dec 2011, 11:24
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 :""(

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

Posted: 09 Dec 2011, 07:42
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.

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

Posted: 09 Dec 2011, 08:09
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.

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

Posted: 09 Dec 2011, 16:53
by onewinged
is it possible to do the opposite ?
to Make NXC blocks and use them in NXT-G?

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

Posted: 09 Dec 2011, 17:53
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/

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

Posted: 11 Dec 2011, 01:27
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 :]