Parallax SX-Key User guide

Chipsmall Limited consists of a professional team with an average of over 10 year of expertise in the distribution
of electronic components. Based in Hongkong, we have already established firm and mutual-benefit business
relationships with customers from,Europe,America and south Asia,supplying obsolete and hard-to-find components
to meet their specific needs.
With the principle of “Quality Parts,Customers Priority,Honest Operation,and Considerate Service”,our business
mainly focus on the distribution of electronic components. Line cards we deal with include
Microchip,ALPS,ROHM,Xilinx,Pulse,ON,Everlight and Freescale. Main products comprise
IC,Modules,Potentiometer,IC Socket,Relay,Connector.Our parts cover such applications as commercial,industrial,
and automotives areas.
We are looking forward to setting up business relationship with you and hope to provide you with the best service
and solution. Let us make a better world for our industry!
Contact us
Tel: +86-755-8981 8866 Fax: +86-755-8427 6832
Email & Skype: [email protected]om Web: www.chipsmall.com
Address: A1208, Overseas Decoration Building, #122 Zhenhua RD., Futian, Shenzhen, China


WARRANTY
Parallax warrants its products against defects in materials and workmanship for a period of 90 days from receipt of product. If
you discover a defect, Parallax will, at its option, repair or replace the merchandise, or refund the purchase price. Before
returning the product to Parallax, call for a Return Merchandise Authorization (RMA) number. Write the RMA number on the
outside of the box used to return the merchandise to Parallax. Please enclose the following along with the returned merchandise:
your name, telephone number, shipping address, and a description of the problem. Parallax will return your product or its
replacement using the same shipping method used to ship the product to Parallax.
14-DAY MONEY BACK GUARANTEE
If, within 14 days of having received your product, you find that it does not suit your needs, you may return it for a full refund.
Parallax will refund the purchase price of the product, excluding shipping/handling costs. This guarantee is void if the product
has been altered or damaged. See the Warranty section above for instructions on returning a product to Parallax.
COPYRIGHTS AND TRADEMARKS
This documentation is Copyright 2003 by Parallax, Inc. By downloading or obtaining a printed copy of this documentation or
software you agree that it is to be used exclusively with Parallax products. Any other uses are not permitted and may represent a
violation of Parallax copyrights, legally punishable according to Federal copyright or intellectual property laws. Any duplication
of this documentation for commercial uses is expressly prohibited by Parallax, Inc. Check with Parallax for approval prior to
duplicating any of our documentation in part or whole for any use.
SX-Key is a registered trademark of Parallax, Inc. If you decide to use the name SX-Key on your web page or in printed material,
you must state that "SX-Key is a registered trademark of Parallax, Inc." Other brand and product names are trademarks or
registered trademarks of their respective holders
ISBN 1-928982-01-8
DISCLAIMER OF LIABILITY
Parallax, Inc. is not responsible for special, incidental, or consequential damages resulting from any breach of warranty, or under
any legal theory, including lost profits, downtime, goodwill, damage to or replacement of equipment or property, or any costs of
recovering, reprogramming, or reproducing any data stored in or used with Parallax products. Parallax is also not responsible for
any personal damage, including that to life and health, resulting from use of any of our products. You take full responsibility for
your SX-Key/Blitz and SX chip application, no matter how life-threatening it may be.

WEB SITE AND DISCUSSION LISTS
The Parallax web site (www.parallax.com) has many downloads, products, customer applications and on-line ordering for the
components used in this text. We also maintain several e-mail discussion lists for people interested in using Parallax products.
These lists are accessible from www.parallax.com via the Support ?Discussion Groups menu. These are the lists that we operate:
§SX Tech –Discussion of programming the SX microcontroller with Parallax assembly language tools and 3
rd party
BASIC and C compilers. Approximately 600 members.
§BASIC Stamps –With over 2,500 subscribers, this list is widely utilized by engineers, hobbyists and students who share
their BASIC Stamp projects and ask questions.
§Stamps in Class –Created for educators and students, this list has 500 subscribers who discuss the use of the Stamps in
Class curriculum in their courses. The list provides an opportunity for both students and educators to ask questions and
get answers.
§Parallax Educators –This focus group of 100 members consists exclusively of educators and those who contribute to the
development of Stamps in Class. Parallax created this group to obtain feedback on our curricula and to provide a forum
for educators to develop Teacher’s Guides.
§Parallax Translators –Consisting of less than 10 people, the purpose of this list is to provide a conduit between Parallax
and those who translate our documentation to languages other than English. Parallax provides editable Word
documents to our translating partners and attempts to time the translations to coordinate with our publications.
§Toddler Robot –A customer created this discussion list to discuss applications and programming of the Parallax
Toddler robot.
§Javelin Stamp –Discussion of application and design using the Javelin Stamp, a Parallax module that is programmed
using a subset of Sun Microsystems’ Java® programming language. Approximately 250 members.
This manual is valid with the following software and firmware versions:
IDE:
SXKey.exe software version 2.0
Firmware:
SX-Key rev. F and SX-Blitz rev. A
The information herein will usually apply to newer versions but may not apply to older versions. New software can be obtained
free on our web site (www.parallax.com). If you have any questions about what you need to upgrade your product, please contact
Parallax.

Welcome
Thank you for purchasing the Parallax SX-Key/Blitz development system. We have done our best to
produce a full-featured, yet easy to use development system for the SX microcontrollers. The result is
the SX-Key and the SX-Blitz; very tiny, full-featured development tools with a Windows95 and higher
versions interface. We hope you will find this system as enjoyable to use as we do.
This manual is written for the SX20/28 chips with a date code of AB9921AA or later, and SX48/52 chips
with a date code of AB0001A or later.
Older chips are not supported by this manual or the SX-Key development system.

Table of Contents
SX-Key/Blitz Development System Manual 2.0 •Parallax, Inc. •Page 5
Table of Contents
1Introduction to the SX-Key/Blitz Hardware ................................................................................................................13
2Installing the SX-Key/Blitz Software.............................................................................................................................15
3Quick Start Introduction..................................................................................................................................................17
3.1 Connecting and Downloading to the SX Tech Board .......................................................................................17
4The SX-Key/Blitz Interface .............................................................................................................................................19
4.1 Starting the SX-Key/Blitz Software ....................................................................................................................19
4.1.1 Command Line Switches......................................................................................................................19
4.2 The SX Editor .........................................................................................................................................................20
4.3 The Menus..............................................................................................................................................................21
4.3.1 The File Menu ........................................................................................................................................21
4.3.2 The Edit Menu........................................................................................................................................22
4.3.3 The Run Menu........................................................................................................................................23
4.3.4 The Help Menu ......................................................................................................................................25
4.4 The Windows.........................................................................................................................................................25
4.4.1 Print Window.........................................................................................................................................25
4.4.2 Find Window .........................................................................................................................................26
4.4.3 Find/Replace Window .........................................................................................................................26
4.4.4 Goto Line Number Window ................................................................................................................27
4.4.5 Configure Window................................................................................................................................28
5The SX-Key Debugger......................................................................................................................................................31
5.1 The Debugger Windows.......................................................................................................................................31
5.1.1 The Registers Window..........................................................................................................................31
5.1.2 The Debug Window ..............................................................................................................................34
5.1.3 The Watch Window...............................................................................................................................35
5.1.4 The Code/List File Window ................................................................................................................35
5.1.5 Modifying registers during debugging ..............................................................................................36
5.1.6 Breakpoints and the Current Instruction............................................................................................37
5.1.7 Setting the Program Counter ...............................................................................................................37
6The Device Window.........................................................................................................................................................39
7The SASM Assembler ......................................................................................................................................................43
7.1 The Structure of an SX Assembly Program........................................................................................................44
7.2 Comments ..............................................................................................................................................................45
7.3 Assembler Directives ............................................................................................................................................45
7.3.1 The EQU and = Directives....................................................................................................................47
7.3.2 The BREAK Directive............................................................................................................................47
7.3.3 The CASE and NOCASE Directives....................................................................................................47
7.3.4 The DEVICE Directive ..........................................................................................................................48
7.3.5 The DS Directive ....................................................................................................................................51
7.3.6 The DW Directive ..................................................................................................................................51
7.3.7 The END Directive ................................................................................................................................51
7.3.8 The ERROR Directive............................................................................................................................52
7.3.9 The FREQ Directive...............................................................................................................................52
7.3.10 The __FUSE and __FUSEX Directives.................................................................................................52

Table of Contents
Page 6•SX-Key/Blitz Development System Manual 2.0 •Parallax, Inc.
7.3.11 The ID Directive.....................................................................................................................................53
7.3.12 The IF…ELSE…ENDIF Directive ........................................................................................................53
7.3.13 The IF{N}DEF…ELSE…ENDIF Directives.........................................................................................54
7.3.14 The INCLUDE Directive.......................................................................................................................55
7.3.15 The IRC_CAL Directive ........................................................................................................................56
7.3.16 The LIST Directive.................................................................................................................................56
7.3.17 The LPAGE Directive............................................................................................................................57
7.3.18 The ORG (Origin) Directive .................................................................................................................57
7.3.19 The RADIX Directive ............................................................................................................................58
7.3.20 The REPT Directive ...............................................................................................................................58
7.3.21 The RESET Directive .............................................................................................................................59
7.3.22 The SPAC Directive...............................................................................................................................59
7.3.23 The TITLE and STITLE Directives.......................................................................................................60
7.3.24 The WATCH Directive..........................................................................................................................60
7.4 Macros.....................................................................................................................................................................62
7.4.1 The MACRO Directive..........................................................................................................................62
7.4.2 The ENDM Directive.............................................................................................................................63
7.4.3 The EXITM Directive.............................................................................................................................63
7.4.4 The LOCAL Directive ...........................................................................................................................63
7.4.5 The EXPAND and NOEXPAND Directives.......................................................................................63
7.4.6 Formal Parameters.................................................................................................................................64
7.4.7 Macro Invocation...................................................................................................................................65
7.4.8 Actual Values of Parameters ................................................................................................................65
7.4.9Token Pasting.........................................................................................................................................65
7.4.10 Quoting ...................................................................................................................................................65
7.4.11 Macro Examples.....................................................................................................................................66
7.4.11.1 Simple Macros with no Parameters.....................................................................................66
7.4.12 Macros with Formal Parameters by Count ........................................................................................67
7.4.13 Macros with Formal Parameters by Name.........................................................................................68
7.5 Symbols...................................................................................................................................................................68
7.6 Labels ......................................................................................................................................................................69
7.7 Expressions.............................................................................................................................................................70
7.8 Data Types..............................................................................................................................................................72
7.9 The __SASM Pre-Defined Constant ....................................................................................................................72
7.10 Files created by SASM ..........................................................................................................................................73
7.11 SASM Warning and Error Messages...................................................................................................................74
7.12 Reserved Words and Symbols.............................................................................................................................78
8The Parallax Assembler ...................................................................................................................................................79
8.1 The Structure of an SX Assembly Program........................................................................................................79
8.2 Assembler Directives ............................................................................................................................................79
8.2.1 The Device Directive .............................................................................................................................79
8.3 Symbols...................................................................................................................................................................81
8.4 Labels ......................................................................................................................................................................81
8.5 Expressions.............................................................................................................................................................81
8.6 Error Messages.......................................................................................................................................................81

Table of Contents
SX-Key/Blitz Development System Manual 2.0 •Parallax, Inc. •Page 7
8.7 Data Types..............................................................................................................................................................83
8.8 Reserved Words and Symbols.............................................................................................................................84
9Upgrading Existing Code for SASM..............................................................................................................................85
10 SX Special Features and Coding Tips ............................................................................................................................87
10.1 Introduction ...........................................................................................................................................................87
10.2 Port Configuration and Usage.............................................................................................................................87
10.2.1 Port Direction .........................................................................................................................................88
10.2.2 Pull-Up Resistors ...................................................................................................................................89
10.2.3 Logic Level..............................................................................................................................................90
10.2.4 Schmitt-Trigger ......................................................................................................................................91
10.2.5 Edge Detection .......................................................................................................................................92
10.2.6 Wakeup (Interrupt) on Edge Detection ..............................................................................................93
10.2.7 Comparator ............................................................................................................................................95
10.3 The SX48/52 Multi-Function Timers ..................................................................................................................96
10.3.1 PWM Mode ............................................................................................................................................97
10.3.2 Software Timer Mode............................................................................................................................98
10.3.3 External Event Counter.........................................................................................................................98
10.3.4 Capture/Compare Mode......................................................................................................................98
10.4 All About Interrupts .............................................................................................................................................99
10.4.1 RTCC Rollover Interrupts...................................................................................................................100
10.5 Creating Tables ....................................................................................................................................................103
10.5.1 Data Tables ...........................................................................................................................................103
10.6 Dealing with Code Pages ...................................................................................................................................105
10.6.1 Branching Across Pages......................................................................................................................105
10.6.2 Calling Across Pages with Jump Tables ...........................................................................................106
11 Appendix A: SX Features ..............................................................................................................................................109
11.1 Introduction .........................................................................................................................................................109
11.2 CPU Features .......................................................................................................................................................109
11.3 Peripheral and I/O Features..............................................................................................................................109
12 Appendix B: Instruction Set Overview........................................................................................................................111
12.1 Introduction .........................................................................................................................................................111
12.2 Instruction Set Summary....................................................................................................................................111
12.3 Single Word Instructions....................................................................................................................................114
12.4 Multi-Word Instructions.....................................................................................................................................116
12.5 Instruction Set Quick Reference ........................................................................................................................118
13 Appendix C: SX Instruction Set ....................................................................................................................................121
13.1 Introduction .........................................................................................................................................................121
14 Appendix D: The SX Tech Board..................................................................................................................................145
14.1 SX Tech Board Features ......................................................................................................................................145
14.2 Connecting and Downloading...........................................................................................................................146
14.3 SX Tech Board Schematic ...................................................................................................................................147
15 Appendix E: SX Data Sheet ...........................................................................................................................................149
15.1 Pinout Information and Descriptions ...............................................................................................................149
15.2 Architecture..........................................................................................................................................................150
15.2.1 Instruction Pipeline .............................................................................................................................151

Table of Contents
Page 8•SX-Key/Blitz Development System Manual 2.0 •Parallax, Inc.
15.2.2 Read-Modify-Write Considerations..................................................................................................151
15.2.3 Register Map Structure .......................................................................................................................151
15.2.4 Special Function Registers..................................................................................................................153
15.2.5 IND –The Indirect Register ($00)......................................................................................................153
15.2.6 Real Time Clock/Counter, WREG ($01)...........................................................................................153
15.2.7 PC –Program Counter ($02) ..............................................................................................................153
15.2.8 STATUS Register ($03)........................................................................................................................154
15.2.9 The FSR –File Select Register ($04) ...................................................................................................155
15.2.10 Direct Addressing................................................................................................................................156
15.2.11 Indirect Addressing.............................................................................................................................160
15.2.12 The Bank Instruction ...........................................................................................................................161
15.2.13 The Jump Instruction ..........................................................................................................................162
15.2.14 Jumping Across Pages.........................................................................................................................163
15.2.15 The Call Instruction.............................................................................................................................163
15.2.16 Calling Across Pages...........................................................................................................................164
15.2.17 Returning from a subroutine..............................................................................................................164
15.2.18 The Stack...............................................................................................................................................165
15.2.19 The Push ...............................................................................................................................................165
15.2.20 The Pop .................................................................................................................................................166
15.2.21 Stack Overflow.....................................................................................................................................166
15.2.22 Stack Underflow ..................................................................................................................................166
15.2.23 Returns..................................................................................................................................................166
15.3 Port Configuration Registers .............................................................................................................................167
15.3.1 Port A Registers ...................................................................................................................................167
15.3.1.1 TRIS_A –Data Direction Register......................................................................................167
15.3.1.2 LVL_A -TTL/CMOS Select Register ................................................................................167
15.3.1.3 PLP_A –Pull-Up Resistor Enable Register.......................................................................167
15.3.2 Port B Registers....................................................................................................................................168
15.3.2.1 TRIS_B –Data Direction Register ......................................................................................168
15.3.2.2 LVL_B -TTL/CMOS Select Register.................................................................................168
15.3.2.3 PLP_B –Pull-Up Resistor Enable Register .......................................................................168
15.3.2.4 ST_B –Schmitt-Trigger Enable Register ...........................................................................169
15.3.2.5 WKEN_B –Wake Up Enable Register...............................................................................169
15.3.2.6 WKED_B –Wake Up Edge Select Register.......................................................................169
15.3.2.7 WKPND_B –MIWU Pending Register .............................................................................169
15.3.2.8 CMP_B –Comparator Enable Register .............................................................................170
15.3.3 Port C Registers....................................................................................................................................170
15.3.3.1 TRIS_C –Data Direction Register......................................................................................170
15.3.3.2 LVL_C -TTL/CMOS Select Register.................................................................................170
15.3.3.3 PLP_C –Pull-Up Resistor Enable Register.......................................................................171
15.3.3.4 ST_C –Schmitt-Trigger Enable Register...........................................................................171
15.3.4 Port D and E Registers (SX48/52)......................................................................................................171
15.4 Control registers ..................................................................................................................................................171
15.4.1 Mode register (SX20/28).....................................................................................................................171
15.4.2 Mode register (SX48/52).....................................................................................................................173

Table of Contents
SX-Key/Blitz Development System Manual 2.0 •Parallax, Inc. •Page 9
15.4.3 Option ...................................................................................................................................................174
15.4.4 Fuse Registers.......................................................................................................................................174
15.5 Interrupts..............................................................................................................................................................175
15.5.1 Description ...........................................................................................................................................175
15.5.2 The Specifics .........................................................................................................................................175
15.5.3 RTCC Interrupt ....................................................................................................................................175
15.5.4 RB0-RB7 Interrupt ...............................................................................................................................176
15.6 Peripherals............................................................................................................................................................176
15.6.1 Oscillator Driver ..................................................................................................................................176
15.6.1.1 LP, XT and HS Mode...........................................................................................................176
15.6.1.2 External RC Mode................................................................................................................178
15.6.1.3 Internal RC Mode.................................................................................................................179
16 Index ................................................................................................................................................................................181

Table of Contents
Page 10 •SX-Key/Blitz Development System Manual 2.0 •Parallax, Inc.
Figures
Figure 1 -Connecting the SX-Key/Blitz................................................................................................................................ 13
Figure 2 -First Time Running Window................................................................................................................................. 16
Figure 3 -Configure Window................................................................................................................................................. 16
Figure 4 -SX Tech Board with SX chip inserted................................................................................................................... 17
Figure 5 -The SX-Key Icon...................................................................................................................................................... 19
Figure 6 -The SX Editor........................................................................................................................................................... 20
Figure 7 -The Find Window................................................................................................................................................... 26
Figure 8 -The Find/Replace Window................................................................................................................................... 26
Figure 9 -The Goto Line Number Window.......................................................................................................................... 27
Figure 10 -The Configure Window ....................................................................................................................................... 28
Figure 11 -The Debugger Windows ...................................................................................................................................... 33
Figure 12 -The Device Window ............................................................................................................................................. 39
Figure 13 -The Watch Window.............................................................................................................................................. 61
Figure 14 -TTL and CMOS Levels ......................................................................................................................................... 90
Figure 15 -Schmitt Trigger Characteristics........................................................................................................................... 91
Figure 16 -SX48/52 Multi-Function Timers ......................................................................................................................... 97
Figure 17 -The SX Tech Board.............................................................................................................................................. 145
Figure 18 -SX Tech Board Schematic................................................................................................................................... 147
Figure 19 -SX Pinouts............................................................................................................................................................ 149
Figure 20 -Instruction Pipeline ............................................................................................................................................ 151
Figure 21 -SX20/28 Register Map........................................................................................................................................ 152
Figure 22 -SX48/52 Register Map........................................................................................................................................ 152
Figure 23 -Rotate Right ......................................................................................................................................................... 155
Figure 24 -Rotate Left............................................................................................................................................................ 155
Figure 25 -Global Register Addressing SX20/28/48/52 (direct) .................................................................................... 156
Figure 26 -SX20/28 General Purpose Register Addressing (direct) ............................................................................... 157
Figure 27 -SX48/52 General-Purpose Register addressing (direct) ................................................................................ 158
Figure 28-SX20/28 Indirect register addressing................................................................................................................ 160
Figure 29 -SX48/52 Indirect register addressing............................................................................................................... 161
Figure 30 -The Jump Instruction.......................................................................................................................................... 162
Figure 31 -Jumping Across Pages........................................................................................................................................ 163
Figure 32 -The Call Instruction ............................................................................................................................................ 164
Figure 33 -Calling Across Pages .......................................................................................................................................... 164
Figure 34 -The Push............................................................................................................................................................... 165
Figure 35 -The Pop ................................................................................................................................................................ 166
Figure 36 -Prescaler Division Ratios ................................................................................................................................... 174
Figure 37 -SX with External Crystal.................................................................................................................................... 176
Figure 38 -SX with External Ceramic Resonator ............................................................................................................... 177
Figure 39 -SX with External System Clock ......................................................................................................................... 178
Figure 40 -External RC Mode............................................................................................................................................... 178

Table of Contents
SX-Key/Blitz Development System Manual 2.0 •Parallax, Inc. •Page 11
Tables
Table 1 -Editor Shortcut Keys ................................................................................................................................................ 21
Table 2 -Debugger Buttons and Shortcut Keys.................................................................................................................... 35
Table 3 –Register Editing Keys .............................................................................................................................................. 36
Table 4 -SX Clock Options...................................................................................................................................................... 40
Table 5 -SASM Directives ....................................................................................................................................................... 46
Table 6 -SX20/28 DEVICE Settings....................................................................................................................................... 49
Table 7 -SX48/52 DEVICE Settings....................................................................................................................................... 50
Table 8 –Comparison Operators........................................................................................................................................... 53
Table 9 -LIST Directive Options ............................................................................................................................................ 57
Table 10 -WATCH Display Formats ..................................................................................................................................... 60
Table 11 -Unary Operators..................................................................................................................................................... 71
Table 12 -Binary Operators .................................................................................................................................................... 71
Table 13 -Data Types............................................................................................................................................................... 72
Table 14 -SASM Error and Warning Messages.................................................................................................................... 75
Table 15 -SASM Reserved Words.......................................................................................................................................... 78
Table 16 -Parallax Assembler DEVICE Options.................................................................................................................. 80
Table 17 -Parallax Assembler Error Messages..................................................................................................................... 81
Table 18 -Parallax Assembler Reserved Words................................................................................................................... 84
Table 19 -Port Configuration Options................................................................................................................................... 87
Table 20 -MODE Register Settings ........................................................................................................................................ 88
Table 21 -Interrupt Timing................................................................................................................................................... 102
Table 22 -SX Instruction Mnemonics .................................................................................................................................. 112
Table 23 -SX Single-Word Instructions ............................................................................................................................... 114
Table 24 -SX Multi-Word Instructions ................................................................................................................................ 116
Table 25 -SX Instruction Set Quick Reference.................................................................................................................... 118
Table 26 -Symbol and Value Operands .............................................................................................................................. 121
Table 27 -Flags and Registers............................................................................................................................................... 122
Table 28 -Binary Symbols ..................................................................................................................................................... 122
Table 29 -SX Pins ................................................................................................................................................................... 150
Table 30 -Special Function Registers................................................................................................................................... 153
Table 31 -Bank Addresses and FSR Values........................................................................................................................ 159
Table 32 –SX20/28 Mode Register....................................................................................................................................... 172
Table 33 -SX48/52 Mode Register ....................................................................................................................................... 173
Table 34 –External Component Selection for Crystals (Vdd = 5V) ................................................................................. 177
Table 35 -Component Selection for Murata Ceramic Resonators (Vdd = 5.0 V) ........................................................... 177

Table of Contents
Page 12 •SX-Key/Blitz Development System Manual 2.0 •Parallax, Inc.

1 Introduction the SX-Key/Blitz Hardware
SX-Key/Blitz Development System Manual 2.0 •Parallax, Inc. •Page 13
1Introduction to the SX-Key/Blitz Hardware
The SX-Key/Blitz hardware consists of the programmer unit, a four-pin programming interface and a
standard, female serial port connector (DB9). The serial port connector should be plugged into an
available standard, straight-through serial cable on an IBM-compatible PC. The four-pin connector on
the SX-Key/Blitz board should be connected to four pins (VSS, VDD, OSC2 and OSC1) of the SX chip.
Take care to connect it in the right orientation because this connector is not indexed.
Figure 1-Connecting the SX-Key/Blitz
The SX-Key/Blitz is powered by the target circuit’s power supply and programming and debugging
takes place over the oscillator pins. The power supply to the SX-Key/Blitz must be +5 V DC. If an
external crystal, resonator or RC circuit is used, the SX-Key/Blitz can usually remain connected to the
SX chip for programming purposes, without affecting the operation of the circuit. When debugging, the
SX chip must not have an external clock source since the SX-Key’s internal programmable oscillator
must be used. The SX-Blitz can only program SX chips, it cannot debug them.
Each SX microcontroller contains the necessary debugger hooks required to perform SX in-circuit
debugging. No other supporting chips are necessary for the debugging process. During debugging, the
SX-Key provides the oscillator signal to drive the SX microcontroller until such time that a breakpoint is
hit or a single step or stop mode is initiated.
Figure 1-Connecting the SX-Key/Blitz shows all the connections necessary to program, debug and run
the SX microcontroller. An external resonator or crystal should be connected to the OSC1 and OSC2
pins to run the SX if the SX-Blitz is used, or if the SX-Key’s internal clock oscillator is not used.
4-pin programming
interface
SX-Key or SX-Blitz
programmer device
DB9 serial port
connector
O
S
C
1
O
S
C
2
V
D
D
V
S
S
R
e
v
F
S
X
-
K
e
y
1
2
4
3
21
5
6
8
7
9 20
26
25
23
24
22
27
28
RC7
OSC2
OSC1
MCLR
RC3
RC4
RC5
RC6
VSS
n.c.
VDD
RTCC
RA2
RA1
RA0
n.c.
RC2RA3
16
10
11
13
12
14
15
18
19
17
RB6
RB7
RC0
RC1
RB3
RB2
RB1
RB0
RB5RB4
SX-28
+5+5
Vss

1 Introduction the SX-Key/Blitz Hardware
Page 14 •SX-Key/Blitz Development System Manual 2.0 •Parallax, Inc.
The SX-Blitz is designed to be a lower-cost device for programming the SX chips only (no debugging
features are available). The SX-Blitz and SX-Key use the same interface software for programming,
however, debugging features will not work with the SX-Blitz.
NOTE: Since the SX-Blitz and SX-Key function almost identically, they will be referred to as the SX-
Key/Blitz, except where there are distinct differences.

2 Installing the SX-Key/Blitz Software
SX-Key/Blitz Development System Manual 2.0 •Parallax, Inc. •Page 15
2Installing the SX-Key/Blitz Software
Before following the steps in the next chapter, you should first install the SX-Key/Blitz interface on
your computer’s hard disk.
The SX-Key/Blitz Interface consists of the integrated editor, programmer, and debugger software. The
following system requirements are a minimum for using the SX-Key/Blitz Interface:
•80486 (or higher) IBM or compatible PC;
•Windows 95 or higher operating system;
•64 Mb of RAM;
•3 Mb of available hard drive space;
•CD-ROM drive, or access to the Internet;
•1 available serial port.
To install the SX-Key/Blitz Interface:
1. Insert the Parallax CD-ROM in an available CD-ROM drive.
2. Use the CD's automatic browser to navigate to the Software section.
3. Expand the SX-Key & SX-Blitz folder.
4. Select the 18/28/48/52-pin SX chips (SXKey.exe) item.
5. Click on the Install button.
6. When prompted for the type of installation, select “Typical” in order to have the software installed
in the “Programs\Parallax Inc\SX-Key v2.0” folder. Select “Custom” when you want to change the
default installation options, like the installation folder.
7. After the setup has finished, you will find a shortcut on the desktop, and a new “Parallax Inc”
program group in the Start menu.
You may also download the software from the Parallax web site. There are two different file versions
available. One has a size of about 1.2 MB, and the other one of 4.6 MB. When you use the smaller one, it
is necessary to have an Internet connection active while installing the software. Select any folder where
the downloaded file shall be stored, and then run “Setup_SX-Key_Editor.exe” from this folder.
After you have successfully installed the SX-Key Editor and start it the first time, the dialog shown
below opens:

2 Installing the SX-Key/Blitz Software
Page 16 •SX-Key/Blitz Development System Manual 2.0 •Parallax, Inc.
Figure 2-First Time Running Window
This is to remind you that you should review some basic configuration settings first. Click the OK but-
ton, and press Ctrl-U to open the Configuration dialog shown to the right.
The only setting that is important for now is the selection of the serial port to which you have connected
the SX-Key/Blitz.
Figure 3-Configure Window
The configuration dialog allows you to select COM1, COM2, COM3, or COM4.
Click the radio button in the “Serial Port” section that matches your installation.
Make sure that the remaining options are set to the defaults as shown here, and then click “Okay” to
close the configuration dialog window.
You may keep the SX-Key Editor active because you will need it to perform the next steps below.

3 Quick Start Instruction
SX-Key/Blitz Development System Manual 2.0 •Parallax, Inc. •Page 17
3Quick Start Introduction
This chapter is a quick start guide to connecting the SX-Key/Blitz and programming the SX
microcontroller. Without even knowing how the SX-Key/Blitz and the SX chip work, you should be
able to obtain satisfactory results from the steps that follow.
3.1 Connecting and Downloading to the SX Tech Board
In order to get familiar with how the SX-Key/Blitz Development System works, we’ll use the SX Tech
Board to program and run a 28-pin SX chip.
Keep in mind that the SX Tech Board is not a programmer; rather the SX-Key/Blitz is the
programmer/debugger device while the SX Tech board is a type of prototyping board. Follow these
steps to connect and download a program:
Figure 4-SX Tech Board with SX chip inserted
1) Plug an SX28AC/DP into the 28-pin LIF socket on the SX Tech board as shown in Figure 4-SX Tech
Board with SX chip inserted. Make sure it is oriented so that the half-moon notch in the chip faces
away from the “Reset” button.
Power
Jack
Power
Indicator
Reset
Button
SX microcontroller (28-pin DIP) properly
inserted into LIF socket.
4-pin Programming
Header
Resonator
Socket Breadboard
Prototyping
Area

3 Quick Start Instruction
Page 18 •SX-Key/Blitz Development System Manual 2.0 •Parallax, Inc.
2) Connect the SX-Key/Blitz to a serial cable, and the serial cable to the serial (COM) port on the PC
that you have selected in the “Configure” dialog of the SX-Key/Blitz software.
3) Connect the SX-Key/Blitz to the 4-pin programming header with the VSS, VDD, OSC2 and OSC1
indicators lining up with the same indicators on the board Note that the programming header is not
indexed. Therefore, double-check the correct orientation of the SX-Key/Blitz.
4) Insert one end of a 470 ohm resister into the RC7 socket (next to the upper left side of the
breadboard). Insert the other end of the resister into any hole in the breadboard.
5) Insert the shorter leg of an LED into the breadboard hole that is closest (horizontally) to the resister
leg. Insert the other leg of the LED into one of the VDD sockets (next to the top side of the bread-
board).
6) Plug the power supply into the SX Tech board and into an available wall outlet. (The power
indicator should light up).
7) If it is not still active, start the SX-Key Editor now.
8) In the SX-Key Editor window, pull down the File menu and select “Open” (or press Ctrl-O). In the
browser window that appears, select and open the led28.src file. (The led28.src source code should
appear in the SX-Key code window).
9) Pull down the Run menu and select Run (or press Ctrl-R). (The SX-Key software should assemble
the code and begin the programming process).
Congratulations! You have just programmed the SX microcontroller with the SX-Key/Blitz
Development System. The program in the SX microcontroller should start running. The LED should
flash on and off (if wired correctly).
In case you get an error message after you have selected the “Run” option, make sure that you did not
modify the source code text in the editor window. If you did, simply re-load the original text by
opening it again, and then repeat the steps described above.
Should an error message like “SX-Key not found on COMx” appear, check that you have selected the
right serial port for communication with the SX-Key/Blitz, and that the serial cable is correctly
connected to the PC, and to the SX-Key/Blitz on the other end. Also make sure that the SX-Key/Blitz is
correctly placed on the 4-pin programming header, and that the SX Tech board is powered, i.e. the
power indicator LED is active.

4 The SX-Key/Blitz Interface
SX-Key/Blitz Development System Manual 2.0 •Parallax, Inc. •Page 19
4The SX-Key/Blitz Interface
The SX-Key/Blitz interface is an integrated editor, programmer, and debugger. All the functions of the
SX-Key and the SX-Blitz are available through this single software interface.
Throughout the rest of this manual, the SX-Key/Blitz interface will be referred to as the SX editor, or
more simply, the editor.
4.1 Starting the SX-Key/Blitz Software
Figure 5-The SX-Key Icon
During installation, a shortcut was automatically placed on the Windows desktop. Double-click on the
SX-Key icon to launch the SX-Key/Blitz interface. In case, the Icon has been deleted from the desktop,
you can also start the software via the Windows Start button. Navigate to the Parallax Inc. program
group and select “SX-Key v2.0” there.
4. 1. 1 Command Line Switches
It is also possible to start the SX-Keys software together with parameters from a command line, e.g.
using the Windows “Run…” option, or from the DOS command line. The Syntax is:
SxKey /<switch> {/<switch>…} <File name>
When you specify a file name with a “.src” extension, the editor window will open, displaying the
contents of the source code file. When you specify an “.sxh” extension instead, the hex file will be
opened into the device window.
The /r switch is used to open a file in read-only mode, i.e. it can be displayed but not modified in the
editor or in the device window.
For example
SxKey /r test.src
opens the source file named “test”, and displays it in the editor window and
SxKey /r test.sxh
opens the hex file named “test”, and displays the device window. In both examples, the files are opened
read-only, i.e. they cannot be modified.
In addition to the /r switch, the switches /1, /2, /3 and /4 are also defined. They are used to select the
COM port where the SX-Key/Blitz is attached. This will override the setting that has been recently
This manual suits for next models
1
Table of contents
Other Parallax Motherboard manuals