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
.
Содержание BASIC Stamp 2e
Страница 1: ...BASIC Stamp Programming Manual Version 2 0c...
Страница 30: ...Introduction to the BASIC Stamps Page 28 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 34: ...Quick Start Guide Page 32 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 90: ...BUTTON BASIC Stamp Command Reference Page 88 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 118: ...END BASIC Stamp Command Reference Page 116 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 128: ...FREQOUT BASIC Stamp Command Reference Page 126 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 196: ...NAP BASIC Stamp Command Reference Page 194 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 206: ...OWIN BASIC Stamp Command Reference Page 204 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 214: ...OWOUT BASIC Stamp Command Reference Page 212 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 216: ...PAUSE BASIC Stamp Command Reference Page 214 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 226: ...POLLMODE BASIC Stamp Command Reference Page 224 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 232: ...POLLOUT BASIC Stamp Command Reference Page 230 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 236: ...POLLRUN BASIC Stamp Command Reference Page 234 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 240: ...POLLWAIT BASIC Stamp Command Reference Page 238 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 262: ...RCTIME BASIC Stamp Command Reference Page 260 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 274: ...RUN BASIC Stamp Command Reference Page 272 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 310: ...SEROUT BASIC Stamp Command Reference Page 308 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 324: ...STOP BASIC Stamp Command Reference Page 322 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 340: ...ASCII Chart Page 338 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 342: ...Reserved Words Page 340 BASIC Stamp Programming Manual 2 0b www parallaxinc com...
Страница 346: ...Conversion Formatters Page 344 BASIC Stamp Programming Manual 2 0b www parallaxinc com...