To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 12803
12802  |  12804
Subject: 
RE: help with NQC
Newsgroups: 
lugnet.robotics
Date: 
Tue, 17 Oct 2000 19:04:08 GMT
Original-From: 
Jon Kongsvold <JON@nomorespamKONGSVOLD.COM>
Viewed: 
585 times
  
Finally i decided to use NQC, the Lego Programmer was too much
limited, and
others system to program the RCX where still limited;in the other hand
,however, i do not want to get under the firmware.
Ok ,i downloaded the firmware 2.0 ,the NQC+Manual v2.2 r1, and
after a night
of "passion" i got some question:

1) Where can i find some example of NQC programs ,just to see how they are
written;

Get a copy of RcxCC by Mark Overmars (http://www.cs.uu.nl/~markov/lego/).
It is a great interface for programming NQC and has a tutorial that might
have some examples you can use.

2)What are the differences between Functions and Subroutines ? (why trere
are also Functions, subroutins are'nt better, es  less memory use)

The main differences are: 1) Functions can have arguments and subroutines
not.  2) If you call a subroutine, the code just jumps to wherever that
subroutine is stored, while a function is copied as it is into your code.
This might make your program BIG if you call a small function lots of times.
3) Subroutines might make weird bugs in your programs if two or more tasks
are calling the same subroutine (or so I have heard).  Somebody please
correct me or add to this if I have forgotten something.

3)What are the Assignments ? (+=, -=, /=..)

If you see a line like 'a += b;', it really means 'a = a + b;'.  Same for
the other operators.  You don't have to use it, but it saves you some
typing.

4)The #include, #define, #if definition, #ifdef symbol, #ifndef
symbol,#else, #elif condition, #endif  : what they do ?

#define  Use this to define constants or functions.  #defines can have
variables, like '#define double(a) a + a'.  They are copied into your
program same way as functions.
#if, #else, #elif, #endif  Not used these much, in most programs 'if (...)
else' works good enough for me.
#ifdef, #ifndef  Checks if a constant is #defined or not.  Good for making
some DEBUG constant and check for this in your program.  That way you can
have the RCX beep and do things in debug mode, and stop it doing those
things by removing the DEBUG constant.
5)Events :how can I use them ? where are they useful than choosing other
system ?

Ask Dave Baum (haven't looked much into events yet) :)

Thanks for the help.

You are welcome,
Jon Kongsvold



Message is in Reply To:
  help with NQC
 
Finally i decided to use NQC, the Lego Programmer was too much limited, and others system to program the RCX where still limited;in the other hand ,however, i do not want to get under the firmware. Ok ,i downloaded the firmware 2.0 ,the NQC+Manual (...) (24 years ago, 17-Oct-00, to lugnet.robotics)

4 Messages in This Thread:



Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR