MacNQC User's Guide
Version 3.0, by K. Robert Bate
Contents
1 Introduction
1.1 Requirements
1.2 Credits
2 MacNQC Menus
2.1 About Menu
2.1.1 About MacNQC...
2.1.2 Desk Accessories
2.2 File Menu
2.2.1 New
2.2.2 Open
2.2.3 Open Recent
2.2.4 Close
2.2.5 Save
2.2.6 Save As...
2.2.7 Revert
2.2.8 Page Setup...
2.2.9 Print...
2.2.10 Quit
2.3 Edit Menu
2.3.1 Undo
2.3.2 Redo
2.3.3 Cut
2.3.4 Copy
2.3.5 Paste
2.3.6 Clear
2.3.7 Select All
2.3.8 Preferences...
2.3.9 Configure Joystick...
2.4 Search Menu
2.4.1 Find and Replace...
2.4.2 Find Next
2.4.3 Enter Find Selection
2.4.4 Find Selection
2.4.5 Replace Selection
2.4.6 Replace and Find Next
2.4.7 Replace All
2.4.8 Goto Line...
2.5 Program Menu
2.5.1 Compile and Download
2.5.2 Check Syntax
2.5.3 Disassemble
2.5.4 Run Program
2.5.5 Stop Program
2.5.6 Program Slot
2.5.7 Compile and Save Program Image...
2.5.8 Download Program Image...
2.5.9 Disassemble Program Image...
2.5.10 Show Error Window
2.5.11 Show System API
2.6 RCX Menu
2.6.1 Motor and Sensor Panel
2.6.2 Information Panel
2.6.3 Joystick Panel
2.6.4 Variables Panel
2.6.5 Miscellaneous Panel
2.6.6 Raw Data Panel
2.6.7 Piano Panel
2.6.8 Upload Datalog
2.6.9 Download Firmware
2.6.10 Clear Memory
2.7 Windows Menu
2.7.1 Show/Hide Toolbar
2.7.2 Video Settings...
2.7.3 Video Monitor Panel
2.7.4 Source Window Names
2.8 Help Menu
2.8.1 About Balloon Help...
2.8.2 Show Balloons
2.8.3 NQC Guide
2.8.4 NQC Web Site
2.8.5 MacNQC Guide
2.8.6 MacNQC Web Site
MacNQC is an application which is a simple editor and the NQC compiler. It also has some windows which allow you to interact with the RCX. NQC the language is not described in this document. It is described in NQC User's Guide.
For up-to-date information for MacNQC, visit the MacNQC Web Site.
1.1 RequirementsMacNQC Requires:
MacNQC X Requires:
MacNQC was originally written by Dave Baum and when he was not able to keep it maintained I took it over.
Portions created by Dave Baum are © 1999 Dave Baum. All Rights Reserved.
Portions created by K. Robert Bate are © 2000-3 K. Robert Bate. All Rights Reserved.
MacNQC uses the following packages:
This section describes the menus in the MacNQC application.
2.1 About MenuDisplay the about box dialog which has the version numbers on MacNQC and NQC displayed in it.
Creates a new untitled text document window.
Use the Open File Dialog to select an existing text file to open and create a document window.
The Open Recent hierarchical submenu contains a list of files you have opened recently. To open one of these files, choose it from the Open Recent submenu. MacNQC remembers the most recent eight files that were opened. If the menu item is greyed out then the file is not accessible (renamed, moved, or thrown out).
Close the top most window. If the window is a text document that has not been saved, a dialog will be presented to ask if the document should be saved.
The text document is saved. If the document does not have a name the Save File Dialog is presented so that the text document can be given a name.
The Save File Dialog is presented so that the text document can be given a name.
The current contents of the text document is replaced with the last saved version.
Show the standard Page Setup dialog.
Show the standard Print dialog and if OK is pressed, print the document on the selected printer.
Quit the application.
MacNQC provides the ability to undo multiple edits, one action at a time. The number of edits that may be undone is limited only by available memory.
The Undo command essentially reverses any change you may have made to the content of your file. Each action, which is bounded by a mouse click or arrow key, is one undo-able incident.
MacNQC also supports multiple Redos. If you havenŐt made any changes after performing an Undo, you can redo each action, in order, by selecting that command from the Edit menu, or typing Command- Shift-Z. However,once you perform a new action, you cannot redo any actions that you undid before you made that change.
Removes the selected text from the window and stores it on the Clipboard.
Copies the selected text from the window and stores it on the Clipboard.
Inserts the text stored on the Clipboard at the insertion point in the window. If there is a selection, pasting replaces the selection with the contents of the Clipboard.
Removes the selected text from the window.
Selects all of the text in the window.
There are five targets available. They are CyberMaster, RCX, RCX2 which is the RCX running the 2.0 firmware, Scout and Spybotics.
Defining the target has several effects:
The default target is RCX.
2.3.8.1.2 Use NQC 1.0 APIsThis option make NQC compatible with version 1.3 of the NQC compiler. This includes some changes in syntax as well as the 1.3 APIs for the RCX. Default is off
If this option is on then include the source code in the disassembly. Default is on.
With this option on, if the program has been successfully compiled and downloaded into the RCX, then a run command is sent. The default is off.
When this option is on the "Includes" folder in the MacNQC folder is searched for the included file if the file has not been found in the same folder as the source file. The default is off.
This popup is used to select how MacNQC will communicate to the RCX.
If this option is on then the firmware is downloaded at four times the normal speed. It is not always successful and is not available when using the USB Tower on OS9. Default is off.
This option make the datalog output more verbose. Default is off.
If the program hangs when downloading, Turn this option off. (OSX and serial only) Default is on.
This options sets the IR mode on the RCX to near or far. Default is near.
The popup menu chooses which font will be used in the source and disassemble windows.
Sets the size of the font used in the source and disassemble windows.
Sets the width of a tab to the number of spaces entered.
When this option is selected, pressing Return automatically inserts tabs to indent the new line to the same level as the previous line.
The contents of the file that is being compiled will be saved if this option is on. Default is on.
If this option is on then tooltips will be shown for the toolbar. Default is on.
The default color of the text. The default is black.
The default color of the background of the window. The default is white.
This option turns on the syntax coloring. The default is on.
The default color of the text in a comment. Comments start with "/*" and end with "*/" and can be multi-lined. An alternate way of doing comments is to use "//" which is a comment to the end of the line. The default is red.
The default color of the language keywords (i.e. if, else, while...) . The default is blue.
The default color of the RCX constants (i.e. SENSOR_1, OUT_B, LIGHT_OFF...) . The default is purple.
The default color of the RCX keywords (i.e. SetSensor, OnFwd, Program...) . The default is green.
On OS 8 and 9 the look and contents of this dialog will depend on InputSprockets and which joystick you have connected to your computer.
On OS 10 the dialog will look like this:
This is the text that will be searched for.
This is the text that will be substituted.
Finds the first occurrence of the find string in the active window.
Finds the first occurrence of the find string in the active window after the current insertion point and replaces it with the replace string.
Replaces every occurrence of the find string in the active window with the replace string.
When this checkbox is selected, the find string is matched only if it is surrounded in the document text by word-break characters (white space or punctuation). Otherwise, the find string is matched anywhere in the text.
When this checkbox is selected, Uppercase and lowercase letters are treated as different letters. Otherwise, uppercase and lowercase letters are treated as if they were the same.
Finds the next occurrence of the find string without displaying the Find dialog again.
Enters the currently selected text into the find string without displaying the Find dialog again.
Enters the currently selected text into the find string and then finds the next occurrence of the find string without displaying the Find dialog.
Replaces the selection with the replace text
Replaces the selection with the replace string and looks for the find string again.
Replaces all occurrences of the find string with the replace string.
Type in a line number into the goto line number field and click on OK and the frontmost text window will jump to display that line.
Compile the topmost source file into RCX byte codes and if there were no errors then download them into the RCX. If a numbered program slot is selected then the RCX is set to that program slot before the code is downloaded.
Check the topmost source file for correct syntax. Does a compile but does not download the RCX byte codes to the RCX.
Compile the topmost source file into RCX byte codes and instead of downloading them display the byte codes in a window. If the "Merge Source and Assembly" option is on then include the source code in the disassembly.
Send a run program command. Which program is run is dependent on what is selected in the program slot menu.
Stop the currently running program in the RCX.
If the program selected is "Use Front Panel", a program slot is not forced otherwise the RCX is set to the program slot selected before the code is downloaded.
Compile the topmost source file into RCX byte codes and if there were no errors then save the image in a file.
Select a program image file then download it into the RCX.
Display the byte codes of the selected program image file.
Display the window which has the list of compile errors (if any).
Display a window containing the system header file used during the compile.
Displays the status of the three motors on the RCX.
2.6.1.1.1 Reverse/Stop/Float/ForwardThe four buttons, left green arrow (reverse), stop sign (stop), blue waves (float), and right green arrow (forward) allow you to set the direction of the motor.
The slider sets the power level of the motor from 0 (leftmost) to 7 (rightmost).
The start button sends the motor commands to the RCX and starts the timer. When the button reads stop then it will send a stop command to the motors and stop the timer.
The timer displays the length of time that the motors have been on in 1/10th seconds.
Displays the status of the three sensors on the RCX.
2.6.1.2.1 Type Popup MenuAllows you to pick which sensor should be on this port. The values are Unknown, Touch, Light, Rotation, Temp °C, Temp °F, Touch/Pulse, Touch/Edge and Touch/Raw.
The current value of the sensor.
Gets the values of the sensors from the RCX.
Displays the status of the RCX.
Displays the version of the firmware downloaded to the RCX. Currently there are only two versions, 3.09 (Mindstorms 1.0 and 1.5) and 3.28 (Mindstorms 2.0)
Displays the state of the current batteries in the RCX. Just below the text is a graphical representation on the battery level.
Displays which program the RCX has currently selected.
Pressing any of the green arrow buttons will turn on the motors to try to have the robot go in that direction. Pressing the red stop sign will stop the motors. The four buttons "I", "II", "III", and "IV" will start task 1, 2, 3, and 4 respectively.
The slider sets the power level of the motor from 0 (leftmost) to 7 (rightmost).
Selects the Left-Right motor algorithm or the Drive-Steer.
Selects the motor that is to be used for the left/drive motor and if the commands going to it should be reversed.
Selects the motor that is to be used for the right/steering motor and if the commands going to it should be reversed.
When the checkbox is on, the value next to it is gotten from the RCX.
Sets all of the checkboxes to on.
Sets all of the checkboxes to off.
Interrogates the RCX for all of the values that have their checkbox on.
Sets the frequency that the RCX will be polled for the values. The polling intervals are manual, every second, every five seconds, every 10 seconds, every thirty seconds, every minute, and every 2 minutes
Send a message to the RCX. The message is a value between 0 and 255 inclusive. The value can be entered in octal (needs a leading zero), decimal or hexadecimal (needs a leading "0x").
Set the RCX's clock to the specified time specified in hours:minutes.
Send a remote command to the RCX. The remote command is a value between 0 and 65535 inclusive. The value can be entered in octal (needs a leading zero), decimal or hexadecimal (needs a leading "0x").
Set the auto shutoff timeout in minutes for the RCX.
The raw data panel allows you to download raw data to the rcx and get the reply. The data needs to be entered in hexadecimal. Spaces can be used to enhance readability.
Inserts a note into the song program.
Inserts a rest into the song program.
Selects the length of the note/rest to be entered into the song program. Whole, half, quarter, eight and sixteenth.
This button plays the song. If the Mac checkbox is on then the Mac will play the notes, if the RCX checkbox is on then the RCX will play the notes.
This button clears the song program.
When the checkbox is on, the notes when played are played on the Mac. (Requires Quicktime 2.6 or later)
When the checkbox is on, the notes when played are played on the RCX.
This is the program that can be used to make the RCX play the song. Cut and paste this into your nqc source file.
Upload the datalog and display it in a window. The datalog can then be printed and/or saved in a file. If the option "Verbose Datalog" is selected then a more verbose datalog is created.
Search the "Firmware" folder for a file in which the name starts with "firm" and ends with ".lgo" and download the first one found to the RCX.
This command will erase all programs and any datalog present in the RCX.
Displays or hides toolbar.
The commands on the toolbar are from left to right: New, Open, Save, Undo, Redo, Cut, Copy, Paste, Find and Replace..., Find Next, Compile and Download, Check Syntax, Run Program, Stop Program, Program Slot, Compile and Save Program Image... and Download Program Image....
Displays the settings that are used by quicktime for the Video Monitor Panel. Only enabled when the Video Monitor Panel is frontmost.
This will open a window that displays the output of a quicktime compatible video camera.
These are the names of the source windows that are open. Selecting one will make it frontmost.
Displays the system balloon help dialog. (Not on OSX)
Currently MacNQC does not have any balloons to display. (Not on OSX)
The document describing the syntax of the NQC language and the API which describes the system functions, constants, and macros that can be used by programs
For up-to-date information and documentation for NQC, visit the NQC Web Site
This document.
The MacNQC Web Site is where the most up-to-date information and the latest and greatest version of MacNQC can be found.