Tutorial about writing NXC code in Notepad++

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
spillerrec
Posts: 358
Joined: 01 Oct 2010, 06:37
Location: Denmark
Contact:

Tutorial about writing NXC code in Notepad++

Post by spillerrec »

Muntoo asked me to write a bit about how to compile NXC code in Notepad++ so I did. You can read it on my blog, here: http://spillerrec.wordpress.com/2011/03 ... n-notepad/'
Just adding it here in case anyone is interested.

So there is a bit info about how to use nbc.exe to compile NXC files without having to use BricxCC.
Then I go through how to make it easier to read compile errors if any and how to automatically go to the line where the error is reported to be.
And then some misc. topics.

I have never tried to use BT together with nbc.exe. Have anyone had experience with this and know how to do it? I would like to add it to the guide as there are most likely some who will need it...
My blog: http://spillerrec.dk/category/lego/
RICcreator, an alternative to nxtRICeditV2: http://riccreator.sourceforge.net/
muntoo
Posts: 834
Joined: 01 Oct 2010, 02:54
Location: Your Worst Nightmare
Contact:

Re: Tutorial about writing NXC code in Notepad++

Post by muntoo »

For Bluetooth, you need to use NeXTTool.exe.

Here's the NeXTTool.exe -help:

Code: Select all

C:\Program Files\BricxCC>NeXTTool.exe -help
NeXTTool version 1.2 (1.2.1.3, built Wed Jul 15 18:11:49 CDT 2009)
     Copyright (c) 2006-2010 John Hansen
Usage: NeXTTool [options] [actions]
Options:
   /COM=port: specify port name (COMn, usb, resource string, or alias)
   /BT[=name]: use bluetooth (selects the first brick found or the named brick)
   /HEX: use hexidecimal for numeric output
   /Duration=<n>: specify the tone duration for the playtone action
   /Inbox=<n>: use inbox number n when sending or reading a message
   /Loop: loop when playing sound files
   /Relative: reset output position relative
   /Empty: empty mailbox when reading
   /Bin[=filename]: dump data output as binary to a file (nxt.bin)
Actions:
   -init : initialize nxt.dat file
   -listbricks : list resource names of all found NXT bricks
   -clear : erase all items on the brick
   -battery : return the battery level
   -input=<N> : read input N (0-3)
   -output=<N> : read the status of output N (0-2)
   -mute : stop playing sounds
   -playtone=<frequency> : play a tone for the specified duration
   -run=<filename> : run the specified program
   -runningprogram : return the name of the currently running program
   -stop : stop the currently running program
   -playfile=<filename> : play the specified sound file
   -firmware=<filename> : download firmware
   -download=<filename> : download the specified file to the NXT
   -upload[=<pattern>] : upload the specified file(s) from the NXT (or *.*)
   -listfiles[=<pattern>] : list the files matching the pattern (or *.*)
   -listmodules[=<pattern>] : list the modules matching the pattern (or *.*)
   -delete=<filename> : delete the specified file from the NXT
   -datalog | -datalog_full: upload datalog (_full == verbose)
   -eeprom=<n> | -eeprom_full: upload eeprom block (_full == all blocks)
   -memory=<n> | -memory_full: upload 128 bytes of memory (_full == all memory)
   -map: upload memory map
   -keepalive : return the current sleep time limit
   -sleep=<timeout> : set NXT sleep timeout (in minutes)
   -msg=<string> : send the specified message to the NXT
   -readmsg=<box> : read the message from the specified box
   -resetoutputposition=<port> : reset the position for the specified port
   -resetinputsv=<port> : reset the input scaled value for the specified port
   -setname=<new_name> : set the name of the NXT
   -getname : return the name of the NXT
   -versions : return the NXT firmware and protocol versions
   -deviceinfo : return all NXT device information
   -freemem : return the amount of free memory
   -lsstatus=<port> : return the low speed status for the specified port
   -boot : reset the NXT into SAMBA mode (usb only)
   -btreset : reset the NXT bluetooth to factory settings (usb only)
   -defrag : defragment the NXT filesystem
General:
   -help : display command line options
As you can see, you use /BT=[name] for Bluetooth, or /COM=port for USB.


While I'm at it, here's the nbc.exe -help:

Code: Select all

C:\Program Files\BricxCC>nbc.exe -help
Next Byte Codes Compiler version 1.2 (1.2.1.3, built Tue Jun 29 06:36:09 CDT 201
0)
     Copyright (c) 2006-2010, John Hansen
Syntax: nbc [options] filename [options]

   -S=<portname>: specify port name (usb), brick resource name, or alias
   -d: download program
   -r: download and run program
   -b: treat input file as a binary file (don't compile it)
   -q: quiet
   -n: prevent the system file from being included
   -D=<sym>[=<value>]: define macro <sym>
   -x: decompile program
   -Z[1|2]: turn on compiler optimizations
   -ER=n: set maximum errors before aborting (0 == no limit)
   -PD=n: set max preprocessor recursion depth (default == 10)
   -O=<outfile> : specify output file
   -E=<filename> : write compiler messages to <filename>
   -I=<path>: search <path> for include files
   -nbc=<filename> : save NXC intermediate NBC code to <filename>
   -L=<filename> : generate code listing to <filename>
   -Y=<filename> : generate symbol table to <filename>
   -w[-|+] : warnings off or on (default is on)
   -sm[-|+] : status messages off or on (default is on)
   -EF : enhanced firmware
   -safecall: NXC will wrap all function calls in Acquire/Release
   -api: dump the API to stdout
   -v=n: set the targeted firmware version (default == 128, NXT 1.1 == 105)
   -help : display command line options
Image

Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE


Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
Post Reply

Who is online

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