I have a couple questions about NXC
I have a couple questions about NXC
firstly i just want to say that NXC is amazing!
im quite new to programming but learn nxc has been not too difficult
i was wondering (noobish question) how does one debug an NXC code?
in bricxx i see there are in the compile menu things like "step over" etc. these are all debugging functions, right?
but how do you use it, i can seem to (and dont know how to) debug at all. >.<
its frustrating because i have this giant code but I have where the code goes wrong.
isn't there a way to check the code line by line and slowly?
Also:
- i was reading the nxc tutorial and i see line numbers in the left hand side of the code
but when i use bricxx, there are no line numbers and when ever i have to use the go to line function, i have to manually count the lines!
-and how do you watch variables? i was looked at the three methods and all of them are difficult to understand b/c the variable are named var1, var2 etc.
P.S this is not a rant, i guess need to figure out a couple (but crucial) things on Bricxx.
sorry for the trouble,
Rahul R.
im quite new to programming but learn nxc has been not too difficult
i was wondering (noobish question) how does one debug an NXC code?
in bricxx i see there are in the compile menu things like "step over" etc. these are all debugging functions, right?
but how do you use it, i can seem to (and dont know how to) debug at all. >.<
its frustrating because i have this giant code but I have where the code goes wrong.
isn't there a way to check the code line by line and slowly?
Also:
- i was reading the nxc tutorial and i see line numbers in the left hand side of the code
but when i use bricxx, there are no line numbers and when ever i have to use the go to line function, i have to manually count the lines!
-and how do you watch variables? i was looked at the three methods and all of them are difficult to understand b/c the variable are named var1, var2 etc.
P.S this is not a rant, i guess need to figure out a couple (but crucial) things on Bricxx.
sorry for the trouble,
Rahul R.
-
- Posts: 224
- Joined: 30 Oct 2010, 04:10
- Location: 127.0.0.1
- Contact:
Re: I have a couple questions about NXC
You can view the line number in the bottom left column eg For more info about variable watching view this thread https://sourceforge.net/apps/phpbb/mind ... ?f=3&t=583rrawat wrote: Also:
- i was reading the nxc tutorial and i see line numbers in the left hand side of the code
but when i use bricxx, there are no line numbers and when ever i have to use the go to line function, i have to manually count the lines!
-and how do you watch variables? i was looked at the three methods and all of them are difficult to understand b/c the variable are named var1, var2 etc.
.
Good luck
-Tim
Commit to Lego Mindstorms StackExchange Q&A http://area51.stackexchange.com/proposals/4105
Minboards IRC Channel #mindboards on Freenode
My blog: http://timpattinson.wordpress.com/
Minboards IRC Channel #mindboards on Freenode
My blog: http://timpattinson.wordpress.com/
Re: I have a couple questions about NXC
For line numbers, open 'Preferences', click on the 'Options' tab and click on the 'Line Numbers' box.
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
Re: I have a couple questions about NXC
I'm not an NXC programmer, but I find that one easy way to see what your program is doing is to use the light sensor's LED. One way of doing it is to have it blink momentarily after every line or section of code has completed. Then, just count the number of blinks and you'll know where it got hung up. I'm sure you can think of other, better, ways of implementing this into your program. The screen is also very useful for debugging numbers and such.
Last edited by nxtreme on 19 Mar 2011, 00:59, edited 1 time in total.
One King to rule them all, One King to find them,
One King to bring them all and in the darkness bind them
On Earth where Shadows lie.
One King to bring them all and in the darkness bind them
On Earth where Shadows lie.
Re: I have a couple questions about NXC
OMG THANK YOU ALL FOR YOU REPLIES
i cant believe you guys replies so fast
so their is no way to do step by step debugging like in RobotC?
i just downloaded the enhanced firmware
I just was to learn how to make use of the function in the compile menu (Step into, break all etc.)
also to nxtextreme
how do you make the led blink every line using nxc ?'
once again thanks so much!
sincerely,
Rahul R.
i cant believe you guys replies so fast
so their is no way to do step by step debugging like in RobotC?
i just downloaded the enhanced firmware
I just was to learn how to make use of the function in the compile menu (Step into, break all etc.)
also to nxtextreme
how do you make the led blink every line using nxc ?'
once again thanks so much!
sincerely,
Rahul R.
-
- Posts: 1818
- Joined: 02 Oct 2010, 02:19
- Location: Michigan USA
- Contact:
Re: I have a couple questions about NXC
I think he means every so often (maybe 10 lines). However, the screen or speaker seems to be a much better debugging method for me. nxtreme programs PICAXE's, and you don't exactly have a screen to debug with. In that case, an LED is one of the best ways.rrawat wrote:...also to nxtextreme
how do you make the led blink every line using nxc ?'....
Matt
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
http://mattallen37.wordpress.com/
I'm all for gun control... that's why I use both hands when shooting
Re: I have a couple questions about NXC
I don't use NXC, so I wouldn't know the exact commands. However, in NXT-G I'd turn the LED on, wait 70+ ms and turn it back off. It will slow down your program ever so slightly, but when debugging that isn't a major concern. Remember, if you just can't get your program working, there are plenty of people on the forums here that are always willing to help. Most of them are actually pretty smart, but don't tell them I said that .
And yes, Matt has a point there. However, the screen or speaker is sometimes being used for other things, in which case using the light sensor can have an advantage. Like I said before, think of a better way of implementing this!
And yes, Matt has a point there. However, the screen or speaker is sometimes being used for other things, in which case using the light sensor can have an advantage. Like I said before, think of a better way of implementing this!
One King to rule them all, One King to find them,
One King to bring them all and in the darkness bind them
On Earth where Shadows lie.
One King to bring them all and in the darkness bind them
On Earth where Shadows lie.
Re: I have a couple questions about NXC
The BricxCC debugging (step into, etc...) requires the enhanced NBC/NXC firmware and it has not been extensively tested to the point where it is iron clad. I have used it with success on several occasions but it definitely is not perfect or bug free. Currently I have not implemented any way to set breakpoints, though the enhanced NBC/NXC firmrware has code in place for that.
I often use TextOut or NumOut commands and Waits for debugging purposes.
As Matt mentioned, you can turn on line numbers in the gutter via the Preferences dialog on the Options tab.
John Hansen
I often use TextOut or NumOut commands and Waits for debugging purposes.
As Matt mentioned, you can turn on line numbers in the gutter via the Preferences dialog on the Options tab.
John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
http://bricxcc.sourceforge.net/
Re: I have a couple questions about NXC
All three of the variable watch tools name the variables something other than var1, var2, etc... Here are some screenshots.
hints on variable fields in the original watch window The variable name shown on the configurable watch tool. variables watches in the new NXT Watch List tool Watch list popup menu options Watch properties dialog with drop down list of variables I'd love to have some help documenting all three of these tools more fully.
John Hansen
hints on variable fields in the original watch window The variable name shown on the configurable watch tool. variables watches in the new NXT Watch List tool Watch list popup menu options Watch properties dialog with drop down list of variables I'd love to have some help documenting all three of these tools more fully.
John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
http://bricxcc.sourceforge.net/
Re: I have a couple questions about NXC
Mr Hansen:
I find the NXT watch list most convenient
however, i cannot find the variable i want to watch in the drop down expression list.
what if i just type the variable in the expression space; will it work??
thanks,
RRawat
I find the NXT watch list most convenient
however, i cannot find the variable i want to watch in the drop down expression list.
what if i just type the variable in the expression space; will it work??
thanks,
RRawat
Who is online
Users browsing this forum: No registered users and 17 guests