The SX/B (SX BASIC) compiler is a BASIC language compiler for the Parallax SX family (SX20, SX28, SX48) microcontroller (as well as the older Ubicom SX18 and SX52), as was designed to meet two specific goals:

  1. Expedite the task of the professional engineer by creating a simple, yet robust high-level language for the SX microcontroller. This allows SX-based projects to be prototyped and coded quickly.
  2. Assist the student programmer wishing to make the transition from pure high-level programming (i.e., BASIC Stamp®) to low-level programming (SX assembly language).

SX/B is an non-optimizing, inline compiler. What this means is that each BASIC language statement is converted to a block of assembly code in-line at the program location; no attempt is made to remove redundant instructions that would optimize code space. This allows the advanced programmer to modify code as required for specific projects, and -- perhaps more importantly -- provides an opportunity for the student to learn SX assembly language techniques by viewing a 1-for-1 (from BASIC to assembly language) output.


Conventions Used in this Document

In syntax descriptions, curly braces {} are used to indicate optional  items. For example:

  PULSOUT Pin, Duration {, Resolution}

In this case, the parameter for Resolution is optional.


In syntax descriptions, brackets [] indicate that the parameter must be one of the presented items (separated with the pipe | character). For example:

  DEVICE [SX18 | SX20 | SX28 | SX48 | SX52] {, ...}

In this case, the DEVICE directive must indicate SX18, SX20, SX28, SX48, or  SX52 (and may also include other optional  items).


Example code is presented on a blue-tinted background:

Main:
  FOR RB = 0 TO 255
    PAUSEUS 10_000
  NEXT
  END