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

1 Introduction

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 Requirements

MacNQC Requires:

MacNQC X Requires:

1.2 Credits

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:

2 MacNQC Menus

This section describes the menus in the MacNQC application.

2.1 About Menu 2.1.1 About MacNQC...

Display the about box dialog which has the version numbers on MacNQC and NQC displayed in it.

2.1.2 Desk Accessories

2.2 File Menu 2.2.1 New

Creates a new untitled text document window.

2.2.2 Open

Use the Open File Dialog to select an existing text file to open and create a document window.

2.2.3 Open Recent

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).

2.2.4 Close

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.

2.2.5 Save

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.

2.2.6 Save As...

The Save File Dialog is presented so that the text document can be given a name.

2.2.7 Revert

The current contents of the text document is replaced with the last saved version.

2.2.8 Page Setup...

Show the standard Page Setup dialog.

2.2.9 Print...

Show the standard Print dialog and if OK is pressed, print the document on the selected printer.

2.2.10 Quit

Quit the application.

2.3 Edit Menu 2.3.1 Undo

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.

2.3.2 Redo

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.

2.3.3 Cut

Removes the selected text from the window and stores it on the Clipboard.

2.3.4 Copy

Copies the selected text from the window and stores it on the Clipboard.

2.3.5 Paste

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.

2.3.6 Clear

Removes the selected text from the window.

2.3.7 Select All

Selects all of the text in the window.

2.3.8 Preferences... 2.3.8.1 Compiler Preferences

2.3.8.1.1 Target

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:

  • A compile time symbol is defined for the appropriate target (__CM, __RCX, __SCOUT or __SPY).
  • The number of available tasks, subroutines, and variables is determined by the target type.
  • The API functions are somewhat different between targets. See the NQC User's Guide for the differences.

The default target is RCX.

2.3.8.1.2 Use NQC 1.0 APIs

This 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

2.3.8.1.3 Merge Source and Assembly

If this option is on then include the source code in the disassembly. Default is on.

2.3.8.1.4 Run Program after Download

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.

2.3.8.1.5 Search System Includes Folder

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.

2.3.8.2 Communication Preferences

2.3.8.2.1 Device

This popup is used to select how MacNQC will communicate to the RCX.

2.3.8.2.2 Fast Firmware Download

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.

2.3.8.2.3 Verbose Datalog

This option make the datalog output more verbose. Default is off.

2.3.8.2.4 Use tcdrain (OSX only)

If the program hangs when downloading, Turn this option off. (OSX and serial only) Default is on.

2.3.8.2.4 IR Mode

This options sets the IR mode on the RCX to near or far. Default is near.

2.3.8.3 Editor Preferences

2.3.8.3.1 Font

The popup menu chooses which font will be used in the source and disassemble windows.

2.3.8.3.2 Size

Sets the size of the font used in the source and disassemble windows.

2.3.8.3.3 Tab Size

Sets the width of a tab to the number of spaces entered.

2.3.8.3.4 Auto Indent

When this option is selected, pressing Return automatically inserts tabs to indent the new line to the same level as the previous line.

2.3.8.3.5 Save file before compiling

The contents of the file that is being compiled will be saved if this option is on. Default is on.

2.3.8.3.6 Show Tooltips

If this option is on then tooltips will be shown for the toolbar. Default is on.

2.3.8.4 Text Colors Preferences

2.3.8.4.1 Foreground

The default color of the text. The default is black.

2.3.8.4.2 Background

The default color of the background of the window. The default is white.

2.3.8.4.3 Activate Syntax Coloring

This option turns on the syntax coloring. The default is on.

2.3.8.4.4 Comments

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.

2.3.8.4.5 Keywords

The default color of the language keywords (i.e. if, else, while...) . The default is blue.

2.3.8.4.6 RCX Constants

The default color of the RCX constants (i.e. SENSOR_1, OUT_B, LIGHT_OFF...) . The default is purple.

2.3.8.4.7 RCX Keywords

The default color of the RCX keywords (i.e. SetSensor, OnFwd, Program...) . The default is green.

2.3.9 Configure Joystick...

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:

2.4 Search Menu 2.4.1 Find and Replace...

2.4.1.1 Find String

This is the text that will be searched for.

2.4.1.2 Replace String

This is the text that will be substituted.

2.4.1.3 Find Button

Finds the first occurrence of the find string in the active window.

2.4.1.4 Replace Button

Finds the first occurrence of the find string in the active window after the current insertion point and replaces it with the replace string.

2.4.1.5 Replace All Button

Replaces every occurrence of the find string in the active window with the replace string.

2.4.1.6 Match Whole Word

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.

2.4.1.7 Case Sensitive

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.

2.4.2 Find Next

Finds the next occurrence of the find string without displaying the Find dialog again.

2.4.3 Enter Find Selection

Enters the currently selected text into the find string without displaying the Find dialog again.

2.4.4 Find Selection

Enters the currently selected text into the find string and then finds the next occurrence of the find string without displaying the Find dialog.

2.4.5 Replace Selection

Replaces the selection with the replace text

2.4.6 Replace and Find Next

Replaces the selection with the replace string and looks for the find string again.

2.4.7 Replace All

Replaces all occurrences of the find string with the replace string.

2.4.8 Goto Line...

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.

2.5 Program Menu 2.5.1 Compile and Download

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.

2.5.2 Check Syntax

Check the topmost source file for correct syntax. Does a compile but does not download the RCX byte codes to the RCX.

2.5.3 Disassemble

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.

2.5.4 Run Program

Send a run program command. Which program is run is dependent on what is selected in the program slot menu.

2.5.5 Stop Program

Stop the currently running program in the RCX.

2.5.6 Program Slot

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.

2.5.7 Compile and Save Program Image...

Compile the topmost source file into RCX byte codes and if there were no errors then save the image in a file.

2.5.8 Download Program Image...

Select a program image file then download it into the RCX.

2.5.9 Disassemble Program Image...

Display the byte codes of the selected program image file.

2.5.10 Show Error Window

Display the window which has the list of compile errors (if any).

2.5.11 Show System API

Display a window containing the system header file used during the compile.

2.6 RCX Menu 2.6.1 Motor and Sensor Panel

2.6.1.1 Motors

Displays the status of the three motors on the RCX.

2.6.1.1.1 Reverse/Stop/Float/Forward

The 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.

2.6.1.1.2 Slider

The slider sets the power level of the motor from 0 (leftmost) to 7 (rightmost).

2.6.1.1.3 Start/Stop Button

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.

2.6.1.1.4 Timer

The timer displays the length of time that the motors have been on in 1/10th seconds.

2.6.1.2 Sensors

Displays the status of the three sensors on the RCX.

2.6.1.2.1 Type Popup Menu

Allows 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.

2.6.1.2.2 Value

The current value of the sensor.

2.6.1.2.3 Refresh Button

Gets the values of the sensors from the RCX.

2.6.2 Information Panel

2.6.2.1 RCX is alive/RCX is not alive

Displays the status of the RCX.

2.6.2.2 Firmware Version

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)

2.6.2.3 Battery Level

Displays the state of the current batteries in the RCX. Just below the text is a graphical representation on the battery level.

2.6.2.4 Program Slot

Displays which program the RCX has currently selected.

2.6.3 Joystick Panel

2.6.3.1 Movement

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.

2.6.3.2 Speed Slider

The slider sets the power level of the motor from 0 (leftmost) to 7 (rightmost).

2.6.3.3 Drive Popup Menu

Selects the Left-Right motor algorithm or the Drive-Steer.

2.6.3.4 Left Motor

Selects the motor that is to be used for the left/drive motor and if the commands going to it should be reversed.

2.6.3.5 Right Motor

Selects the motor that is to be used for the right/steering motor and if the commands going to it should be reversed.

2.6.4 Variables Panel

2.6.4.1 Checkboxes

When the checkbox is on, the value next to it is gotten from the RCX.

2.6.4.2 Check All Button

Sets all of the checkboxes to on.

2.6.4.3 Uncheck All Button

Sets all of the checkboxes to off.

2.6.4.4 Get Values Button

Interrogates the RCX for all of the values that have their checkbox on.

2.6.4.5 Poll Popup Menu

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

2.6.5 Miscellaneous Panel

2.6.5.1 Message

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").

2.6.5.2 Watch

Set the RCX's clock to the specified time specified in hours:minutes.

2.6.5.3 Remote

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").

2.6.5.4 Sleep

Set the auto shutoff timeout in minutes for the RCX.

2.6.6 Raw Data Panel

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.

2.6.7 Piano Panel

2.6.7.1 Piano Keys

Inserts a note into the song program.

2.6.7.2 Rest

Inserts a rest into the song program.

2.6.7.3 Note Length

Selects the length of the note/rest to be entered into the song program. Whole, half, quarter, eight and sixteenth.

2.6.7.4 Play Button

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.

2.6.7.5 Clear Button

This button clears the song program.

2.6.7.6 Mac Checkbox

When the checkbox is on, the notes when played are played on the Mac. (Requires Quicktime 2.6 or later)

2.6.7.6 RCX Checkbox

When the checkbox is on, the notes when played are played on the RCX.

2.6.7.7 Song Program

This is the program that can be used to make the RCX play the song. Cut and paste this into your nqc source file.

2.6.8 Upload Datalog

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.

2.6.9 Download Firmware

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.

2.6.10 Clear Memory

This command will erase all programs and any datalog present in the RCX.

2.7 Windows Menu 2.7.1 Show/Hide Toolbar

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....

2.7.2 Video Settings...

Displays the settings that are used by quicktime for the Video Monitor Panel. Only enabled when the Video Monitor Panel is frontmost.

2.7.3 Video Monitor Panel

This will open a window that displays the output of a quicktime compatible video camera.

2.7.4 Source Window Names

These are the names of the source windows that are open. Selecting one will make it frontmost.

2.8 Help Menu 2.8.1 About Balloon Help...

Displays the system balloon help dialog. (Not on OSX)

2.8.2 Show Balloons

Currently MacNQC does not have any balloons to display. (Not on OSX)

2.8.3 NQC Guide

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

2.8.4 NQC Web Site

For up-to-date information and documentation for NQC, visit the NQC Web Site

2.8.5 MacNQC Guide

This document.

2.8.6 MacNQC Web Site

The MacNQC Web Site is where the most up-to-date information and the latest and greatest version of MacNQC can be found.