NXC: import NXT-G blocks into NXC code?

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

NXC: import NXT-G blocks into NXC code?

Post by HaWe »

hi,
is it possible to import NXT-G blocks into NXC code and use their built-in functionality via input pins and output pins e.g. like variables passed to a NXC function?
mightor
Site Admin
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands
Contact:

Re: NXC: import NXT-G blocks into NXC code?

Post by mightor »

Not unless you look at how they work internally and code an NXC equivalent yourself. Not all blocks can be viewed in LabView without a password.

You can download a student version of LV for free and try it yourself.

- Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: NXC: import NXT-G blocks into NXC code?

Post by HaWe »

[T]oo complicated. I wanted to use the block "as a black box", included like an #include function or library.
But I meant NXT-G, not Labview. Anyway, probably it's the same.

Nevertheless, it would be a great thing if would be possible though...
mightor
Site Admin
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands
Contact:

Re: NXC: import NXT-G blocks into NXC code?

Post by mightor »

The problem is that the LV compiler used to make the RXEs is not open source, so it wouldn't be possible to integrate with NXC.

- Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
ronmcrae
Posts: 33
Joined: 28 Sep 2010, 14:56

Re: NXC: import NXT-G blocks into NXC code?

Post by ronmcrae »

doc-helmut wrote:hi,
is it possible to import NXT-G blocks into NXC code and use their built-in functionality via input pins and output pins e.g. like variables passed to a NXC function?
One thing I've done with some success is to create a very small NXT-G program that included the block I was interested in (the move block). Compile the program then upload the RXE into BricxCC and by some careful detective work you can figure out the exact section of code that relates to the block. Then by repeating the procedure while changing various parameters on the configuration panel of the block (just one at a time!) it was possible to determine which NBC variables are being used to pass those parameters to the 'block'. With all that done I did some global renaming of the variables, then cut and pasted the relevant NBC code to create an NXC function.

This was not trivial by any means, but it was a fun exercise.

Ron.
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: NXC: import NXT-G blocks into NXC code?

Post by HaWe »

reverse engineering, eh? :geek:

Edited by Mightor: This troll has been banned for a day.
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: NXC: import NXT-G blocks into NXC code?

Post by HaWe »

haha, lets formulate it differently: 8-)
do you think you can reversely engineer an I²C block with "multiple functionality"? :ugeek:
:roll:
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXC: import NXT-G blocks into NXC code?

Post by mattallen37 »

Well, you seem to have ruled out programming errors, so are you looking for timing issues? I think you would have a much easier time finding it in ROBOTC, than in NXT-G (I think it would have to be the education version). It is supported by ROBOTC, isn't it? Why don't you look at how the drivers are made, and attempt to translate them into NXC (or NBC if you like really low level stuff, like what it would take to translate the NXT-G code)?
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
mightor
Site Admin
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands
Contact:

Re: NXC: import NXT-G blocks into NXC code?

Post by mightor »

ROBOTC support is in the actual firmware, so the drivers are exposed through the same motor*[] arrays and functions. You would still need a protocol analyser.

- Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXC: import NXT-G blocks into NXC code?

Post by mattallen37 »

Ah, okay. Is the FW open-source?
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 2 guests