[NXC] Program crashing. Help!

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
nxtboyiii
Posts: 366
Joined: 02 Oct 2010, 07:08
Location: Everywhere

[NXC] Program crashing. Help!

Post by nxtboyiii »

Hi,
I was making a game for the NXT (in nxc) and encountered a problem.
When I try to add sound effects in the game, the NXT gets stuck and plays a very soft clicking sound, like when it is in firmware mode.

Why is it doing this?
Thanks,
nxtboy III
Thanks, and have a nice day,
nxtboy III

programnxt.com
mcsummation
Posts: 220
Joined: 23 Jan 2012, 17:07
Location: Round Rock, TX

Re: [NXC] Program crashing. Help!

Post by mcsummation »

Standard response #1: Please post your code. ;)
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: [NXC] Program crashing. Help!

Post by afanofosc »

It is possible to crash the VM and if your code does that somehow then your brick will click until you pull a battery and put it back in. You may be running out of RAM and the VM is not handling that well. It is hard to be certain without more information but just posting a really large program may not help (too much information). It would be best if you could compare a "works perfectly" version with a "crashes the brick" version and tell us about the changes you made.

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
nxtboyiii
Posts: 366
Joined: 02 Oct 2010, 07:08
Location: Everywhere

Re: [NXC] Program crashing. Help!

Post by nxtboyiii »

Well, actually, i used the GetMemoryInfo function and saw that the pool size was only around 4500.
So either the function is not working properly or I am doing something wrong with that function, or it is not a RAM problem.
Thanks, and have a nice day,
nxtboy III

programnxt.com
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: [NXC] Program crashing. Help!

Post by mattallen37 »

Another way of restarting the NXT, that is often easier that pulling a battery, is to press the reset button for a very short time. Holding it for a few seconds will actually reset the NXT, and not just restart it.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
nxtboyiii
Posts: 366
Joined: 02 Oct 2010, 07:08
Location: Everywhere

Re: [NXC] Program crashing. Help!

Post by nxtboyiii »

So, what is the problem if the pool size is only about 4,500?
Thanks, and have a nice day,
nxtboy III

programnxt.com
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: [NXC] Program crashing. Help!

Post by afanofosc »

There are a lot of ways you can crash the VM. It may not be that you are running out of memory. Go back to the version that worked without crashing and then figure out what changes you made that led to the crashing behavior.

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
Post Reply

Who is online

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