Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
exe
Contents:
Purpose:................................................................................................................................................................... 1
Integrated Explorer: ................................................................................................................................................ 1
Editor Pane:............................................................................................................................................................. 2
Identify Function:.................................................................................................................................................... 3
Download Function:................................................................................................................................................ 4
Directive Menu and Buttons: .................................................................................................................................. 6
BASIC Stamp 2pe Support: .................................................................................................................................... 6
Generate Object Code:............................................................................................................................................ 6
On-Line Help: ......................................................................................................................................................... 8
Tip-of-the-Day: ....................................................................................................................................................... 8
Open From… and Save To… : ............................................................................................................................... 8
Command-Line Options: ........................................................................................................................................ 8
File Associations:.................................................................................................................................................... 8
Default Stamp Directories / Source Code Examples: ............................................................................................. 9
PBASIC Directive:.................................................................................................................................................. 9
Port Directive:....................................................................................................................................................... 10
Stampw.exe Command-Line Options: .................................................................................................................. 10
Additional Command-Line Details:.................................................................................................................. 11
About the /PIPE Switch: ................................................................................................................................... 11
Stamp Editor Messages:........................................................................................................................................ 12
Final and Intermediate Messages:..................................................................................................................... 12
List Of Messages:.............................................................................................................................................. 13
Purpose:
This document contains new information about BASIC Stamp Editor v1.33 and v2.0 that is not shown in the BASIC Stamp
manual v2.0.
The upper portion of the integrated explorer is the Recent list. The Recent list is a drop-down list of default, favorite and
recently visited directories. If you select a directory from the Recent list, the integrated explorer will automatically navigate
to that directory. The button to the left of the Recent list allows you to limit the Directory list display to only the directories
that are in the Recent list (effectively hiding any drives and directories that are not in your Recent list). The Recent list
button behaves like a toggle switch; 1) selecting it switches to the “Show recent folders only” mode, 2) selecting it again
switches back to the “Show all folders” mode.
The Directory list, right below the Recent list, is similar to the “Folders panel” in Windows explorer. The Directory list
displays drives and directories in a hierarchical tree fashion. If a directory is selected, the Folders list displays the files in
that directory.
The Filters list, at the bottom, is a drop-down list of file extension filters to apply to the Files list. It works just like the
“Save as type:” field of a standard open or save dialog.
Multi-file
Integrated editor with
Explorer syntax
Panel highlighting
The integrated explorer window can be resized via the vertical splitter bar that separates it and the edit pane. The
Directory list and File list can be resized via the horizontal splitter bar that separates them. The integrated explorer can
also be hidden or shown via the Explorer toolbar button, by pressing Ctrl-E or by resizing it to zero size via the vertical
splitter bar.
Each editor pane can be individually split into two views of the same source code. This can be done via the Split button
on the toolbar, pressing Ctrl-L, or clicking and dragging the top or bottom border of the editor pane with the mouse. Once
split, the top and bottom edit controls allow viewing of different areas of the same source code; this can be handy when
needing to keep variable declarations or a particular routine in view while modifying a related section of code elsewhere.
Bookmarks;
provide quick Syntax
navigation to highlighting;
important Provides easy
sections of distinction of
code. reserved
words and
code with
special
meaning.
Automatic line numbers can be enabled or disabled via the “Show Line Numbers” checkbox on the Preferences -> Editor
Appearance window. Line numbers, when enabled, appear in the gutter (gray area on the left of the editor pane).
Bookmarks can be enabled or disabled via the “Show Bookmarks” checkbox on the Preferences -> Editor Appearance
window. Bookmarks are small numbered icons that appear in the gutter (gray area on the left of the editor pane).
Bookmarks provide a way to mark lines or sections of code that you need to quickly navigate to. You can define up to 9
bookmarks by clicking on the gutter where you want the bookmark placed or by pressing Ctrl-B when the caret is on the
desired line. You can navigate to any defined bookmark by pressing Ctrl-# (where # is the 1 though 9 keys) or by
selecting Go To Bookmark from the Edit menu.
The Device Type column shows the type of BASIC Stamp found on the respective port. For example, in the figure above,
the Stamp Editor found a BASIC Stamp 2e on COM port 2 and a BASIC Stamp 2 on COM port 3. There were no BASIC
Stamps found on COM port 4.
The Version column displays the firmware version number of the BASIC Stamp that was found.
The Loopback column indicates whether or not a loopback connection was found on the serial port. The loopback
connection is created by BASIC Stamp development boards, such as the Board of Education, across serial port pins 6
and 7 (of a DB9). A “Yes” in this column is an indication that the serial port and serial cable are properly connected to a
BASIC Stamp development board.
The Echo column indicates whether or not a communication echo was detected on the serial port’s transmit and receive
pins (pins 2 and 3). The BASIC Stamp module creates this echo naturally, even without power. A “Yes” in this column is
an indication that the serial port and serial cable are properly connected to a BASIC Stamp, and if using a BASIC Stamp
development board, it’s an indication that the BASIC Stamp is properly connected to the development board.
The Loopback and Echo columns are great for doing some simple connection diagnosis. For example, a Yes in both
columns indicates the serial port and serial cable are properly connected and that the BASIC Stamp is properly inserted
into its socket.
This prompt allows you to quickly correct the situation by clicking on the BS2e (if you really intended to download to the
BS2e in the first place). Keep in mind that programs written for one BASIC Stamp model may not function properly on a
different BASIC Stamp module. Click on the More Info button for more detail. NOTE: If you select the BS2e button, as in
this example, the Stamp Editor will modify the $STAMP directive in the program, will notify you of this change and what it
means, and then will try to download to the BS2e.
Another possibility is having two or more of the same BASIC Stamp model connected to the PC. In this case, the Stamp
Editor will prompt you for clarification as to which BASIC Stamp module you want to download to.
The “Stamp Mode” simply means, which BASIC Stamp model is the desired target for a particular PBASIC program. The
Stamp Directive (a special command inserted near the top of the PBASIC program) tells the BASIC Stamp editor which
BASIC Stamp the code is intended for. While the directive can be entered, or modified, manually, it can be tedious to
remember the syntax. For this reason a Directive menu and “Stamp Mode” buttons have been provided. Simply selecting
the desired menu item or clicking on the desired Stamp Mode button will cause the Stamp Editor to insert or modify the
Stamp Directive in you PBASIC program.
The Stamp Directive is required to be in each PBASIC program. The editor determines which Stamp to target for
downloading based on this directive. NOTE: Any code that is missing the Stamp Directive, but who's filename contains a
known Stamp extension (.bs2, bse, bsx, bsp) will be recognized by the extension and an appropriate Stamp Directive will
be added automatically for you.
The PBASIC version directive allows you to indicate which version of the PBASIC language to use. Currently the options
are 2.0 (the default) and 2.5. See the on-line help or “PBASIC Compiler 2.0 Beta 2.pdf” document for more information on
the enhanced v2.5 language syntax. The PBASIC directive is only required if you want to use version 2.5; version 2.0 is
assumed if no PBASIC directive exists in the source code. See “PBASIC Directive,” below for more information.
The PORT directive allows you to indicate which serial port to download the program on. This is convenient if you have
more than one BASIC Stamp of the same model connected to your computer at the same time; if each program indicates
a different port (using the PORT directive) then downloading won’t cause unnecessary on-screen prompts. See “Port
Directive,” below for more information.
In the example above, we chose to generate a single executable with custom names and messages as shown. Then we
clicked the Generate… button (which prompted us for a file name) and the file was created. When a user runs the file we
just generated, they see a screen similar to the figure below:
Context sensitive help (highlighting a word in editor and pressing F1 key) is also supported. On-line help can remain open
while using the Stamp Editor; simply press ALT+TAB to toggle back and forth between the Stamp Editor and on-line help.
NOTE: On-Line help requires Microsoft's HTML Help utility and Internet Explorer 4.0 or above (IE6.0 recommended). The
proper version of HTML Help is included with Windows 2000 and Windows XP. On other versions of Windows you may
have to install or upgrade your HTML Help utility to properly view the Stamp Editor’s on-line help. The HTML Help
upgrade program (hhupd.exe) is included as part of the BASIC Stamp Editor setup program. You can download the latest
version of Internet Explorer from Microsoft’s web site at: http://www.microsoft.com/ie
Shortcut keys CTRL+SHFT+O and CTRL+SHFT+S activate the Open From and Save To feature, respectively.
Also, when using any Explorer-shell for file browsing, right-clicking on a BASIC Stamp source code file provides you with
an Open With Stamp Editor option.
The Stamp Editor automatically sets it’s default directories (in Preferences) to point to these source code examples. This
makes them immediately available via the File -> Open From… menu.
Note that if you are upgrading from a previous version of the Stamp Editor and you have set your own default directories,
from the Edit -> Preferences, Editor Operations tab, they will not be replaced with the source code example directories;
upon opening the editor, only default directory options that are blank will be redirected to the source code examples.
See the on-line help or “PBASIC 2.5 Syntax.pdf” document for more information on the enhanced v2.5 language syntax.
The PBASIC directive is only required if you want to use version 2.5; version 2.0 is assumed if no PBASIC directive exists
where # is a valid port number. When any PBASIC program containing this directive is downloaded, all other ports will be
ignored. This directive is especially important if using two of the same BASIC Stamp models (such as two BS2s) on two
COM ports and you have two different PBASIC programs to download (one to each BS2). Without this directive,
developing and downloading in this case would be a tedious task of always answering the "which Stamp?" prompt.
The Port directive can be automatically inserted or modified by selecting the appropriate port from the Directive -> Port
menu. The COM ports listed in the Directive -> Port menu are automatically updated any time a change is made to the
exiting computer hardware or to the available ports list (in preferences).
The following is the syntax and description of the Stamp Editor’s command-line switches.
/Com# – Specify com port (serial port) to download to. # is a valid com port number. NOTE: must be one
word, ie: Com2 indicates com port 2.
/ReadOnly – Open source_file in read-only mode. The CTRL key acts as a download key when in read-only mode.
Requires source_file option. This command option is not available if double-piped communication is
established.
/Identify – Identify BASIC Stamp modules on COM ports. Requires redirection to output_file.
/Tokenize – Tokenize source code. No prompts will be displayed. Requires source_file option and redirection to
output_file.
/Download – Tokenize source code, and download it (if tokenization successful). Requires source_file option and
redirection to output_file.
/Updates – Provides program slot number (if applicable) and download-percentage-complete status updates
during download.
/NoDebug – No Debug Terminal opens after downloading (even if code contains DEBUGs) and COM port is
immediately closed after downloading. This option requires /Download switch. Note: This switch will
have no effect if Debug Terminal is already open from a previous operation.
/NoPrompts – No screen prompts at all (except for Debug Terminal). This option requires /Download switch.
/Pipe master_file – Start up master_file (must be .exe) and establish bi-directional communication pipes for master-
program-controlled execution. Stampw.exe remains open until master_file breaks pipe. This
command option is not available once double-piped communication is established.
/Help – Display command-line help. This command option is not available if double-piped communication is
established.
Note: If redirection to an output file is used with syntax #1, GUI prompts still appear and their text is copied to output_file
where applicable.
The Stampw.exe program is a Win32 application that can be run through any normal method. It has special features
available by passing it command-line options (switches) shown above. While this program can be run from a command-
prompt on a Window system, it will not work on a DOS-only system.
The Stampw.exe supports redirection of its input and output via the standard pipe mechanisms. If its output is redirected
via the command-line (ex: Stampw.exe myfile.bs2 > Test1.txt) the designated output file, Test1.txt in this case, will be
created and various information about the processing of its object file will be stored there. This information directly
reflects the information available on the GUI prompts, interactions with the user and downloading status. This feature can
be combined with the /NoDebug and /NoPrompts switches for various levels of GUI interaction with the user.
When the Stamp Editor is started with this option, after it creates the pipes and starts the master_file program, it then sits
quietly in the background waiting for commands from the master_file program. The available commands are exactly the
same as the normal command-line switches (with the exception that the /PIPE and /HELP switches are no longer
available).
Example #1:
If your master program is called Master.exe and you’d like it to make the Stamp Editor program tokenize the source file
called C:\Temp\MySource.bs2, do the following:
Example #2:
If you’d like the Stamp Editor program to download the same source file:
Note #1: When used with the /PIPE switch, the Stampw.exe program will remain running (in the background) even after
successfully downloading (or performing any other command) and will await your next command, as if it was just started.
There are two exceptions to this: 1) A Fatal Error occurs; such as those caused by issuing invalid command-line switches,
or 2) the Master.exe program breaks its STDOUT pipe (by closing the STDOUT handle or simply terminating itself). See
the Stamp Editor Messages for more information.
Note #2: The Stampw.exe program responds via the master program’s STDIN using predefined messages. The
messages and their formats are shown in the Stamp Editor Messages section, below.
A Delphi program and source code is available (called EditorMaster) that does this. This program should be located in the
C:\Program Files\Parallax Inc\Stamp Editor\Developer\EditorMaster. Even if you’re not familiar with Delphi, reading the
source code of the EditorMaster program can be helpful. There are only a few Windows API calls that are necessary to
accomplish this since the Stamp Editor takes care of all the complicated issues.
For example, an Error-type message may appear as: ERR:001-Invalid command-line switch: switch_name
Note: The “ ” is the SOH character (ASCII 1) that appears at the start of every message.
This format works well for both computers and humans. The Message Type (ERR:, EVT: or INF:), Message ID (nnn-) and
Message Text is easily readable by humans when seen in a redirected output file. The Start Of Header is always the first
character of each new message, and the Message Type and ID can be easily parsed by most programming languages.
In addition, each of these fields begins at a specific character location in every message.
The Stamp Editor also sends the Final message with an EOT (End of Transmit, ASCII 4) character at the end of the
Message Text portion. Either the Message ID or the EOT character can be used to determine if there are more
messages to come.
ERROR MESSAGES
FATAL ERRORS (failures that cause termination of Stamp Editor program, even when double-piped)
001 - Invalid command-line switch: 'SWITCH'
002 - Duplicate or Conflicting command-line switch: 'SWITCH'. This switch either: 1) appears more than once, or
2) is not allowed in combination with the switches appearing before it
003 - SWITCH switch not allowed while in Inter-Process Communication Pipe Mode.
004 - Duplicate command-line option: 'SWITCH'. Only one input filename (object_file or master_file) is allowed.
005 - Missing parameter required. REQUIREMENTS.
006 - Cannot create In-Pipe or Out-Pipe.
007 - Cannot create child process.
008-050 - (reserved)
SERIOUS ERRORS (failures that don't cause termination of Stamp Editor program (when double-piped))
~~~file related errors~~~
051 - File not found: 'FILENAME'.
052-100 - (reserved)
~~~tokenizer related errors~~~
Note: Errors 101 – 250 are in the format: PROGRAM=#:NAME START=R:C(CH) LENGTH=#
STATUS=ERRORMESSAGE ;where R = row number, C = column number, CH = character number and
ERRORMESSAGE is the text of the message, indicated below.
101 - Expected character(s)
102 - Expected terminating “
103 - Unrecognized character
104 - Expected hex digit
105 - Expected binary digit
106 - Symbol exceeds 32 characters
107 - Too many elements
108 - Constant exceeds 16 digits
109 - Constant exceeds 16 bits
110 - Undefined symbol
111 - Undefined label
112 - Expected a constant
113 - Cannot divide by 0
114 - Location is out of range
115 - Location already contains data
116 - Expected '?'
117 - Label is already defined
118 - Expected ‘\’
119 - Expected '('
120 - Expected ')’
121 - Expected '['
122 - Expected ']'
123 - Symbol is already defined
124 - Data occupies same location as program
125 - Array size cannot be 0
126 - Out of variable space
127 - EEPROM full
128 - Symbol table full
129 - Expected ':'or end-of-line
130 - Expected ',', end-of-line, or ':'
131 - Expected 'STEP', end-of-line, or ':’
132 - 'NEXT' must be preceded by 'FOR'
133 - Expected ','