background image

5: BASIC Stamp Command Reference – INPUT 

BASIC Stamp Programming  Manual 2.0c 

 www.parallaxinc.com 

 

Page 155

 

INPUT 

BS1  BS2  BS2e  BS2sx  BS2p 

INPUT 

Pin

 

 
Function  

Make the specified pin an input. 

• 

Pin 

 

is a variable/constant/expression (0 – 15) that specifies which 

I/O pin to set to input mode.  

Explanation 

There are several ways to make a pin an input.  When a program begins, 
all of the BASIC Stamp's pins are inputs.  Commands that rely on input 
pins, like PULSIN and SERIN, automatically change the specified pin to 
input.  Writing 0s to particular bits of the variable DIRS makes the 
corresponding pins inputs.  And then there’s the INPUT command.  
 
When a pin is an input, your program can check its state by reading the 
corresponding INS variable (PINS on the BS1).  For example:  

 
INPUT 4 
Hold: 
  IF  IN4  =  0  THEN  Hold  ' Stay here until P4 is 1.  
 

The code above will read the state of P4 as set by external circuitry.  If 
nothing is connected to P4, it will alternate between states (1 or 0) 
apparently at random.  
 
What happens if your program writes to the OUTS bit (PINS bit on the 
BS1) of a pin that is set up as an input?  The value is stored in OUTS (PINS 
on the BS1), but has no effect on the outside world.  If the pin is changed to 
output, the last value written to the corresponding OUTS bit (or PINS bit 
on the BS1) will appear on the pin.  The demo program shows how this 
works. 
 

Demo Program (INPUT.bas) 

' This program demonstrates how the input/output direction of a pin is determined by 
' the corresponding bit of DIRS. It also shows that the state of the pin itself (as 
' reflected by the corresponding bit of PINS) is determined by the outside world when 
' the pin is an input, and by the corresponding bit of PINS when it's an output. To 
' set up the demo, connect a 10k resistor from +5V to P7 on the BASIC Stamp. The 
' resistor to +5V puts a high (1) on the pin when it's an input. The BASIC Stamp can 
' override this state by writing a low (0) to bit 7 of OUTS and changing the pin to output.  

1

2

e

2

sx

2

p

2

1

1

NOTE: Expressions are not allowed 
as arguments on the BS1.  The 
range of the Pin argument on the 
BS1 is 0 – 7. 

Summary of Contents for BASIC Stamp 2e

Page 1: ...BASIC Stamp Programming Manual Version 2 0c...

Page 2: ...profits downtime goodwill damage to or replacement of equipment or property and any costs of recovering reprogramming or reproducing any data stored in or used with Parallax products Internet Access...

Page 3: ...ucation 22 BASIC Stamp Activity Board 23 GUIDELINES AND PRECAUTIONS 25 QUICK START GUIDE 29 USING THE BASIC STAMP EDITOR 33 BASIC STAMP WINDOWS EDITOR 34 BASIC STAMP DOS EDITOR 41 BASIC STAMP ARCHITEC...

Page 4: ...btract 67 Multiply 67 Multiply High 68 Multiply Middle 68 Divide 69 Modulus 70 Minimum MIN 70 Maximum MAX 71 Digit DIG 72 Shift Left 72 Shift Right 72 Reverse REV 73 And 73 Or 73 Xor 74 And Not 75 Or...

Page 5: ...DCMD 159 LCDIN 167 LCDOUT 171 LOOKDOWN 177 LOOKUP 183 LOW 187 MAINIO 189 NAP 191 OUTPUT 195 OWIN 197 OWOUT 205 PAUSE 213 POLLIN 215 POLLMODE 219 POLLOUT 225 POLLRUN 231 POLLWAIT 235 POT 239 PULSIN 241...

Page 6: ...s Page 4 BASIC Stamp Programming Manual 2 0b www parallaxinc com STOP 321 STOP 323 TOGGLE 327 WRITE 329 XOUT 333 APPENDIX A ASCII CHART 337 APPENDIX B RESERVED WORDS 339 APPENDIX C CONVERSION FORMATTE...

Page 7: ...ectronics it would be best to locate one or more of the following books for further information 1 Programming and Customizing the BASIC Stamp Computer Scott Edwards TAB Books ISBN 0 07 913684 2 2 Micr...

Page 8: ...dually The packing list below describes the general list of items that would be included in a BASIC Stamp Starter Kit at the time of this writing BASIC Stamp Starter Kit 1 BASIC Stamp Module Rev D BS1...

Page 9: ...internal memory RAM and EEPROM a 5 volt regulator a number of general purpose I O pins TTL level 0 5 volts and a set of built in commands for math and I O pin operations BASIC Stamps are capable of ru...

Page 10: ...13 mm 5 13 mm Figure 1 1 BASIC Stamp 1 Rev D 27100 Figure 1 2 BASIC Stamp 1 Rev B BS1 IC Figure 1 3 OEM BASIC Stamp 1 Rev A 27295 or 27296 VIN VSS PCO PCI P0 P1 P2 P3 P4 P5 P6 P7 13 14 1 2 3 4 5 6 7...

Page 11: ...connected if 5 volts is applied to the VDD 5V pin 2 VSS System ground connects to PC parallel port pin 25 GND for programming 3 PCO PC Out connects to PC parallel port pin 11 BUSY for programming 4 PC...

Page 12: ...their design as a lower cost solution The OEMBS2 is available in either an assembled form or a kit form Both packages are functionally equivalent SOUT SIN ATN VSS P0 P1 P2 P3 P4 P5 P6 P7 VIN VSS RES...

Page 13: ...g an external 5 volt regulator 21 VDD 5 volt DC input output if an unregulated voltage is applied to the VIN pin then this pin will output 5 volts If no voltage is applied to the VIN pin then a regula...

Page 14: ...ASIC Stamp 2e circuit directly into their design as a lower cost solution The OEMBS2e is available in assembled form only SOUT SIN ATN VSS P0 P1 P2 P3 P4 P5 P6 P7 VIN VSS RES VDD P15 P14 P13 P12 P11 P...

Page 15: ...xternal 5 volt regulator 21 VDD 5 volt DC input output if an unregulated voltage is applied to the VIN pin then this pin will output 5 volts If no voltage is applied to the VIN pin then a regulated vo...

Page 16: ...the BASIC Stamp 2sx circuit directly into their design as a lower cost solution The OEMBS2sx is available in assembled form only SOUT SIN ATN VSS P0 P1 P2 P3 P4 P5 P6 P7 VIN VSS RES VDD P15 P14 P13 P...

Page 17: ...xternal 5 volt regulator 21 VDD 5 volt DC input output if an unregulated voltage is applied to the VIN pin then this pin will output 5 volts If no voltage is applied to the VIN pin then a regulated vo...

Page 18: ...4 23 22 21 20 19 18 17 16 15 14 13 1 2 3 4 5 6 7 8 9 10 11 12 BS2p24 IC 1 2 31 mm 62 16 mm 1 2 54 mm Rev A BS2p 24 2000 1 SOUT SIN ATN VSS P0 P1 P2 P3 P4 P5 P6 P7 VIN VSS RES VDD X15 X14 X13 X12 X11 X...

Page 19: ...5 should not exceed 75 mA source or sink if using the internal 5 volt regulator The total per 8 pin groups P0 P7 P8 15 X0 X7 or X8 X15 should not exceed 100 mA source or sink if using an external 5 vo...

Page 20: ...added feature of the reset button Figure 1 12 shows the BASIC Stamp 1 Carrier Board with the BS1 IC properly inserted into the socket This board features a 3 pin programming header and 9 volt battery...

Page 21: ...ly inserted into the socket This board features a DB9 programming connector reset button and 9 volt battery clips Two male 12 pin 0 1 headers to the left and right of the chip socket allows access to...

Page 22: ...or separate 5 volt regulator and power LED A female 20 pin 0 1 socket allows access to all the module s pins Many of the solder pads see Figure 1 16 are connected to each other in a fashion that allow...

Page 23: ...BASIC Stamp Super Carrier Board Rev A shown with BS2 IC properly inserted 27130 P15 P14 P13 P12 P11 P10 P9 P8 P7 P6 P5 P4 P3 P2 P1 P0 Vdd Vdd Vss Vss Vss Figure 1 16 Prototype area of the BASIC Stamp...

Page 24: ...the Stamp module pin 21 while the 5 Vdd sockets above the breadboard come from the Board of Education s 5 volt regulator Use the 5 Vdd sockets for anything requiring more current than what the Stamp c...

Page 25: ...ing to an X10 powerline interface an analog output pin and two 8 pin sockets for EEPROM and ADC chips One female 0 1 socket allows for access to all the module s pins plus Vdd Vin and Vss Vdd is 5 vol...

Page 26: ...ntation available for those products for specific information Pwr Reset Stamp Activity Board c 1998 6 12VAC 9 24VDC Need Tech Support email stamptech parallaxinc com www parallaxinc com X7 20 19 X1 X4...

Page 27: ...ecting disconnecting a If power is connected to the BASIC Stamp or any device it is connected to while inserting or removing it from a circuit damage to the BASIC Stamp or circuit could result 3 Verif...

Page 28: ...llow these diagrams closely it is quite common for programming problems with the BASIC Stamps to be a result of a poorly made custom cable or programming connections on your applications board With th...

Page 29: ...tic port detection SOUT SIN ATN VSS P0 P1 P2 P3 P4 P5 P6 P7 1 2 3 4 6 5 7 9 8 DSR RTS BS2 IC Module PC Serial Port 1 2 3 4 5 6 7 8 9 10 11 12 24 23 22 21 20 19 18 17 16 15 14 13 VIN VSS RES VDD P15 P1...

Page 30: ...Introduction to the BASIC Stamps Page 28 BASIC Stamp Programming Manual 2 0b www parallaxinc com...

Page 31: ...ts own development board 2 If using a BASIC Stamp 1 connect the 25 pin side of your programming cable to an available parallel port on your computer Then connect the 3 pin side to the 3 pin programmin...

Page 32: ...tion to locate and run the software b If using the Windows software it may prompt you with a list of serial ports Follow the prompt to configure the serial port list if needed for proper operation of...

Page 33: ...If the program is typed in correctly and the BASIC Stamp is connected properly a progress bar window should appear perhaps very briefly showing the download progress Afterwards a debug window should a...

Page 34: ...Quick Start Guide Page 32 BASIC Stamp Programming Manual 2 0b www parallaxinc com...

Page 35: ...should auto start unless that feature has been disabled on your computer If using DOS explore it with the CD change directory and DIR directory list commands 2 Select the Software BASIC Stamp section...

Page 36: ...tor shown in Figure 3 1 was designed to be easy to use and mostly intuitive Those that are familiar with standard Windows software should feel comfortable using the BASIC Stamp Windows Editor The edit...

Page 37: ...r supports more than one model of the BASIC Stamp it is necessary to tell the editor which model you are trying to program There are three methods the editor uses to determine the model of the BASIC S...

Page 38: ...appears on a comment line the apostrophe indicates this for compatibility with the DOS versions of the editor The BS2 in the example above should be changed to indicate the appropriate model of the BA...

Page 39: ...de file is loaded tokenized downloaded run or viewed in the Memory Map For BS2e BS2sx and BS2p programs each editor page can be a separate project or part of a single project A project is a set of up...

Page 40: ...editor will read the STAMP directive determine if the indicated files exist will load them if necessary and change their captions to indicate the project they belong to and their associated program n...

Page 41: ...e to verify it s path is correct will see that it is already loaded and then will change the editor tabs to indicate the project relationship At this point the editor tabs will be 0 Sample bsx and Sam...

Page 42: ...ayout of the current PBASIC program DATA usage and RAM register usage Type CTRL M or press F7 to activate this window When you activate the Memory Map the editor will check your program for syntax err...

Page 43: ...rmware F7 or Ctrl T Perform a syntax check on the code and display any error messages F8 or Ctrl M Open Memory Map window F9 or Ctrl R Tokenize code download to the BASIC Stamp and open Debug window i...

Page 44: ...a time Source code can be loaded into the editor by pressing ALT L and selecting a file from the menu NOTE That the browse menu only shows files in the current directory the directory that the BASIC...

Page 45: ...consist of the following 1 ALT L loads a program into the editor 2 ALT 0 sets the editor to program ID 0 3 ALT R downloads this program into program slot 0 of the BASIC Stamp s EEPROM 4 ALT L loads a...

Page 46: ...or File Functions Shortcut Key Function Alt L Open a source code file into the Editor window Alt S Save current source code file to disk Alt Q Close the editor Editing Functions Shortcut Key Function...

Page 47: ...erwritten such as during the program downloading process or with a WRITE instruction The BS1 has 16 bytes 8 words of RAM space arranged as shown in Table 4 1 The first word called PORT is used for I O...

Page 48: ...2p have 32 bytes of Variable RAM space arranged as shown in Table 4 2 Of these the first six bytes are reserved for input output and direction control of the I O pins The remaining 26 bytes are availa...

Page 49: ...IN7 IN8 IN15 Input pins OUTS OUTL OUTH OUTA OUTB OUTC OUTD OUT0 OUT7 OUT8 OUT15 Output pins DIRS DIRL DIRH DIRA DIRB DIRC DIRD DIR0 DIR7 DIR8 DIR15 I O pin direction control W0 B0 B1 W1 B2 B3 W2 B4 B...

Page 50: ...mming the BASIC Stamp it s often more convenient to deal with individual bytes nibbles or bits of INS OUTS and DIRS rather than the entire 16 bit words PBASIC has built in names for these elements sho...

Page 51: ...ze your storage requirements to make optimal use of the available memory Before you can use a variable in a PBASIC program you must declare it Declare means letting the BASIC Stamp know that you plan...

Page 52: ...t s what size W0 is while the other two are both byte sized variables Throughout the rest of the program we can use the names Temporary Counter and Result instead of W0 B1 and B2 respectively This mak...

Page 53: ...e And so on If you assign a value to a variable that exceeds its size the excess bits will be lost For example suppose you use the nibble variable Dog from the example above and write Dog 260 10000010...

Page 54: ...the maximum value for the size of the array For instance in the example above MyBytes is a 10 cell array Allowable index numbers are 0 through 9 If your program exceeds this range PBASIC will not resp...

Page 55: ...different places in your program but also want the variable s name to reflect its function in each place Use caution because it is easy to forget about the aliases during debugging you might end up a...

Page 56: ...rogressively smaller from left to right It would make no sense to specify for instance the low byte of a nibble because a nibble is smaller than a byte And just because you can stack up modifiers does...

Page 57: ...s nib array will all be contiguous one right after the other as in the previous example MyBytes VAR BYTE 10 Define 10 byte array MyBytes 0 AB Hex AB into 0th byte MyBytes 1 CD Hex CD into next byte DE...

Page 58: ...makes hooting sounds and activates a motor that crashes cymbals together all in sets of three A portion of your PBASIC program might contain something like FOR Counter 1 TO 3 GOSUB MakeCheers NEXT FO...

Page 59: ...the same as the previous FOR NEXT loops The editor software would substitute the number 3 for the constant named Cheers throughout your program Like variable names labels and instructions constant nam...

Page 60: ...tart the download and before the BASIC Stamp starts running your program For example suppose the Cheers program also controls a pump to fill glasses with champagne Perhaps the number of glasses to fil...

Page 61: ...lso use hexadecimal base 16 also called hex or binary base 2 Since the symbols used in decimal hex and binary numbers overlap e g 1 and 0 are used by all 0 through 9 apply to both decimal and hex the...

Page 62: ...pile time OneNinety CON 100 90 Compile time NoWorkee CON 3 Result ERROR Variables not allowed here Result Glasses Runtime Result 99 Glasses Runtime Result OneNinety 1 100 90 solved at compile time One...

Page 63: ...performs integer math whole numbers only 30 4 results in 7 not 7 5 We ll talk more about integers in the next section Some other dialects of BASIC would compute that same expression based on their pr...

Page 64: ...and all work on two values as in 1 3 or 26 144 The values that operators process are referred to as arguments So we say that the add subtract multiply and divide operators take two arguments Operator...

Page 65: ...and then takes the two s complement 1111111110011101 Since we ve asked for the result to be placed in an 8 bit byte variable the upper eight bits are truncated and the lower eight bits stored in the...

Page 66: ...o demonstrate the COS operator use the example program from SIN below but substitute COS for SIN The Decoder operator DCD is a 2 n power decoder of a four bit value DCD accepts a value from 0 to 15 an...

Page 67: ...at a typical sine function By definition given a circle with a radius of 1 unit known as a unit circle the sine is the y coordinate distance from the center of the circle to its edge at a given angle...

Page 68: ...t but the square root of 99 as 9 the actual is close to 9 95 Example DEBUG SQR 100 Display square root of 100 10 DEBUG SQR 99 Display of square root of 99 9 due to truncation Table 4 6 lists the avail...

Page 69: ...numbers DEBUG SDEC Value1 Show the result 599 The Subtraction operator subtracts variables and or constants returning a 16 bit result Works exactly as you would expect with unsigned integers from 0 to...

Page 70: ...st variable supported by PBASIC is 16 bits the highest 16 bits of a 32 bit multiplication result are normally lost The double star instruction gives you these upper 16 bits For example suppose you mul...

Page 71: ...nts for use with the instruction put the whole number portion in the upper byte then use the following formula for the value of the lower byte Hint INT fraction 256 For instance take Pi 3 14159 The up...

Page 72: ...value by another Some division problems don t have a whole number result they return a whole number and a fraction For example 1000 6 166 667 Integer math doesn t allow the fractional portion of the r...

Page 73: ...TO 0 STEP 10 Walk value of Value1 from 100 to 0 Value2 Value1 MIN 50 Use MIN to clamp at 50 DEBUG Value2 Show clamped value NEXT or Value1 VAR WORD FOR Value1 100 TO 0 STEP 10 Walk value of Value1 fr...

Page 74: ...R Idx 0 TO 4 DEBUG Value DIG Idx Show digits 0 through 4 of 9742 NEXT The Shift Left operator shifts the bits of a value to the left a specified number of places Bits shifted off the left end of a num...

Page 75: ...ance 10101101 REV 4 would return 1011 a mirror image of the first four bits of the value Example DEBUG BIN 11001011 REV 4 Mirror 1st 4 bits 1101 The And operator returns the bitwise AND of two values...

Page 76: ...or DEBUG BIN 00001111 10101001 Show OR result 10101111 The Xor operator returns the bitwise XOR of two values Each bit of the values is subject to the following logic 0 XOR 0 0 0 XOR 1 1 1 XOR 0 1 1...

Page 77: ...10101001 Result Value1 Value2 DEBUG Result Show AND NOT result 00000110 The Or Not operator returns the bitwise OR NOT of two values Each bit of the values is subject to the following logic 0 OR NOT...

Page 78: ...OR NOT 1 0 1 XOR NOT 0 0 1 XOR NOT 1 1 The result returned by will contain 1s in any bit positions in which the first value and second values are equal Example SYMBOL Value1 B0 SYMBOL Value2 B1 SYMBOL...

Page 79: ...t where noted BRANCHING IF THEN Compare and conditionally branch BRANCH Branch to address specified by offset GOTO Branch to address GOSUB Branch to subroutine at address RETURN Return from subroutine...

Page 80: ...I O INPUT Make pin an input OUTPUT Make pin an output REVERSE Reverse direction of a pin If pin is an output make it an input If pin is an input make it an output LOW Make pin output low HIGH Make pin...

Page 81: ...ta in from synchronous serial device SHIFTOUT Shift data out to synchronous serial device I2CIN Input data in from I2C serial device I2COUT Output data out toI2C serial device PARALLEL I O LCDCMD Writ...

Page 82: ...es of specified frequencies DTMFOUT Generate DTMF telephone tones POWER CONTROL NAP Nap for a short period Power consumption is reduced SLEEP Sleep for 1 65535 seconds Power consumption is reduced END...

Page 83: ...15 but only after issuing an AUXIO or IOTERM command The AUXIO command causes the BASIC Stamp to affect the auxiliary I O pins instead of the main I O pins in all further code until the MAINIO comman...

Page 84: ...of I O pin 0 physical pin 5 PWM 1 100 40 Generate PWM on I O pin 1 physical pin 6 AUXIO Switch to auxiliary I O pins TOGGLE 0 Toggle state of I O pin 0 physical pin 21 PULSOUT 1 1000 Generate a pulse...

Page 85: ...on The BRANCH instruction is useful when you want to write something like this IF value 0 THEN case_0 value 0 go to label case_0 IF value 1 THEN case_1 value 1 go to label case_1 IF value 2 THEN case_...

Page 86: ...Case2 DEBUG Branched to Case2 cr GOTO Start Demo Program BRANCH bs2 This program shows how the value of Idx controls the destination of the BRANCH instruction STAMP BS2 STAMP directive specifies a BS...

Page 87: ...ut no auto repeat Rate is a variable constant expression 0 255 that specifies the number of cycles between auto repeats The rate is expressed in cycles of the BUTTON routine Workspace is a byte variab...

Page 88: ...ch Then in accordance with TargetState it either branches to address TargetState 1 or doesn t TargetState 0 If the switch stays in DownState BUTTON counts the number of program loops that execute When...

Page 89: ...ss unless P0 0 DEBYG NoPress GOTO Loop Repeat endlessly Demo Program BUTTON bs2 Connect the active low circuit shown in Figure 5 1 to pin P0 of the BS2 When you press the button the Debug screen will...

Page 90: ...BUTTON BASIC Stamp Command Reference Page 88 BASIC Stamp Programming Manual 2 0b www parallaxinc com...

Page 91: ...to 26 214 s 287 s to 18 809 s Minimum pulse width 4 16 s 4 16 s 1 66 s 1 20 s Maximum frequency square wave 120 000 Hz 120 000 Hz 300 000 Hz 416 700 Hz Explanation The COUNT instruction makes the Pin...

Page 92: ...possible for a 1 second count When the count is done the screen will display your score the total number of cycles registered by COUNT Note that this score will almost always be greater than the actu...

Page 93: ...ve rather than a command because it performs an activity at compile time rather than at run time ie the DATA directive is not downloaded to the BASIC Stamp but the data it contains is downloaded The s...

Page 94: ...example the first DataItem is 100 This tells the DATA directive to store the following DataItem s starting at location 100 All the DataItems to the right of the 100 are stored in their respective loc...

Page 95: ...t program perhaps a new version of the same program you can reserve the space as shown above The EEPROM s contents from locations 100 to 119 will remain intact NOTE This only reserves the space for th...

Page 96: ...ganized as a sequential set of byte sized memory locations By default the DATA directive stores bytes into EEPROM If you try to store a word size value ex DATA 1125 only the lower byte of the value wi...

Page 97: ...xtual data CR DATA that needs to be transmitted There s a 12 second delay CR DATA between text paragraphs CR 255 Text3 DATA The alternative having multiple DEBUGs or SEROUTs each CR DATA with their ow...

Page 98: ...m 1 TO 6 For all text blocks print them one by one LOOKUP PhraseNum 1 Text1 Text2 Text3 Text4 Text5 Text6 Index GOSUB PrintIt PAUSE 12000 Pause for 12 seconds in between text blocks NEXT STOP PrintIt...

Page 99: ...ost popular use debugging programs by showing you the value of a variable or expression or by indicating what portion of a program is currently executing DEBUG is also a great way to rehearse programm...

Page 100: ...example the following code displays 75 on the screen SYMBOL X B0 X 75 DEBUG X To display numbers in hexadecimal or binary form use the or formatter respectively The code below displays the same numbe...

Page 101: ...e BASIC Stamp 1 BASIC Stamp 2 2e 2sx and 2p Formatting On the all BASIC Stamps except the BS1 the DEBUG command by default displays everything as ASCII characters What if you want to display a number...

Page 102: ...y fixed for 1 to 16 digits IBIN 1 16 Indicated binary text prefix ex 1001 optionally fixed for 1 to 16 digits ISBIN 1 16 Indicated signed binary text optionally fixed for 1 to 16 digits STR bytearray...

Page 103: ...ned 65471 FFBF 1111111110111111 The signed form of the number 65 is shown in decimal hexadecimal and then in binary on the top line The unsigned form in all three number systems is shown on the bottom...

Page 104: ...n expression for example DEBUG x 10 2 3 in the above code the display would show x 10 2 3 503 A special formatter ASC is also available for use only with the formatter to display ASCII characters as i...

Page 105: ...extra sign characters in the first row but it certainly looks better than the alternative If you have a string of characters to display a byte array you can use the STR formatter to do so The STR form...

Page 106: ...4 The Debug Terminal in the Windows version of the editor supports all the control characters in Table 6 4 while the DOS version only supports a few of them Some of the control characters have pre de...

Page 107: ...Move cursor one character to left Cursor Right 4 Move cursor one character to right Cursor Up 5 Move cursor one character up Cursor Down 6 Move cursor one character down Bell BELL 7 Beep the PC speake...

Page 108: ...ine actually takes less program space and is obviously easier to type You may view DEBUG s output using a terminal program set to the above parameters but you may have to modify either your carrier bo...

Page 109: ...r between tones if multiple tones are specified The unit of time and the default time for OffTime is described in Table 5 7 Tone is a variable constant expression 0 15 specifying the DTMF tone to gene...

Page 110: ...MFOUT 0 500 100 6 2 4 8 3 3 3 Call Parallax slowly In this example on a BS2 the OnTime is set to 500 ms 1 2 second and OffTime to 100 ms 1 10th second Tone Value Corresponding Telephone Key 0 9 Digits...

Page 111: ...re only a starting point you may want to use an active low pass filter with a roll off point around 2 kHz Demo Program DTMFOUT bs2 This demo program is a rudimentary memory dialer Since DTMF digits fi...

Page 112: ...ATA 15 20 55 51 21 2F Phone 1 520 555 1212 Main Routine FOR Phone 0 TO 2 For each phone get location of in EEPROM LOOKUP Phone Parallax ParallaxFax Information EEloc Dial READ EEloc EEByte Retrieve by...

Page 113: ...tore in the available EEPROM locations It is called a directive rather than a command because it performs an activity at compile time rather than at run time ie the EEPROM directive is not downloaded...

Page 114: ...Dataitems The following code writes the same data in Table 5 9 to locations 50 through 59 DATA 50 72 69 76 76 79 104 101 108 108 111 In this example the Location argument is given and tells the EEPROM...

Page 115: ...ROM directive you ll have to calculate the low byte and the high byte and insert them in the list in the proper order as in EEPROM 101 4 The directive above will store the two bytes into two sequentia...

Page 116: ...riables SYMBOL Index B0 Holds current location number SYMBOL Phrase B1 SYMBOL Character B2 Holds current character to print Define all text phrases EEPROM Here is a long message that needs to be trans...

Page 117: ...the I O pins Explanation END puts the BASIC Stamp into its inactive low power mode In this mode the Stamp s current draw excluding loads driven by the I O pins is reduced to the amount shown in Table...

Page 118: ...END BASIC Stamp Command Reference Page 116 BASIC Stamp Programming Manual 2 0b www parallaxinc com...

Page 119: ...EndValue the FOR NEXT loop stops executing and the program goes on to the instruction after NEXT StepValue is an optional variable constant expression 0 65535 by which the Counter increases or decreas...

Page 120: ...nting another asterisk on the screen This code will run through the loop three times setting Reps to 1 2 and 3 and printing three asterisks on the screen After the third loop again the BASIC Stamp goe...

Page 121: ...dValue A negative StepValue on the BS2 BS2e BS2sx and BS2p would be treated as its positive two s compliment counterpart For example 1 in two s complement is 65535 So the following code executes only...

Page 122: ...epValue This creates a display of power s of 2 1 2 4 8 16 32 64 etc Reps VAR WORD Counter for the loop FOR Reps 1 TO 256 STEP Reps Each loop add current value of Reps DEBUG DEC Reps Show reps in debug...

Page 123: ...s B0 Counter for the loop FOR Reps 0 TO 300 Each loop add 1 DEBUG Reps Show reps in debug window NEXT or Reps VAR BYTE Counter for the loop FOR Reps 0 TO 300 Each loop add 1 DEBUG DEC Reps Show reps i...

Page 124: ...ize which will increase by 2 each loop StepSize 1 Square 1 FOR Square 1 TO 250 STEP StepSize Show squares up to 250 DEBUG Square Display on screen StepSize StepSize 2 Add 2 to StepSize NEXT Loop til s...

Page 125: ...2 is an optional argument exactly like Freq1 When specified two frequencies will be mixed together on the specified I O pin Quick Facts BS2 BS2e BS2sx BS2p Units in Period 1 ms 0 4 ms 0 265 ms Units i...

Page 126: ...lf while the second is 8 Hz lower The difference creates a quiver vibrato on each note Subtracting 8 from the note frequency poses a problem when the frequency is 0 because the BASIC Stamp s positive...

Page 127: ...S2 i VAR BYTE Counter for position in tune f VAR WORD Frequency of note for FREQOUT C CON 2092 C note D CON 2348 D note E CON 2636 E note G CON 3136 G note R CON 8 Silent pause rest FOR i 0 TO 28 Play...

Page 128: ...FREQOUT BASIC Stamp Command Reference Page 126 BASIC Stamp Programming Manual 2 0b www parallaxinc com...

Page 129: ...ion 127 Explanation The GET command reads a byte sized value from the specified Scratch Pad RAM location and stores it into Variable All values in all locations can be retrieved from within any of the...

Page 130: ...C2 Value to location DEC2 Index CR NEXT RUN 1 Demo Program GETPUT2 bsx This example demonstrates the use of the GET and PUT commands First location 63 is read using GET to display the currently runnin...

Page 131: ...ost recent GOSUB In other words a GOSUB makes the BASIC Stamp do a similar operation as you do when you see a table or figure reference in this manual 1 you remember where you are 2 you go to the tabl...

Page 132: ...will start the entire program over again This would cause an endless loop The important thing to remember here is to always make sure your program doesn t allow itself to fall into a subroutine Only a...

Page 133: ...subroutine is just a piece of code with the RETURN instruction at the end Always make sure your program enters subroutines with a GOSUB If you don t the RETURN won t have the correct address and your...

Page 134: ...PAUSE 2000 Another pause NEXT STOP When done stop execution here Random number subroutine A subroutine is just a piece of code with the RETURN instruction at the end Always make sure your program ent...

Page 135: ...s to create endless loops programs that repeat a group of instructions over and over For example Loop DEBUG Hi CR GOTO Loop The above code will print Hi on the screen over and over again The GOTO Loop...

Page 136: ...mmand Reference Page 134 BASIC Stamp Programming Manual 2 0b www parallaxinc com GOTO Routine3 Routine1 DEBUG We re in routine 1 CR PAUSE 1000 GOTO Routine2 Routine3 DEBUG We re in routine 3 CR PAUSE...

Page 137: ...aced into output mode Explanation The HIGH command sets the specified pin to 1 a 5 volt level and then sets its mode to output For example HIGH 6 does exactly the same thing as OUT6 1 DIR6 1 Using the...

Page 138: ...or 1 2 second and low for 1 2 second in an endless loop STAMP BS2 STAMP directive specifies a BS2 Loop HIGH 0 PAUSE 500 LOW 0 PAUSE 500 GOTO Loop 1 2 e 2 sx 2 p 2 NOTE This is written for the BS2 but...

Page 139: ...ess argument may be used with the optional LowAddress argument to indicate a word sized address value LowAddress is a variable constant expression 0 255 indicating the low byte of the word sized addre...

Page 140: ...n it would like to receive The exact information transmitted A1 0 depends on the I 2 C device that is being used The above example will read a byte of data from location 0 of a 24LC16B EEPROM from Mic...

Page 141: ...nary optionally limited to 1 16 digits 0 1 1 2 IBIN 1 16 Indicated binary optionally limited to 1 16 digits 0 1 1 4 ISBIN 1 16 Signed indicated binary optionally limited to 1 16 digits 0 1 1 2 4 1 All...

Page 142: ...gure 5 7 shows this format The second byte immediately following the SlaveID is the Address It indicates the 8 bit address within the device containing the data you would like to receive Some devices...

Page 143: ...lly the A1 indicates a change of direction to read the location instead Even though the I2CIN command really doesn t care what the value of the SlaveID s LSB is it is suggested that you still set it a...

Page 144: ...16 Write 16 bytes at once PAUSE 5 DEBUG Addr DEC4 Idx DEC4 Idx 15 Value DEC3 Idx 4 FF CR NEXT PAUSE 2000 ReadFromEEPROM DEBUG CR Reading CR PAUSE 2000 FOR Idx 0 TO 2047 STEP 16 For all 2K locations I2...

Page 145: ...o The Address argument may be used with the optional LowAddress argument to indicate a word sized address value LowAddress is a variable constant expression 0 255 indicating the low byte of the word s...

Page 146: ...location 5 of a 24LC16B EEPROM from Microchip Figure 5 9 shows the proper wiring for this example to work The SlaveID argument A0 is both the ID of the chip and the command to write to the chip the 0...

Page 147: ...optionally fixed to 1 16 digits prefix 1 ISBIN 1 16 Signed indicated binary optionally fixed to 1 16 digits prefix 1 2 1 Fixed digit formatters like DEC4 will pad the number with leading 0s if necess...

Page 148: ...s argument is effectively the high byte of the address value For example if the entire address value is 2050 use 8 for the Address argument and 2 for the LowAddress argument 8 256 2 2050 Following the...

Page 149: ...it is suggested that you still set it appropriately for clarity Also note that the I2COUT command does not support multiple I 2 C masters and the BASIC Stamp cannot operate as an I 2 C slave device De...

Page 150: ...Idx 4 FF CR NEXT PAUSE 2000 ReadFromEEPROM DEBUG CR Reading CR PAUSE 2000 FOR Idx 0 TO 2047 STEP 16 For all 2K locations I2CIN 0 A1 Idx 8 2 Idx STR Result 16 Read 16 bytes at once FOR Check 0 TO 15 Ch...

Page 151: ...Value2 can by any of variable constant or expression Parentheses Not Allowed Allowed Explanation IF THEN is PBASIC s decision maker It tests a condition and if that condition is true goes to a point i...

Page 152: ...ump back to Loop Each time through the loop it displays the measured value and once it is greater than or equal to 4000 it displays Value was greater than 4000 On the BS2 BS2e BS2sx and BS2p the value...

Page 153: ...OR and XOR can be used to join the results of two conditions to produce a single true false result AND and OR work the same as they do in everyday speech Run the example below once with AND as shown a...

Page 154: ...rue False True True True False Condition A Condition B A XOR B False False False False True True True False True True True False Unlike the IF THEN commands in other BASIC s PBASIC s IF THEN can only...

Page 155: ...riable containing 1 as the 16 bit number 0000000000000001 So it sees the NOT of that as 1111111111111110 Since any non zero number is regarded as true NOT 1 is true Strange but true The easiest way to...

Page 156: ...s 10 THEN DONE Quit with 10 samples GOTO Mul3 Done DEBUG CR All done END Demo Program IFTHEN bs2 The program below generates a series of 16 bit random numbers and tests each to determine whether they...

Page 157: ...e between states 1 or 0 apparently at random What happens if your program writes to the OUTS bit PINS bit on the BS1 of a pin that is set up as an input The value is stored in OUTS PINS on the BS1 but...

Page 158: ...side world when the pin is an input and by the corresponding bit of OUTS when it s an output To set up the demo connect a 10k resistor from 5V to P7 on the BASIC Stamp The resistor to 5V puts a high 1...

Page 159: ...6 I O pins for a total of 32 The BS2p40 s I O pins are organized into two groups called main and auxiliary The I O pins in each group can be accessed in the same manner by referencing I O pins 0 15 bu...

Page 160: ...es a BS2p Port VAR BIT Loop MAINIO Switch to main I O pins TOGGLE 0 Toggle state of I O pin 0 physical pin 5 PWM 1 100 40 Generate PWM on I O pin 1 physical pin 6 AUXIO Switch to auxiliary I O pins TO...

Page 161: ...n 4 7 LCD Data Buss DB4 DB7 respectively pins I O pin arrangement when Pin is 8 or 9 8 or 9 depending on pin LCD Enable E pin 10 LCD Read Write R W pin 11 LCD Register Select RS pin 12 15 LCD Data Bus...

Page 162: ...O pins shown in Table 5 26 Figure 5 12 shows the required wiring for the above command to work Note that we could have used 0 for the Pin argument and moved the LCD s Enable pin pin 6 to I O pin 0 Sim...

Page 163: ...the most commonly used sequence for a 2 x 16 and 4 x 20 LCD display the 2 line mode instruction sets the 4 x 20 to 4 line mode The PAUSE 1000 command is optional but only if your program takes more t...

Page 164: ...isplay RAM location While most users will only need the commands shown in Table 5 27 above Table 5 28 below details all of the instructions supported by the LCD for advanced users Many instructions ar...

Page 165: ...A Move pointer to character RAM location specified by address A Move To DRAM Address 1 A A A A A A A Move cursor to display RAM location specified by address A On a standard 2 x 16 character display t...

Page 166: ...the display would actually be DRAM location 2 and the lower left character would be DRAM location 66 Locations 0 1 64 and 65 would be off the left edge of the LCD and would no longer be visible Some i...

Page 167: ...on display with underline cursor DisplayOnBLCrsr CON 00001101 Turn on display with blinking cursor IncCrsr CON 00000110 Auto increment cursor no display shift IncCrsrShift CON 00000111 Auto increment...

Page 168: ...CDCMD 1 FourBitMode Set buss to 4 bit mode LCDCMD 1 TwoLine5x8Font Set to 2 line mode with 5x8 font LCDCMD 1 DisplayOff Turn display off LCDCMD 1 DisplayOn Turn display on with blinking cursor LCDCMD...

Page 169: ...data in a variable or array interpret numeric text decimal binary or hex and store the corresponding value in a variable wait for a fixed or variable sequence of bytes or ignore a specified number of...

Page 170: ...d before sending commands like the one shown above This process is known as initializing the LCD and is the first thing your program should do upon starting up Please refer to the LCDCMD command descr...

Page 171: ...its 0 1 1 2 IBIN 1 16 Indicated binary optionally limited to 1 16 digits 0 1 1 4 ISBIN 1 16 Signed indicated binary optionally limited to 1 16 digits 0 1 1 2 4 1 All numeric conversions will continue...

Page 172: ...gram LCDIN bsp This program demonstrates initialization printing and reading from a 2 x 16 character LCD display STAMP BS2p STAMP directive specifies a BS2p Char VAR BYTE 16 Variable for holding text...

Page 173: ...alues into decimal hex or binary text representations or transmit strings of bytes from variable arrays These actions can be combined in any order in the OutputData list Quick Facts BS2p Values for Pi...

Page 174: ...before sending commands like the one shown above This process is known as initializing the LCD and is the first thing your program should do upon starting up Please refer to the LCDCMD command descrip...

Page 175: ...22 2 Signed modifiers work under two s complement rules Special Formatter Action Displays symbol x carriage return where x is a number Default format is decimal but may be combined with conversion for...

Page 176: ...aph paper to plot out the bit pattern on and off pixels in a 5 x 8 pattern as shown in Figure 5 14 Then calculate the corresponding binary value of the bit pattern for each of the eight rows of charac...

Page 177: ...on a 2 x 16 character LCD display This is a modified version of the LCDINIT bsp program STAMP BS2p STAMP directive specifies a BS2p Define LCD constants WakeUp CON 00110000 Wake up FourBitMode CON 00...

Page 178: ...Up PAUSE 1 LCDCMD 1 FourBitMode Set buss to 4 bit mode LCDCMD 1 TwoLine5x8Font Set to 2 line mode with 5x8 font LCDCMD 1 DisplayOff Turn display off LCDCMD 1 DisplayOn Turn display on with blinking cu...

Page 179: ...ble 5 36 to be used as the criteria when comparing values When no ComparisonOp is specified equal to is assumed This argument is not available on the BS1 Values are variables constants expressions 0 6...

Page 180: ...match any of the items in the list Try changing Value 17 to Value 2 Since 2 is not on the list LOOKDOWN leaves Result unaffected Since Result contained 15 before LOOKDOWN executed DEBUG prints Value m...

Page 181: ...t 15 LOOKDOWN Value 26 177 13 1 0 17 99 Result DEBUG Value greater than item DEC Result in list DEBUG prints Value greater than item 2 in list because the first item the value 17 is greater than is 13...

Page 182: ...LOOKDOWN finds that this is item 2 of a list of one character commands and stores 2 into Cmd BRANCH then goes to item 2 of its list which is the program label _Medium at which point DEBUG prints medi...

Page 183: ...em with two lines of code as follows LOOKDOWN Value 5 14 1 43 26 22 30 Value LOOKUP Value 16 17 18 24 10 12 11 Value Assuming our received number is in Value the first line LOOKDOWN will find the valu...

Page 184: ...reater than or equal to 10000 but less than 65535 the largest number we can represent in 16 bit math have five There are two loopholes that we have to plug 1 The number 0 does not have zero digits and...

Page 185: ...iables constants expressions 0 65535 Variable is a variable that will be set to the value at the Index location If Index exceeds the highest location number Variable is left unaffected Quick Facts BS1...

Page 186: ...ted Don t forget that text phrases are just lists of byte values so they too are eligible for LOOKUP searches as in this example SYMBOL Value B0 SYMBOL Result B1 Index 16 Result LOOKUP Index The quick...

Page 187: ...we received 43 we need to output 24 and so on These numbers are not contiguous and they don t appear to be derived from any simple algorithm We can solve this problem with two lines of code as follows...

Page 188: ...Frame DEBUG CLS Frame PAUSE 50 NEXT GOTO Rotate Demo Program LOOKUP bs2 This program uses Lookup to create a debug window animation of a spinning propeller The animation consists of the four ASCII ch...

Page 189: ...ed into output mode Explanation The LOW command sets the specified pin to 0 a 0 volt level and then sets its mode to output For example LOW 6 does exactly the same thing as OUT6 0 DIR6 1 Using the LOW...

Page 190: ...r 1 2 second and low for 1 2 second in an endless loop STAMP BS2 STAMP directive specifies a BS2 Loop HIGH 0 PAUSE 500 LOW 0 PAUSE 500 GOTO Loop 1 2 e 2 sx 2 p 2 NOTE This is written for the BS2 but c...

Page 191: ...2 The BS2p40 s extra or auxiliary I O pins can be accessed in the same manner as the main I O pins by using the IDs 0 to 15 but only after issuing a command called AUXIO or IOTERM The MAINIO command c...

Page 192: ...es a BS2p Port VAR BIT Loop MAINIO Switch to main I O pins TOGGLE 0 Toggle state of I O pin 0 physical pin 5 PWM 1 100 40 Generate PWM on I O pin 1 physical pin 6 AUXIO Switch to auxiliary I O pins TO...

Page 193: ...0 to 100 10 75 F with stable power supply 50 to 100 10 75 F with stable power supply Explanation NAP uses the same shutdown startup mechanism as SLEEP with one big difference During SLEEP the BASIC St...

Page 194: ...the BASIC Stamp in low power mode which would extend your battery life If your application is driving loads sourcing or sinking current through output high or output low pins during a NAP current wil...

Page 195: ...ion of a second This blink is caused by the NAP wakeup mechanism During wakeup all pins briefly slip into input mode effectively disconnecting them from loads STAMP BS2 STAMP directive specifies a BS2...

Page 196: ...NAP BASIC Stamp Command Reference Page 194 BASIC Stamp Programming Manual 2 0b www parallaxinc com...

Page 197: ...BS1 sets the initial state of the pin To simultaneously make a pin an output and set its state use the HIGH and LOW commands Demo Program INOUT bas This program demonstrates how the input output direc...

Page 198: ...an output To set up the demo connect a 10k resistor from 5V to P7 on the BASIC Stamp The resistor to 5V puts a high 1 on the pin when it s an input The BASIC Stamp can override this state by writing...

Page 199: ...store data in a variable or array interpret numeric text decimal binary or hex and store the corresponding value in a variable wait for a fixed or variable sequence of bytes or ignore a specified numb...

Page 200: ...ed by a OWOUT command or a Back End Reset to terminate the session after data is received This may vary due to device and application requirements however When using the Bit rather than Byte mode of d...

Page 201: ...e Value VAR BYTE 13 OWIN 0 1 Value receive the ASCII value for V OWIN 0 1 DEC Value receive the number 3 OWIN 0 1 HEX Value receive the number 3A OWIN 0 1 BIN Value receive the number 101 OWIN 0 1 STR...

Page 202: ...ntinue to accept new data until receiving either the specified number of digits ex three digits for DEC3 or a non numeric character 2 To be recognized as part of a number the minus sign must immediate...

Page 203: ...set pulse is controlled by the lowest two bits of the Mode argument in the OWIN command It can be made to appear before the ROM Function Command ex Mode 1 after the Transaction Data portion ex Mode 2...

Page 204: ...Stamp to address specific memory locations or features of the 1 wire device Refer to the 1 wire device s data sheet for a list of the available Memory Function Commands Finally the Transaction Data se...

Page 205: ...tions used will not work properly with negative temperatures STAMP BS2p STAMP directive specifies a BS2p Temp VAR WORD Holds the temperature value CRem VAR BYTE Holds the counts remaining value CPerC...

Page 206: ...OWIN BASIC Stamp Command Reference Page 204 BASIC Stamp Programming Manual 2 0b www parallaxinc com...

Page 207: ...OWOUT how to format outgoing data OWOUT can transmit individual or repeating bytes convert values into decimal hexadecimal or binary text representations or transmit strings of bytes from variable ar...

Page 208: ...set to initialize the transaction This may vary due to device and application requirements however When using the Bit rather than Byte mode of data transfer all variables in the OutputData argument wi...

Page 209: ...e VAR BYTE Value 65 OWOUT 0 1 Value send the ASCII value for A OWOUT 0 1 REP Value 5 send the ASCII value for A five times ie AAAAA OWOUT 0 1 DEC Value send two characters 6 and 5 OWOUT 0 1 HEX Value...

Page 210: ...xed digit formatters like DEC4 will pad the number with leading 0s if necessary ex DEC4 65 sends 0065 If a number is larger than the specified number of digits the leading digits will be dropped ex DE...

Page 211: ...more than one 1 wire device is attached the BASIC Stamp will ultimately have to address them individually using the Match ROM command Command Value in Hex Action Read ROM 33 Reads the 64 bit ID of th...

Page 212: ...se of a varying width to indicate a 0 or a 1 This is called a Write Slot and must be at least 60 s wide Figure 5 23 shows typical Write Slots performed by the BASIC Stamp See the OWIN command for info...

Page 213: ...properly with negative temperatures STAMP BS2p STAMP directive specifies a BS2p Temp VAR WORD Holds the temperature value CRem VAR BYTE Holds the counts remaining value CPerC VAR BYTE Holds the Count...

Page 214: ...OWOUT BASIC Stamp Command Reference Page 212 BASIC Stamp Programming Manual 2 0b www parallaxinc com...

Page 215: ...rate as the ceramic resonator time base on the BASIC Stamp modules 1 percent When you use PAUSE in timing critical applications keep in mind the relatively low speed of the PBASIC interpreter This is...

Page 216: ...PAUSE BASIC Stamp Command Reference Page 214 BASIC Stamp Programming Manual 2 0b www parallaxinc com...

Page 217: ...are all active regardless of which group the program happens to be using at the time of a polling event Explanation The POLLIN command is one of a family of unique polling commands on the BS2p module...

Page 218: ...ction the BASIC Stamp can be instructed to take is to change the state of an output called a polled output Take a look at the next example POLLIN 0 1 POLLOUT 1 0 POLLMODE 2 Loop DEBUG Looping CR GOTO...

Page 219: ...ugh the effects are the same as when using the polling commands this program actually takes a little longer to run and consumes 7 additional bytes of program EEPROM space Clearly using the polling com...

Page 220: ...response to polled input states are 1 Running another program in a specified program slot 2 Waiting pausing program execution with or without low power mode until the poll state is reached or 3 Any co...

Page 221: ...ecify the mode in which polling events and activities are processed This activity will occur in between instructions during the rest of the PBASIC program The polling commands allow the BASIC Stamp to...

Page 222: ...to 4 activated outputs and run and later the program issued a POLLMODE 6 command the polled output configuration would be cleared but the mode would switch back to 4 still allowing the run action Thi...

Page 223: ...ch means deactivate polling but save configuration I O pins 0 and 1 would still be defined the same way and I O pin 1 would still be set to output mode but no polling would take place during the rest...

Page 224: ...2 slot 1 STAMP BS2p DEBUG Switching CR Loop DEBUG Program 2 CR GOTO Loop In this example containing two programs one is slot 0 and the other in slot 1 program 1 slot 0 will configure polled input pin...

Page 225: ...LIN POLLOUT and POLLMODE commands It will watch for a high signal on I O pin 0 and then will output the opposite signal on I O pin 1 all while printing a message on the PC screen STAMP BS2p STAMP dire...

Page 226: ...POLLMODE BASIC Stamp Command Reference Page 224 BASIC Stamp Programming Manual 2 0b www parallaxinc com...

Page 227: ...time of a polling event If both polled outputs and polled run are active the polled output event will occur before the polled run event Explanation The POLLOUT command is one of a family of unique pol...

Page 228: ...tes the rest of the program it will check for a high level logic 1 on I O pin 0 in between instructions Once the program reaches the endless loop called Loop it will continuously print Looping on the...

Page 229: ...n the polled input pins For example POLLIN 0 1 POLLOUT 1 0 POLLOUT 2 1 POLLOUT 3 1 POLLMODE 2 Loop DEBUG Looping CR GOTO Loop This code sets up I O pin 0 as a polled input pin looking for a high 1 sta...

Page 230: ...ver occured DEBUG Working CR NEXT IF OUT0 0 THEN Work Respond Send a different message if it did occur DEBUG CR Hey You set my pin high CR POLLMODE 10 Reset polled output s latch function GOTO Work He...

Page 231: ...rates the POLLIN POLLOUT and POLLMODE commands It will watch for a high signal on I O pin 0 and then will output the opposite signal on I O pin 1 all while printing a message on the PC screen STAMP BS...

Page 232: ...POLLOUT BASIC Stamp Command Reference Page 230 BASIC Stamp Programming Manual 2 0b www parallaxinc com...

Page 233: ...in this family include POLLIN POLLMODE POLLOUT and POLLWAIT The POLLRUN command is used to specify a program slot to run in response to a polled event This activity can occur in between any two instr...

Page 234: ...cution over to the program in slot 1 the second program is not shown in this example The switch to another program slot works exactly like with the RUN command the designated program is run and the BA...

Page 235: ...LLRUN1 BSP is run STAMP BS2p PollRun1 bsp STAMP directive specifies a BS2p ProgSlot VAR BYTE Init POLLIN 0 1 Set I O 0 to polled input looking for a high POLLRUN 1 Set polled run to program slot 1 POL...

Page 236: ...POLLRUN BASIC Stamp Command Reference Page 234 BASIC Stamp Programming Manual 2 0b www parallaxinc com...

Page 237: ...polled run are active the polled run event will occur immediately after the polled wait detects an event Explanation The POLLWAIT command is one of a family of unique polling commands on the BS2p mod...

Page 238: ...e A Period of 8 makes the BASIC Stamp pause execution in normal running mode not low power mode until a polled input event occurs The response time is indicated in Table 5 60 Since the response time i...

Page 239: ...mode is not required change the POLLWAIT command in the example above to POLLWAIT 8 instead This will have the effect of keeping the BASIC Stamp in normal running mode ie no low power glitches and wi...

Page 240: ...POLLWAIT BASIC Stamp Command Reference Page 238 BASIC Stamp Programming Manual 2 0b www parallaxinc com...

Page 241: ...e Explanation POT reads a variable resistance and returns a value 0 255 representing the amount of time it took to discharge the capacitor through the resistance Pin must be connected to one side of t...

Page 242: ...n the BS1 5 Another window appears showing two numbers scale and value Adjust the resistor until the smallest number is shown for scale assuming you can adjust the resistor as with a potentiometer 6 O...

Page 243: ...pulse width 655 35 ms 131 07 ms 131 07 ms 52 428 ms 49 125 ms Explanation PULSIN is like a fast stopwatch that is triggered by a change in state 0 or 1 on the specified pin The entire width of the sp...

Page 244: ...g see the RCTIME command STAMP BS1 STAMP directive specifies a BS1 SYMBOL Time W0 Again PULSIN 7 1 Time Measure positive pulse IF Time 0 THEN Again If 0 try again DEBUG CLS Time Otherwise display resu...

Page 245: ...ble 5 63 The following example will generate a 100 us pulse on I O pin 5 of the BS2 PULSOUT 5 50 Generate a pulse on pin 5 The polarity of the pulse depends on the state of the pin before the command...

Page 246: ...USE 1000 Wait one second GOTO Again Repeat endlessly Demo Program PULSOUT bs2 This program blinks an LED on for 10ms at 1 second intervals Connect the LED to I O pin 0 as shown in the figure within th...

Page 247: ...on The PUT command writes a byte sized value into the specified Scratch Pad RAM location All values in the general purpose locations can be written to from within any of the 8 program slots Scratch Pa...

Page 248: ...Value to location DEC2 Index CR NEXT RUN 1 Demo Program GETPUT2 bsx This example demonstrates the use of the GET and PUT commands First location 63 is read using GET to display the currently running p...

Page 249: ...modulation PWM allows the BASIC Stamp a purely digital device to generate an analog voltage The basic idea is this If you make a pin output high the voltage at that pin will be close to 5V Output low...

Page 250: ...y the charging time in terms of PWM cycles The period of each cycle is shown in Table 5 65 So on the BS2 to charge a capacitor for 5ms you would specify 5 cycles in the PWM instruction How do you dete...

Page 251: ...ure 5 27 can handle The term PWM applies only loosely to the action of the BASIC Stamp s PWM command Most systems that output PWM do so by splitting a fixed period of time into an on time 1 and an off...

Page 252: ...1 96V then decrease slightly as the capacitor discharges Try varying the interval between PWM bursts by changing the PAUSE value and the number of PWM cycles to see their effect STAMP BS2 STAMP direc...

Page 253: ...a sequence of 65535 essentially random numbers If the same initial value called the seed is always used then the same sequence of numbers is generated The following example demonstrates this SYMBOL R...

Page 254: ...w RANDOM is executed continuously using the previous resulting number as the next seed value while the program waits for the user to press a button Since the user can t control the timing of button pr...

Page 255: ...flips SYMBOL Heads B3 Number of throws that came up heads SYMBOL Tails B4 Number of throws that came up tails SYMBOL Btn B5 Workspace for Button instruction Start DEBUG CLS Press button to start FOR...

Page 256: ...ber of throws that came up tails Btn VAR BYTE Workspace for Button instruction Start DEBUG CLS Press button to start FOR Trials 1 TO 100 100 tosses of the coin Hold RANDOM Flip While waiting for butto...

Page 257: ...BS2p Units in Variable 2 s 2 s 0 8 s 0 9 s Maximum pulse width 131 07 ms 131 07 ms 52 428 ms 58 982 ms Explanation RCTIME can be used to measure the charge or discharge time of a resistor capacitor ci...

Page 258: ...d until both plates sides of the capacitor are at 5V It may seem counterintuitive that discharging the capacitor makes the input high but remember that a capacitor is charged when there is a voltage d...

Page 259: ...e time required for this RC circuit to go from 5V to 1 5V as in Figure 5 29a Time 1 x 10 3 ln 5 0v 1 5v 1 204 x 10 3 On the BS2 the unit of time is 2 s See Table 5 66 that time 1 204 x 10 3 works out...

Page 260: ...it less due to internal resistance of the pin s output driver but you get the idea Demo Program RCTIME1 bs2 This program shows the standard use of the RCTIME instruction measuring an RC charge dischar...

Page 261: ...close Figure 5 30 shows the circuit Note that RCTIME doesn t start timing instantly STAMP BS2 STAMP directive specifies a BS2 Result VAR WORD Again Low 6 Energize relay coil RCTIME 7 1 Result Measure...

Page 262: ...RCTIME BASIC Stamp Command Reference Page 260 BASIC Stamp Programming Manual 2 0b www parallaxinc com...

Page 263: ...as set by the STORE command Explanation The EEPROM is used for both program storage which builds downward from address 255 on BS1 2047 on all other BASIC Stamps and data storage which builds upward fr...

Page 264: ...OWBYTE READ 1 Result HIGHBYTE DEBUG DEC Result This code uses the EEPROM or DATA directive to write the low byte and high byte of the number 1125 into locations 0 and 1 during download When the progra...

Page 265: ...marker STAMP BS1 STAMP directive specifies a BS1 EEPROM BS1 EEPROM Storage 0 SYMBOL StrAddr W0 SYMBOL Char B2 StrAddr 0 Set address to start of Message StringOut READ StrAddr Char Get a byte from EEP...

Page 266: ...laxinc com StrAddr Message Set address to start of Message StringOut READ StrAddr Char Get a byte from EEPROM IF Char 0 THEN Cont Not end Continue Stop Stop here when done Cont DEBUG Char Show charact...

Page 267: ...rt out by GOSUB ing to the section of code beginning with the label Hello It will print Hello my friend on the screen then RETURN to the line after the GOSUB which prints How are you and ENDs GOSUB He...

Page 268: ...ine and stop Since we left out the END command indicated in the comments the program then falls into the subroutine displays Executing again and then RETURNs to the start of the program and runs conti...

Page 269: ...s it an output if it s an output REVERSE makes it an input Remember that input really has two meanings 1 Setting a pin to input makes it possible to check the state 1 or 0 of external circuitry connec...

Page 270: ...pin 0 I O direction GOTO Again Repeat forever Demo Program REVERSE bs2 Connect the circuit shown in the REVERSE command description to I O pin 0 and run this program The LED will alternate between tw...

Page 271: ...ight slots of 2 kbytes each Up to eight different programs can be downloaded to the BASIC Stamp one program per slot When the BASIC Stamp powers up or is reset the program in slot 0 is executed The RU...

Page 272: ...e order in all programs so that the variables align themselves on the proper word byte nibble and bit boundaries across programs Any program number specified above 7 will wrap around and result in run...

Page 273: ...rogram number are displayed on the screen Afterwards program number 0 is run This program is a BS2sx project consisting of RUN1 bsx and RUN2 bsx See the BASIC Stamp Project section in the manual for m...

Page 274: ...RUN BASIC Stamp Command Reference Page 272 BASIC Stamp Programming Manual 2 0b www parallaxinc com...

Page 275: ...variable constant 0 255 indicating data that must be received before execution can continue Multiple qualifiers can be indicated with commas separating them Plabel is an optional label indicating whe...

Page 276: ...ommunication There are two major types of serial communication asynchronous and synchronous The SERIN and SEROUT commands are used to receive and send asynchronous serial data See the SHIFTIN and SHIF...

Page 277: ...ng For the built in serial port set the Rpin argument to 16 in the SERIN command All BASIC Stamps including the BS1 can also receive RS 232 data through any of their I O pins Rpin 0 7 for BS1 Rpin 0 1...

Page 278: ...IN requires a value called Baudmode that tells it the important characteristics of the incoming serial data the bit period number of data and parity bits and polarity On the BS1 serial communication i...

Page 279: ...no formatters to try to solve this problem Baud Rate 8 bit no parity inverted 8 bit no parity true 7 bit even parity inverted 7 bit even parity true 1200 18447 2063 26639 10255 2400 17405 1021 25597 9...

Page 280: ...trouble In fact sometimes it is desirable to have multiple stop bits see the SERIN Troubleshooting section below for more information The example below will receive a single byte through I O pin 1 at...

Page 281: ...ards the program can perform any numeric operation on the number just like with any other number Without the decimal formatter however you would have been forced to receive each character 1 2 and 3 se...

Page 282: ...value in SerData The SERIN command then ends allowing the next line of code if any to run 4 Serial input 123A Result Same as example 3 above The A character just like the space character is the first...

Page 283: ...some other non decimal numeric character the SerData variable would end up with the number 100 after the SERIN line finishes If the device sent some data other than XYZ followed by a number the BASIC...

Page 284: ...on numeric character arrives or in the case of the fixed length formatters the maximum specified number of digits arrives While very effective at filtering and converting input text the formatters are...

Page 285: ...o accept new data until receiving either the specified number of digits ex three digits for DEC3 or a non numeric character 2 To be recognized as part of a number the minus sign must immediately prece...

Page 286: ...certain order Each of the elements in an array is the same size The string ABC could be stored in a byte array containing three bytes elements See the Defining Arrays section in Chapter 4 for more in...

Page 287: ...waits for a sequence of up to six bytes specified as part of the InputData list like so SERIN 1 16468 WAIT SESAME Wait for word SESAME DEBUG Password accepted SERIN will wait for that word and the pr...

Page 288: ...long if its length varies the following code would be more appropriate YOffset VAR WORD SERIN 1 16468 WAIT pos DEC yOffset DEC yOffset DEBUG yOffset The unwanted x data is stored in yOffset then repl...

Page 289: ...parity error If the parity matches the program continues at the DEBUG instruction after SERIN If the parity doesn t match the program goes to the label BadData Note that a parity error takes precedenc...

Page 290: ...y error GOTO Again When you design an application that requires serial communication between BASIC Stamps you have to work within these limitations When the BASIC Stamp is sending or receiving data it...

Page 291: ...fied the Fpin s responses would have been reversed Here s the relationship of serial polarity to Fpin states Ready to Receive Go Not Ready to Receive Stop Inverted Fpin is High 1 Fpin is Low 0 Non inv...

Page 292: ...ate the amount of time operations should take within the BASIC Stamp Misunderstanding the timing constraints is the source of most problems with code that communicate serially b If the serial communic...

Page 293: ...rrays and no formatters will increase the chance that the BASIC Stamp can receive the data properly 6 Be sure to study the effects of SERIN formatters a Some formatters have specific requirements that...

Page 294: ...eeting PAUSE 2500 GOTO Loop Using two BS2 IC s connect the circuit shown in the SERIN command description and run this program on the BASIC Stamp designated as the Receiver This program demonstrates t...

Page 295: ...s that specifies serial timing and configuration Pace is an optional variable constant expression 0 65535 that determines the length of the pause between transmitted bytes NOTE Pace cannot be used sim...

Page 296: ...e are two major types of serial communication asynchronous and synchronous The SERIN and SEROUT commands are used to receive and send asynchronous serial data See the SHIFTIN and SHIFTOUT command for...

Page 297: ...lies on precise timing Both the sender and receiver must be set for identical timing usually expressed in bits per second bps called baud On all BASIC Stamps SEROUT requires a value called Baudmode th...

Page 298: ...e driven low 15 ON300 300 INVERTED open source driven low On the BS2 BS2e BS2sx and BS2p serial communication is very flexible The Baudmode argument for SEROUT accepts a 16 bit value that determines i...

Page 299: ...le above If the dedicated serial port Tpin 16 is used the data is inverted and driven regardless of the baudmode setting Baud Rate 8 bit no parity inverted 8 bit no parity true 7 bit even parity inver...

Page 300: ...T command provides a formatter called the decimal formatter which will translate the value 65 to two ASCII codes for the characters 6 and 5 and then transmit them Look at the following code SEROUT 1 N...

Page 301: ...See Table 5 79 for units of the Pace argument One good reason to use the Pace feature is to support devices that require more than one stop bit Normally the BASIC Stamp sends data as fast as it can wi...

Page 302: ...ersion Formatter Type of Number Notes DEC 1 5 Decimal optionally fixed to 1 5 digits 1 SDEC 1 5 Signed decimal optionally fixed to 1 5 digits 1 2 HEX 1 4 Hexadecimal optionally fixed to 1 4 digits 1 S...

Page 303: ...byte array is a similar concept to a string it contains data that is arranged in a certain order Each of the elements in an array is the same size The string ABC could be stored in a byte array conta...

Page 304: ...e limitations When the BASIC Stamp is sending or receiving data it can t execute other instructions When the BASIC Stamp is executing other instructions it can t send or receive data The BASIC Stamp d...

Page 305: ...p In Figure 5 35 I O pin 0 Fpin is pulled to ground through a 10k resistor This is to ensure that the sender sees a stop signal 0 for inverted communications when the receiver is being programmed In t...

Page 306: ...ns or the BASIC Stamps themselves Since the open baudmodes only drive in one state and float in the other there s no chance of this kind of short The polarity selected for SEROUT determines which stat...

Page 307: ...s with serial communication and test them one at a time b Add more and more small pieces testing them each time as you go c Never write a large portion of code that works with serial communication wit...

Page 308: ...ng serially 4 Verify port setting on the PC and in the SERIN SEROUT commands a Unmatched settings on the sender and receiver side will cause garbled data transfers or no data transfers If the data you...

Page 309: ...reeting PAUSE 2500 GOTO Loop Using two BS2 IC s connect the circuit shown in the SEROUT command description and run this program on the BASIC Stamp designated as the Receiver This program demonstrates...

Page 310: ...SEROUT BASIC Stamp Command Reference Page 308 BASIC Stamp Programming Manual 2 0b www parallaxinc com...

Page 311: ...variable in which incoming data bits will be stored Bits is an optional variable constant expression 1 16 specifying how many bits are to be input by SHIFTIN If no Bits entry is given SHIFTIN default...

Page 312: ...nclude 1 which bit of the data arrives first most significant bit MSB or least significant bit LSB and 2 is the first data bit ready before the first clock pulse PRE or after the first clock pulse POS...

Page 313: ...sult variable will contain the value AF By default SHIFTIN acquires eight bits but you can set it to shift any number of bits from 1 to 16 with the Bits argument For example Result VAR BYTE SHIFTIN 0...

Page 314: ...31 The SHIFTIN command does most of the work The mode argument in the SHIFTIN command specifies msb or lsb first and whether to sample data before or after the clock In this case we chose msb first po...

Page 315: ...or value and symbol definitions OutputData is a variable constant expression containing the data to be sent Bits is an optional variable constant expression 1 16 specifying how many bits are to be out...

Page 316: ...ce is a matter of matching the mode and number of bits to that device s protocol Most manufacturers use a timing diagram to illustrate the relationship of clock and data One of the most important item...

Page 317: ...le SHIFTOUT 0 1 MSBFIRST 250 4 Will only output the lowest 4 bits 0000 in this case Some devices require more than 16 bits To solve this you can use a single SHIFTOUT command with multiple values Each...

Page 318: ...ective specifies a BS2 DataP CON 0 Data pin to 74HC595 Clock CON 1 Shift clock to 74HC595 Latch CON 2 Moves data from register to output latch Counter VAR BYTE Counter for demo program This loop moves...

Page 319: ...ly over 18 hours Power consumption is reduced to the amount described in Table 5 93 assuming no loads are being driven The resolution of the SLEEP instruction is 2 304 seconds SLEEP rounds the specifi...

Page 320: ...ages The simplest solution is often to connect resistors high or low to 5V or ground as appropriate to ensure a continuing supply of current during the reset glitch The demo program can be used to dem...

Page 321: ...128 to hissing 255 Period is a variable constant 1 255 specifying the amount of time to generate the tone s The unit of time for Period is 12 ms Explanation SOUND generates one of 255 square wave freq...

Page 322: ...tive specifies a BS1 SYMBOL Tone B0 FOR Tone 0 TO 255 SOUND 1 25 10 Tone 10 NEXT 10 F both 40 Speaker or 8 in series with 33 resistor from I O pin C1 C2 Notes C1 may be omitted for piezo speakers C2 i...

Page 323: ...e BASIC Stamp into low power mode The BASIC Stamp draws just as much current as if it were actively running program instructions 2 The output glitch that occurs after a program has ended does not occu...

Page 324: ...STOP BASIC Stamp Command Reference Page 322 BASIC Stamp Programming Manual 2 0b www parallaxinc com...

Page 325: ...d switches the program slot that the READ and WRITE commands operate on The default program slot that the READ and WRITE instructions operate on is the currently running program The STORE command can...

Page 326: ...lot DEC1 Value HIGHNIB CR CR FOR Idx 0 TO 4 READ Idx Value DEBUG Location DEC Idx Value DEC3 Value CR NEXT RETURN Demo Program STORE1 bsp DATA 0 6 7 8 9 10 Idx VAR WORD Value VAR BYTE Main Routines Ma...

Page 327: ...RN The next Demo Program StoreAll bsp is not related to the previous three programs StoreAll bsp demonstrates the use of the STORE command to treat contiguous program slots as one block of memory 14 k...

Page 328: ...adWordFromEEPROM DEBUG Location DEC5 Idx Value DEC5 Value CR NEXT STOP Subroutines WriteWordToEEPROM NOTE This routine is written to work only when Idx is an even byte boundary STORE Idx 11 Set to pro...

Page 329: ...Toggle pin 2 invert PIN2 put 1 in DIR2 DEBUG PIN2 Show state of pin 2 1 again or DIR2 0 Pin 2 in input mode OUT2 0 Pin 2 output driver low DEBUG IN2 Show state of pin 2 1 due to pullup TOGGLE 2 Toggl...

Page 330: ...TOGGLE bs2 Connect LEDs to pins 0 through 3 as shown in the TOGGLE command description in the manual and run this program The TOGGLE command will treat you to a light show You may also run the demo wi...

Page 331: ...cial notes n a n a WRITE only works with current program slot on BS2e and BS2sx WRITE works with any program slot as set by the STORE command Explanation The EEPROM is used for both program storage wh...

Page 332: ...the high byte of W0 Value 1125 WRITE 0 Value_Low WRITE 1 Value_High or Value VAR WORD WRITE 0 Value LOWBYTE WRITE 1 Value HIGHBYTE When this program runs the two WRITE commands will store the low byt...

Page 333: ...our program Therefore your program can use any space below the address given in location 255 For example if location 255 holds the value 100 then your program can use locations 0 99 for data On other...

Page 334: ...a BS2 ValAddr VAR BYTE Value VAR BYTE WriteItOut WRITE 0 100 Write some data to location 0 through 3 WRITE 1 200 WRITE 2 45 WRITE 3 28 ReadItOut FOR ValAddr 0 TO 3 Read all four locations and display...

Page 335: ...xpression 0 30 that specifies the command to send Values 0 15 correspond to unit codes 1 16 Other commands are shown in Table 5 96 Cycles is an optional variable constant expression 1 255 specifying t...

Page 336: ...of the AC line To send X 10 commands a controller must synchronize to the AC line frequency with 50 s precision and transmit an 11 bit code sequence representing the command XOUT interfaces to the AC...

Page 337: ...n is P0 Mpin CON 1 Mpin is P1 HouseA CON 0 House code A 0 Unit1 CON 0 Unit code 1 0 XOUT Mpin Zpin HouseA Unit1 Get unit 1 s attention XOUT Mpin Zpin HouseA UnitOn and tell it to turn on You can combi...

Page 338: ...odulation control pin to TW523 or PL513 HouseA CON 0 House code 0 A 1 B 15 P Unit1 CON 0 Unit code 0 1 1 2 15 16 Unit2 CON 1 Unit code 1 2 This first example turns a standard appliance or non dimmer l...

Page 339: ...48 30 0 80 50 P 112 70 p 17 11 DC1 Device Control 1 49 31 1 81 51 Q 113 71 q 18 12 DC2 Device Control 2 50 32 2 82 52 R 114 72 r 19 13 DC3 Device Control 3 51 33 3 83 53 S 115 73 s 20 14 DC4 Device Co...

Page 340: ...ASCII Chart Page 338 BASIC Stamp Programming Manual 2 0b www parallaxinc com...

Page 341: ...UT GOTO PULSOUT BYTE ISBIN SBIN POLLMODE HIGH PWM CLS ISBIN1 ISBIN16 SBIN1 SBIN16 POLLRUN IF RANDOM CON ISHEX SDEC POLLWAIT INPUT READ COS ISHEX1 ISHEX4 SDEC1 SDEC5 PUT LET REVERSE COUNT LIGHTSON SERI...

Page 342: ...Reserved Words Page 340 BASIC Stamp Programming Manual 2 0b www parallaxinc com...

Page 343: ...acters such as letters spaces minus signs carriage returns control characters etc Decimal numerics are 0 1 2 3 4 5 6 7 8 and 9 Means no valid data or not enough valid data was received so the SERIN co...

Page 344: ...rriage returns control characters etc Hexadecimal numerics are 0 1 2 3 4 5 6 7 8 9 A B C D E F Means no valid data or not enough valid data was received so the SERIN command will halt forever unless t...

Page 345: ...N2 11 11 11 11 10 IBIN3 IBIN16 11 11 11 101 ISBIN 11 11 11 101 ISBIN1 1 1 1 1 1 ISBIN2 11 11 11 11 10 ISBIN3 ISBIN16 11 11 11 101 Means any non binary numeric characters such as letters spaces minus s...

Page 346: ...Conversion Formatters Page 344 BASIC Stamp Programming Manual 2 0b www parallaxinc com...

Page 347: ...301 ASCII Chart 337 ASCII Notation 59 Asynchronous Serial 274 294 ATN 11 13 15 17 Auxiliary I O Pins 81 157 AUXIO 81 82 189 B B0 B13 45 BASIC Stamp Architecture 45 Hardware 7 Memory 45 Networking 304...

Page 348: ...ing 29 Connecting Disconnecting 25 26 Connection diagram 29 Constants 56 58 Control Characters 104 Conversion Formatters 341 Conversion Formatters SERIN 283 Conversion Formatters SEROUT 300 COS 63 64...

Page 349: ...stem Requirements 33 Using 33 Using Multiple Modules Windows 35 Windows 34 Editor Software table 30 33 EEPROM 111 14 EEPROM Usage 91 261 64 321 EEPROM Usage BS1 111 Encoder NCD 63 65 END 115 Expressio...

Page 350: ...109 Inverse 63 64 IOTERM 81 157 58 189 ISBIN 100 139 145 169 173 200 208 283 300 ISHEX 100 139 145 169 173 200 208 283 300 L Language PBASIC 7 LCD Commands 161 LCD Customer Characters 174 LCD Display...

Page 351: ...66 75 Order of Operations 60 62 Orientation 25 OUTPUT 195 96 OUTS 46 OWIN 197 203 OWOUT 205 11 P P0 P15 11 13 15 17 P0 P7 9 Pace 299 Pacing 293 Package Types BS1 8 BS2 10 BS2e 12 BS2p 16 BS2sx 14 Pac...

Page 352: ...ading Pulses 89 90 241 42 Reading Word Values 262 REP 100 104 145 207 301 RES 9 11 13 15 17 Reserved Words 339 Reserving EEPROM Locations 93 Reset 9 11 13 15 17 RETURN 265 66 REV 66 73 REVERSE 267 68...

Page 353: ...87 293 303 TOGGLE 327 28 Tone Generation 107 10 123 25 319 20 Troubleshooting Serial 290 305 Two s Compliment 62 U Unary Operators 62 63 66 Absolute Value ABS 63 64 Cosine COS 63 64 Decoder DCD 63 64...

Reviews: