LabVIEW for LEGO MINDSTORMS and LabVIEW for Education

cancel
Showing results for 
Search instead for 
Did you mean: 

How big a program can a NXT Brick handle? Is there a structure limit?

The bulk of my program works fine in test mode, even the SubVI, but the program does not work when I try running it on the NXT Brick.  I've successfully run many low level programs on the brick,so I know the basics, but I do have holes in what I know.  For instance:  Does the brick have a structure limit, i.e. while loops, and case structures?  Does the brick have a limit on how many arrays it can handle?  Can the brick handle SubVis?  Is the brick the only limiting factor?

 

Thank you for your time

0 Kudos
Message 1 of 11
(6,479 Views)

How does the program fail? eg. Compiler error / brick "File Error"/ unexpected behavior? There is no limit on the number of structures, but there are limits on the size of the dataspace on the brick(16 bit addess space). I think the effective array limit would be the 64k of RAM available. If you post your vis I will take a look.

0 Kudos
Message 2 of 11
(6,476 Views)

One of the problems I have noticed with LabView on the NXT brick is the compiler is not very efficient.   Any sub-Vi's you use get compiled inline.   You don't end up with one copy of the sub-Vi.  You end up with the code for each place it is used.   As a result, the programs grow very fast in size.

 

0 Kudos
Message 3 of 11
(6,461 Views)

That should only the case for reentrant vis.(See VI Properties). A vi that has been marked as reentrant can have multiple instances executing in parallel. On the nxt this is accomplished by emitting multiple copies of the bytecode and subvi dataspace. If the vi is not reentrant there should only be one copy of the code and one copy of the local dataspace.

0 Kudos
Message 4 of 11
(6,452 Views)

I've continued working on the problem.  I know it can be horrible to wade through someone elses program, so I stripped the program down.  I put the program back in test mode, i.e. not doing on brick yet.  My program doesn't appear to be closing SubVi#1 (which is a one dimension array:1,2,3,4,5) and opening SubVi#2.(which is a one dimension array:6,7,8,9,10).  After pressing the run button I expected to see 1 then 2 then 3,...then 10.

 

Any suggestions?  

 

Thank you for your time

 

 

0 Kudos
Message 5 of 11
(6,441 Views)

Thanks for posting your code 🙂

 

The first thing I notice is that the Index array node in your outer loop will eventually index out of bounds. This is a big difference between DirectMode(test mode) and remote mode(running on the brick). Indexing out of bounds on the NXT will cause the program to abort on the NXT. In direct mode indexing out of bounds will return a default value.

Another thing is that you are reimplementing the iteration terminal on each loop using shift registers instead of using the iteration "i" terminal in the lower left of each loop. This shouldn't be a problem per se.. but is there a reason you are doing that?

 

If your program never seems to execute subvi #2 it may be that that subVI has an issue(like indexing out of bounds). Can you post that vi?

 

0 Kudos
Message 6 of 11
(6,435 Views)

Earl,  Thanks for the tip!   I had no idea I could collapse the generated code down by setting the Vi's Execution Properties!

 

 

0 Kudos
Message 7 of 11
(6,432 Views)

Hi

 

All the problems I was having, I've solved.  The array going out of bounds problem was solved by stopping one of the while loops with a "not equal to zero" wired to the stop.  The SubVi I got working simply by not opening it before running it.  Next I want to figure out how to use Excel to deliver numbers to my program rather than  my two 1D arrays.  I know that notepad can be used, but what about Excel?  Can the NXT Brick handle a spreadsheet?  If not, can the brick handle a 2D array?, or can it only handle a 1D array?

 

Thanks for your time

0 Kudos
Message 8 of 11
(6,411 Views)

Hi

 

"Collapse generated code down by setting the Vis execution properties"  ???????   What does that mean?  I'll have to investigate. or would you like to elaborate on that?

 

Thank you for your time

 

P.S.   Love programing in LabView, fun, fun, fun

0 Kudos
Message 9 of 11
(6,408 Views)

That is Computer Science talk.   Earlier in this thread I complained that if you define a sub-Vi, any time you reference and use it, it adds the full code instead of just generating a call to the already defined code.   What that means is your program gets big very fast and you run out of room.   Earl pointed out that there are options to control the 'expansion' of the code generated.   

0 Kudos
Message 10 of 11
(6,392 Views)