Examples Index

The following programming template, while somewhat verbose, will help programmers new to SX/B and the SX microcontroller to keep things in order so that programs compile and assemble successfully. Parallax suggests that you use this template as is, removing unused sections only after your program is tested and working as desired.

' =========================================================================
'
'   File...... TEMPLATE.SXB
'   Purpose... SX/B Programming Template
'   Author.... 
'   E-mail.... 
'   Started...
'   Updated... 05 JUL 2006
'
' =========================================================================


' -------------------------------------------------------------------------
' Program Description
' -------------------------------------------------------------------------


' -------------------------------------------------------------------------
' Device Settings
' -------------------------------------------------------------------------

DEVICE          SX28, OSC4MHZ, TURBO, STACKX, OPTIONX
FREQ            4_000_000
ID              "SXB 1.50"


' -------------------------------------------------------------------------
' IO Pins
' -------------------------------------------------------------------------


' -------------------------------------------------------------------------
' Constants
' -------------------------------------------------------------------------


' -------------------------------------------------------------------------
' Variables
' -------------------------------------------------------------------------


' -------------------------------------------------------------------------
  INTERRUPT
' -------------------------------------------------------------------------

ISR_Start:
  ' ISR code here

ISR_Exit:
  RETURNINT ' {cycles}                                 


' =========================================================================
  PROGRAM Start
' =========================================================================


' -------------------------------------------------------------------------
' Subroutine Declarations
' -------------------------------------------------------------------------


' -------------------------------------------------------------------------
' Program Code
' -------------------------------------------------------------------------

Start:
  ' initialization code here

Main:
  ' main code here
  GOTO Main


' -------------------------------------------------------------------------
' Subroutine Code
' -------------------------------------------------------------------------


' =========================================================================
' User Data
' =========================================================================

Pgm_ID:
  DATA  "SX/B 1.50 Template", 0