BASIC stamp manual v2.2
5: BASIC Stamp Command Reference – OWIN
BASIC Stamp Syntax and Reference Manual 2.2 • www.parallax.com • Page 295
OWIN
BS1 BS2 BS2e BS2sx BS2p BS2pe BS2px
OWIN Pin, Mode, [ InputData ]
Function
Receive data from a device using the 1-Wire protocol.
• Pin is a variable/constant/expression (0 – 15) that specifies which
I/O pin to use. 1-Wire devices require only one I/O pin (called DQ)
to communicate. This I/O pin will be toggled between output and
input mode during the OWIN command and will be set to input
mode by the end of the OWIN command.
• Mode is a variable/constant/expression (0 – 15) indicating the mode
of data transfer. The Mode argument controls placement of reset
pulses (and detection of presence pulses) as well as byte vs. bit input
and normal vs. high speed. See explanation below.
• InputData is a list of variables and modifiers that tells OWIN what to
do with incoming data. OWIN can 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 number of bytes. These
actions can be combined in any order in the InputData list.
Quick Facts
Table 5.63: OWIN Quick Facts.
BS2p, BS2pe, and BS2px
Receive Rate
Approximately 20 kbits/sec (low speed, not including reset pulse)
Special Notes
The DQ pin (specified by Pin) must have a 4.7 KΩ pull-up resistor.
The BS2pe is not capable of high-speed transfers.
Related Commands
OWOUT
Explanation
The 1-Wire protocol is a form of asynchronous serial communication
developed by Dallas Semiconductor. It only requires one I/O pin and that
pin can be shared between multiple 1-Wire devices. The OWIN command
allows the BASIC Stamp to receive data from a 1-wire device.
The following is an example of the OWIN command:
result VAR Byte
OWIN 0, 1, [result]
A
SIMPLE OWIN EXAMPLE.