Page 1 of 2
NXC: import NXT-G blocks into NXC code?
Posted: 20 Mar 2011, 11:34
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?
Re: NXC: import NXT-G blocks into NXC code?
Posted: 20 Mar 2011, 12:01
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
Re: NXC: import NXT-G blocks into NXC code?
Posted: 20 Mar 2011, 12:06
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...
Re: NXC: import NXT-G blocks into NXC code?
Posted: 20 Mar 2011, 12:13
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
Re: NXC: import NXT-G blocks into NXC code?
Posted: 23 Mar 2011, 21:25
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.
Re: NXC: import NXT-G blocks into NXC code?
Posted: 23 Mar 2011, 21:31
by HaWe
reverse engineering, eh?
Edited by Mightor: This troll has been banned for a day.
Re: NXC: import NXT-G blocks into NXC code?
Posted: 24 Mar 2011, 23:57
by HaWe
haha, lets formulate it differently:
do you think you can reversely engineer an I²C block with "multiple functionality"?
Re: NXC: import NXT-G blocks into NXC code?
Posted: 25 Mar 2011, 00:40
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)?
Re: NXC: import NXT-G blocks into NXC code?
Posted: 25 Mar 2011, 05:58
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
Re: NXC: import NXT-G blocks into NXC code?
Posted: 25 Mar 2011, 06:10
by mattallen37
Ah, okay. Is the FW open-source?