You are here: PBASIC Language Reference > Commands (By Category)

PBASIC Command Reference

For all BASIC Stamp models

(Categorical Listing)

 

 

2 Note: For BS1/BS2-compatible commands, syntax shown below is in BS2 format. Some commands may use slightly different formatting with the BS1.
2.5 Note: Requires {$PBASIC 2.5} directive.
Note: Compound, multi-line command; syntax not shown.
Note: Command is accepted by the 24-pin BS2p, BS2pe, and BS2px, but only the 40-pin BS2p40 gives access to the auxiliary I/O pins.

 

BRANCHING / PROGRAM CONTROL
  GOTO   GOTO Address
  IF…THEN   IF Condition THEN Address
  BRANCH 2   BRANCH Offset, [Address1, Address2, ...AddressN]
  ON...GOTO 2.5   ON expression GOTO Address1, Address2, ...AddressN
  GOSUB   GOSUB Address
  ON...GOSUB 2.5   ON expression GOSUB Address1, Address2, ...AddressN
  RETURN   RETURN
  RUN   RUN ProgramSlot
  POLLRUN   POLLRUN ProgramSlot
  IF…THEN…ELSE2.5, †    
  SELECT...CASE 2.5, †    
  STOP   STOP
 
LOOPING
  DO…LOOP 2.5   DO {WHILE | UNTIL Condition(s) } ... LOOP {UNTIL | WHILE Condition(s) }
  FOR…NEXT   FOR Counter = StartValue TO EndValue {STEP StepValue} ... NEXT
  EXIT 2.5   EXIT
 
EEPROM ACCESS
  EEPROM   EEPROM {Location,} (DataItem {, DataItem, ...})
  DATA   {Symbol } DATA DataItem {, DataItem, ...}
  READ   READ Location, {Word 2.5} Variable {, ...} 2.5
  WRITE   WRITE Location, {Word 2.5} Value {, ...} 2.5
  STORE   STORE ProgramSlot
 
RAM ACCESS
  GET   GET Location, {Word 2.5} Variable {, ...} 2.5
  PUT   PUT Location, {Word 2.5} Variable {, ...} 2.5
 
NUMERICS
  LOOKUP 2   LOOKUP Index, [Value0, Value1, ...ValueN], Variable
  LOOKDOWN 2   LOOKDOWN Target, {ComparisonOp } [Value0, Value1, ...ValueN], Variable
  RANDOM   RANDOM Variable
 
DIGITAL I/O
  CONFIGPIN   CONFIGPIN Mode, PinMask
  INPUT   INPUT Pin
  OUTPUT   OUTPUT Pin
  REVERSE   REVERSE Pin
  LOW   LOW Pin
  HIGH   HIGH Pin
  TOGGLE   TOGGLE Pin
  PULSIN   PULSIN Pin, State, Variable
  PULSOUT   PULSOUT Pin, Duration
  BUTTON   BUTTON Pin, DownState, Delay, Rate, Workspace, TargetState, Address
  COUNT   COUNT Pin, Duration, Variable
  XOUT   XOUT Mpin, Zpin, [House\Command {\Cycles} {, House\Command {\Cycles}...}]
  AUXIO   AUXIO
  MAINIO   MAINIO
  IOTERM   IOTERM Port
  POLLIN   POLLIN Pin, State
  POLLOUT   POLLOUT Pin, State
  POLLMODE   POLLMODE Mode
 
ASYNCHRONOUS I/0
  SERIN 2   SERIN Rpin {\Fpin}, Baudmode, {Plabel,} {Timeout, Tlabel, } [InputData]
  SEROUT 2   SEROUT Tpin {\Fpin}, Baudmode, {Pace,} {Timeout, Tlabel,} [OutputData]
  OWIN   OWIN Pin, Mode, [InputData]
  OWOUT   OWOUT Pin, Mode, [OutputData]
 
SYNCHRONOUS SERIAL I/O
  SHIFTIN   SHIFTIN Dpin, Cpin, Mode, [Variable{\Bits} {, Variable{\Bits}...}]
  SHIFTOUT   SHIFTOUT Dpin, Cpin, Mode, [OutputData{\Bits} {, OutputData{\Bits}...}]
  I2CIN   I2CIN Pin, SlaveID, {Address{\LowAddress },} [InputData]
  I2COUT   I2COUT Pin, SlaveID, {Address{\LowAddress},} [OutputData]
 
PARALLEL I/O
  LCDCMD   LCDCMD Pin, Command
  LCDIN   LCDIN Pin, Command, [InputData]
  LCDOUT   LCDOUT Pin, Command, [OutputData]
 
ANALOG I/O
  COMPARE   COMPARE Mode, Result
  POT   POT Pin, Scale, Variable
  PWM   PWM Pin, Duty, Duration
  RCTIME   RCTIME Pin, State, Variable
 
TIME
  PAUSE   PAUSE Duration
  POLLWAIT   POLLWAIT Duration
 
SOUND
  SOUND   SOUND Pin, (Note, Duration {, Note, Duration...})
  FREQOUT   FREQOUT Pin, Duration, Freq1 {, Freq2 }
  DTMFOUT   DTMFOUT Pin, {OnTime, OffTime, } [Tone {, Tone, ...}]
 
POWER CONTROL
  NAP   NAP Duration
  SLEEP   SLEEP Duration
  END   END
 
PROGRAM DEBUGGING
  DEBUG   DEBUG OutputData {, OutputData}
  DEBUGIN2.5   DEBUGIN InputData

 

Go to Welcome page

BASIC Stamp Help Version 2.5.4

Copyright © Parallax Inc.

8/8/2012