5: BASIC Stamp Command Reference – XOUT
BASIC Stamp Programming Manual 2.0c
•
www.parallaxinc.com
•
Page 335
Table 5.96 lists the XOUT command codes and their functions:
Command
Value
Function
UnitOn
%10010 Turn on the currently selected unit.
UnitOff
%11010 Turn off the currently selected unit.
UnitsOff
%11100 Turn off all modules in this house code.
LightsOn
%10100 Turn on all lamp modules in this house code.
Dim
%11110 Reduce brightness of currently selected lamp.
Bright
%10110 Increase brightness of currently selected lamp.
Note: In most applications, it’s not necessary to know the code for a given X-10 instruction.
Just use the command constant (UnitOn, Dim, etc.) instead. But knowing the codes leads to
some interesting possibilities. For example, XORing a UnitOn command with the value
%1000 turns it into a UnitOff command, and vice-versa. This makes it possible to write the
equivalent of an X-10 “toggle” instruction.
Here is an example of the XOUT instruction:
Zpin CON 0 ' Zpin 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 combine those two XOUT instructions into one like so:
XOUT Mpin, Zpin, [HouseA\Unit1\2, HouseA\UnitOn]' Unit 1 on.
Note that to complete the attention-getting code HouseA\Unit1 we tacked
on the normally optional cycles entry \2 to complete the command before
beginning the next one. Always specify two cycles in multiple commands
unless you’re adjusting the brightness of a lamp module.
Here is an example of a lamp-dimming instruction:
Zpin CON 0 ' Zpin 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\UnitOff\2, HouseA\Dim\10] 'Dim halfway.
The dim/bright commands support 19 brightness levels. Lamp modules
may also be turned on and off using the standard UnitOn and UnitOff
commands. In the example instruction above, we dimmed the lamp by
Table 5.96: XOUT Commands and
Their Function.
A
SIMPLE
XOUT
EXAMPLE
:
TURNING
AN APPLIANCE ON
.
C
OMBINING MULTIPLE COMMANDS
.
D
IMMING LIGHTS
.
Summary of Contents for BASIC Stamp 1
Page 1: ...BASIC Stamp Programming Manual Version 2 0c...
Page 34: ...Quick Start Guide Page 32 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Page 340: ...ASCII Chart Page 338 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Page 342: ...Reserved Words Page 340 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Page 346: ...Conversion Formatters Page 344 BASIC Stamp Programming Manual 2 0b www parallaxinc com...