manuals.online logo
Brands
  1. Home
  2. •
  3. Brands
  4. •
  5. Parallax
  6. •
  7. Microcontroller
  8. •
  9. Parallax 28016 User manual

Parallax 28016 User manual

Other Parallax Microcontroller manuals

Parallax 28034 User manual

Parallax

Parallax 28034 User manual

Parallax BS2p Plus Pack AppKit User manual

Parallax

Parallax BS2p Plus Pack AppKit User manual

Parallax 27150 User manual

Parallax

Parallax 27150 User manual

Parallax BASIC Stamp II User manual

Parallax

Parallax BASIC Stamp II User manual

Parallax eb500-SER C User manual

Parallax

Parallax eb500-SER C User manual

Parallax Javelin Stamp User manual

Parallax

Parallax Javelin Stamp User manual

Parallax 27113 User manual

Parallax

Parallax 27113 User manual

Parallax BASIC Stamp 2e Owner's manual

Parallax

Parallax BASIC Stamp 2e Owner's manual

Parallax WIZnet W5200 User manual

Parallax

Parallax WIZnet W5200 User manual

Popular Microcontroller manuals by other brands

Microsemi IGLOO nano Starter Kit user guide

Microsemi

Microsemi IGLOO nano Starter Kit user guide

GOWIN DK START GW1NSR-LV4CQN48PC7I6 V 1.1 user guide

GOWIN

GOWIN DK START GW1NSR-LV4CQN48PC7I6 V 1.1 user guide

HETRONIC ERGO-S Service manual

HETRONIC

HETRONIC ERGO-S Service manual

Laird BL654PA user guide

Laird

Laird BL654PA user guide

Novatek NT6861 manual

Novatek

Novatek NT6861 manual

Lantronix Intrinsyc Open-Q 865XR SOM user guide

Lantronix

Lantronix Intrinsyc Open-Q 865XR SOM user guide

Nuvoton ISD61S00 ChipCorder Design guide

Nuvoton

Nuvoton ISD61S00 ChipCorder Design guide

STMicrolectronics ST7 Assembler Linker user manual

STMicrolectronics

STMicrolectronics ST7 Assembler Linker user manual

Texas Instruments Chipcon CC2420DK user manual

Texas Instruments

Texas Instruments Chipcon CC2420DK user manual

NEC 78GK0S/K 1+ Series Application note

NEC

NEC 78GK0S/K 1+ Series Application note

Mikroe SEMITECH N-PLC Click Application note

Mikroe

Mikroe SEMITECH N-PLC Click Application note

Intel Agilex user guide

Intel

Intel Agilex user guide

DIGITAL-LOGIC MICROSPACE manual

DIGITAL-LOGIC

DIGITAL-LOGIC MICROSPACE manual

Texas Instruments TMS320F2837 D Series Workshop Guide and Lab Manual

Texas Instruments

Texas Instruments TMS320F2837 D Series Workshop Guide and Lab Manual

CYPRES CY14NVSRAMKIT-001 user guide

CYPRES

CYPRES CY14NVSRAMKIT-001 user guide

Espressif Systems ESP8266EX Programming guide

Espressif Systems

Espressif Systems ESP8266EX Programming guide

Abov AC33M8128L user manual

Abov

Abov AC33M8128L user manual

Silicon Laboratories C8051F800 user guide

Silicon Laboratories

Silicon Laboratories C8051F800 user guide

manuals.online logo
manuals.online logoBrands
  • About & Mission
  • Contact us
  • Privacy Policy
  • Terms and Conditions

Copyright 2025 Manuals.Online. All Rights Reserved.

Parallax, Inc. • IR Buddy Demo Kit (#28016) • 11/2002 Page 1
599 Menlo Drive, Suite 100
Rocklin, California 95765, USA
Office: (916) 624-8333
Fax: (916) 624-8003
General: [email protected]
Technical: [email protected]
Web Site: www.parallaxinc.com
Educational: www.stampsinclass.com
IR Buddy Demo Kit (#28016)
Infrared Control and Communications
Introduction
The IR Buddy is an intelligent peripheral that allows the BASIC Stamp to transmit and receive infrared
control codes, and communicate (send/receive data packets) with other BASIC Stamps –all through a
single I/O pin and without wires between devices. The IR Buddy has onboard IR transmit and receive
hardware, as well as a communications controller that buffers incoming signals and manages data
exchange with the BASIC Stamp.
What kind of things can be done with the IR Buddy? While the possibilities are many, here's a small list
of ideas that can be realized with an IR Buddy and the Parallax BASIC Stamp:
•Device controller using a standard television/VCR remote control
•Fool-proof beam interrupt detection for alarm systems
•Wireless data exchange between BASIC Stamps and IR master-slave control
Packing List
Verify that your IR Buddy Demo Kit is complete in accordance with the list below:
•(2) IR Buddy Control/Communications modules (#550-28016)
•(5) Red LEDs (#350-00006)
•(5) 470 ohm resistors (#150-04710)
•Jumper wires (#800-00016)
•Documentation
Note: IR Buddy demonstration software files may be downloaded from www.parallax.com.
Features
•Simple, single-wire connection [bi-directional] with BASIC Stamp
•3-pin male header for connection to breadboards and standard 0.1" sockets
•Auto-baud detection (2400, 4800, 9600) for Stamp-to-IR Buddy communications
•Transmit RC-5 remote control codes; with programmable repeat and modulation frequency
•Receive RC-5 control codes; buffer up to four separate key press events
•Send and receive buffered 8-byte data packets between BASIC Stamps through wireless IR link
•Loopback test checks Stamp-to-IR Buddy communications connection
•Low current operation: 2 mA quiescent, 20 mA when transmitting
•Sleep mode reduces current to 14 uA
Parallax, Inc. • IR Buddy Demo Kit (#28016) • 11/2002 Page 2
Connections
Connecting the IR Buddy to the BASIC Stamp is through a single I/O pin. The BASIC Stamp will use
SEROUT to send commands and requests to the IR Buddy, and SERIN to accept data. The IR Buddy
also requires a regulated five-volt power supply (Vdd) and connection to ground (Vss).
Since the IR Buddy uses a single bi-directional serial line, communications must use one of the open
baud modes. The open baud modes leave the I/O pin in a high-impedance (input) state when finished
with the SEROUT command, preventing a possible conflict with data arriving from the IR Buddy.
Figure 1. IR Buddy Connections
How It Works
At its core, the IR Buddy is designed to transmit and receive Philips RC-5 control codes. The RC-5
protocol was designed by Philips for use in consumer electronics and is very robust. The IR Buddy
capitalizes on the strength of this protocol and, with specialized internal software, uses a similar
technique to allow the BASIC Stamp to transmit and receive eight-byte data packets that can be used for
any purpose a particular application requires.
An onboard microcontroller manages communications with the BASIC Stamp and controls the infrared
transmit and receive hardware.
IR Buddy Commands
$72 Receive RC-5 Key Codes
Use: SEROUT pin, baud, [$72, holdoff]
pin variable or constant value: 0 to 15
baud variable or constant value for 2400, 4800 or 9600 baud; open-mode
holdoff variable or constant value: 0 to 255 ms; delays serial output to BASIC Stamp
This command directs the IR Buddy to receive and buffer up to four RC-5 key codes from a standard
consumer electronics remote control or companion IR Buddy. After issuing the receive command, the
BASIC Stamp should prepare to accept the codes into a variable array. The period specified in the
holdoff parameter gives the BASIC Stamp time to get ready for the incoming data.
Parallax, Inc. • IR Buddy Demo Kit (#28016) • 11/2002 Page 3
In a typical application, the command to receive RC-5 codes would be immediately followed with a
SERIN function to accept the data.
Example:
SEROUT pin, baud, [$72, 10]
SERIN pin, baud, [STR buffer\8\255]
The first line above sends the RC-5 receive command and specifies a 10 millisecond holdoff period. The
second line will accept the data into an eight-byte array called buffer. The \8 parameter tells SERIN to
accept eight bytes of data. The trailing \255 parameter tells SERIN to terminate if the value 255 is
encountered in the input stream.
This syntax allows the BASIC Stamp to retrieve all the available key codes from the IR Buddy, regardless
of the actual number buffered (up to four codes; two bytes per code). The IR Buddy uses the value 255
to identify an unused position in the buffer. The end of the buffered data is signified with the value 254.
For example, if the IR Buddy buffered key codes for numbers "1" and "2" from a typical television
remote, the IR Buddy buffer would contain the following data:
0 1 0 2 254 255 255 255
The first two bytes are the system and command codes for "1," the second two bytes are the system and
command codes for "2." The fifth byte, 254, signifies the end of data in the buffer. The rest of the
buffer is padded with the value 255. Note that (with the syntax specified above) SERIN will terminate
upon reading the first 255.
The IR Buddy uses one additional special value: 253. This value tells the BASIC Stamp that the last key
code has been repeated without an intermediate release. The value 253 will appear in the buffer when a
remote key is pressed and held.
$74 Transmit RC-5 Key Code
Use: SEROUT pin, baud, [$74, repeats, modulation, system, command]
pin variable or constant value: 0 to 15
baud variable or constant value for 2400, 4800 or 9600 baud; open-mode
repeats variable or constant value: 0 to 255; number of repeats of this key code
modulation variable or constant value: 30, 38 or 56; IR modulation frequency in kilohertz
system variable or constant value: 0 to 31; system code
command variable or constant value: 0 to 63; command value
This command directs the IR Buddy to transmit any one of the 2048 unique key codes using the Philips
RC-5 protocol. Each key code consists of a five-bit system code and a six-bit command. This function
will always send the key code once at the specified modulation frequency (30, 38 or 56 kHz), followed by
the specified number of repeats.
Once the IR Buddy begins transmitting the key code, it will pull the serial line low to indicate its busy
state. This line can be monitored by the BASIC Stamp to prevent resetting the IR Buddy or otherwise
disrupting a transmission in progress.
Parallax, Inc. • IR Buddy Demo Kit (#28016) • 11/2002 Page 4
Example:
TX_Code:
SEROUT pin, baud, [$74, 0, 38, system, command]
PAUSE 5
TX_Wait:
IF (Ins.LowBit(pin) = 0) THEN TX_Wait
This example will cause the IR Buddy to send a single key code (specified in system and command) at
the modulation frequency of 38 kilohertz. The SEROUT command is followed by a short PAUSE to give
the IR Buddy time to pull the serial line low to indicate the its state. The next line of code will monitor
the serial line, waiting for it to go high before continuing with the rest of the program.
$44 Transmit 8-Byte Data Packet
Use: SEROUT pin, baud, [$44, modulation, byte0, byte1, byte2, byte3, byte4,
byte5, byte6, byte7]
pin variable or constant value: 0 to 15
baud variable or constant value for 2400, 4800 or 9600 baud; open-mode
modulation variable or constant value: 30, 38 or 56; IR modulation frequency in kilohertz
bytes variable or constant values: 0 to 255; 8-byte packet
This command directs the IR Buddy to transmit an eight-byte data packet to a companion IR Buddy using
the specified modulation frequency. Note that the transmission scheme is designed for reliability under
harsh conditions and can take approximately 25 milliseconds per byte to transmit.
As above, the BASIC Stamp can monitor the serial line to determine the end of the transmission process.
Example:
TX_Packet:
SEROUT pin, baud, [$44, 38, STR buffer\8]
PAUSE 5
TX_Wait:
IF (Ins.LowBit(pin) = 0) THEN TX_Wait
This example transmits the eight-byte array called buffer at a modulation frequency of 38 kilohertz to a
companion IR Buddy and BASIC Stamp.
$64 Receive/Transfer 8-Byte Data Packet
Use: SEROUT pin, baud, [$64]
pin variable or constant value: 0 to 15
baud variable or constant value for 2400, 4800 or 9600 baud; open-mode
This command directs the IR Buddy to receive and buffer an 8-byte data packet. It is also used to signal
the transfer of any data that has been buffered. This command is followed by a SERIN function.
Parallax, Inc. • IR Buddy Demo Kit (#28016) • 11/2002 Page 5
Example:
SEROUT pin, baud, [$64]
SERIN pin, baud, 1000, TO_Error, [STR buffer\8]
The first line above puts the IR Buddy in 8-byte receive/transfer mode and will initiate a transfer of any
buffered data. Since the transfer will not take place until eight bytes have been received, the SERIN
command that follows should use a timeout period and label to allow the BASIC Stamp program to
proceed while waiting for data.
When data is available, it will be transferred to the BASIC Stamp in the eight-byte array called buffer.
$4C Loopback Test Mode
Use: SEROUT pin, baud, [$4C, holdoff]
pin variable or constant value: 0 to 15
baud variable or constant value for 2400, 4800 or 9600 baud; open-mode
holdoff variable or constant value: 0 to 255 ms; RX/TX delay and data byte
This function tests the serial connection between the BASIC Stamp and the IR Buddy. It is particularly
useful when the connection is over a long wire run, especially in an electrically-noisy environment. The
Loopback test can be used to establish the highest error-free baud rate between the BASIC Stamp and
the IR Buddy.
The BASIC Stamp should expect four bytes returned at the transmission baud rate after a delay specified
in holdoff. The first two bytes are the holdoff value, the third should be 254, the fourth 255.
Example:
SEROUT pin, baud, [$4C, holdoff]
SERIN pin, baud, 300, TO_Error, [STR buffer\4]
If, for example, the value 127 is sent in the holdoff parameter, the BASIC Stamp should expect the
following packet to arrive after approximately 127 milliseconds:
127 127 254 255
Resetting The IR Buddy
Before using the IR Buddy or when switching modes, it is important to reset its controller. This process is
also useful to clear any buffered data. To reset the IR Buddy, take the serial line low for at least five
milliseconds, then place it in an input mode for at least 50 milliseconds to allow the reset operation of
complete.
Example:
LOW pin
PAUSE 5
INPUT pin
PAUSE 50
Parallax, Inc. • IR Buddy Demo Kit (#28016) • 11/2002 Page 6
IR Buddy Application: RC-5 Reception and Display
This application demonstrates the reception and decoding of RC-5 key codes from a (Philips or
compatible) consumer electronics remote control. It is useful for mapping key values from the remote for
use in control projects.
The program puts the IR Buddy into RC-5 receive mode then retrieves buffered key codes for display.
Note that the program checks for and indicates End-of-Buffer and Repeated Key values. A PAUSE value
of 1000 milliseconds between IR Buddy access requests simulates normal program activity and will
demonstrate the IR Buddy's ability to buffer multiple key code data.
Connect the IR Buddy to the BASIC Stamp as shown if Figure 1.
' -----[ Title ]----------------------------------------------------------------
'
' IRB RC-5 Monitor.BS2
' {$STAMP BS2}
' -----[ I/O Definitions ]------------------------------------------------------
IRbSIO CON 15 ' IR Buddy serial I/O
' -----[ Constants ]------------------------------------------------------------
IRbRc5Rx CON $72 ' RC-5 protocol RX
IRb96 CON 84 + $8000 ' 9600 baud, open
IRb48 CON 188 + $8000 ' 4800 baud, open
IRb24 CON 396 + $8000 ' 2400 baud, open
IRbBaud CON IRb96
KeyRpt CON 253 ' repeated key
BufEnd CON 254 ' end of buffer
CrsrXY CON 2 ' DEBUG position command
ClrEOL CON 11 ' Clear DEBUG line to right
' -----[ Variables ]------------------------------------------------------------
buffer VAR Byte(8) ' RC-5 RX buffer
idx VAR Byte ' loop counter
' -----[ Initialization ]-------------------------------------------------------
Setup:
GOSUB IR_Buddy_Reset
PAUSE 250 ' let DEBUG window open
DEBUG CLS
DEBUG "IR Buddy RC-5 RX Monitor", CR
DEBUG "------------------------", CR
DEBUG CR
FOR idx = 0 TO 3
Parallax, Inc. • IR Buddy Demo Kit (#28016) • 11/2002 Page 7
DEBUG "System.... ", CR
DEBUG "Command... ", CR
NEXT
' -----[ Program Code ]---------------------------------------------------------
Main:
SEROUT IRbSIO, IRbBaud, [IRbRc5Rx, 10] ' start RC-5 RX
SERIN IRbSIO, IRbBaud, [STR buffer\8\255] ' get data
Show_Buffer:
FOR idx = 0 TO 7
DEBUG CrsrXY, 11, (idx + 3) ' move to display line
DEBUG DEC buffer(idx) ' display buffer value
IF (buffer(idx) = BufEnd) THEN End_Of_Buffer
IF (buffer(idx) = KeyRpt) THEN Repeated_Key
DEBUG ClrEOL ' clear old message
NEXT
GOTO Loop_Pad
End_Of_Buffer:
DEBUG " (End of Buffer)"
GOTO Clear_Old_Data
Repeated_Key:
DEBUG " (Repeated Key)"
Clear_Old_Data:
idx = idx + 1 ' point to next line
IF (idx > 7) THEN Loop_Pad ' done?
DEBUG CrsrXY, 11, (idx + 3), ClrEOL ' no; move to line & clear it
GOTO Clear_Old_Data
Loop_Pad:
PAUSE 1000 ' simulate program activity
GOTO Main
END
' -----[ Subroutines ]----------------------------------------------------------
' Reset the IR Buddy. This code is useful for clearing data from the RX
' buffer and prepping to switch modes. Timing specific; do not change.
IR_Buddy_Reset:
LOW IRbSIO ' signal reset
PAUSE 5
INPUT IRbSIO ' release reset signal
PAUSE 50 ' allow time for reset actions
RETURN
Parallax, Inc. • IR Buddy Demo Kit (#28016) • 11/2002 Page 8
IR Buddy Application: RC-5 Reception / Device Control
This application demonstrates the use of the IR Buddy and BASIC Stamp as a device controller. Signals
are accepted from a (Philips or compatible) consumer electronics remote control and converted to
appropriate channel control commands. For the demonstration program, LEDs are used to indicate the
state of each control output.
The program will control four devices (outputs) using numeric buttons [1] though [4] on the remote.
The [Mute] button is used to turn all outputs off. The system code for the program has been set to
zero, the typical value used for television control.
' -----[ Title ]----------------------------------------------------------------
'
' IRB RC-5 Control.BS2
' {$STAMP BS2}
' -----[ I/O Definitions ]------------------------------------------------------
IRbSIO CON 15 ' IR Buddy serial I/O
Ports VAR OutA ' LED / device control pins
Port1 CON 0
Port2 CON 1
Port3 CON 2
Port4 CON 3
' -----[ Constants ]------------------------------------------------------------
IRbRc5Rx CON $72 ' RC5 protocol RX
IRb96 CON 84 + $8000 ' 9600 baud, open
IRb48 CON 188 + $8000 ' 4800 baud, open
IRb24 CON 396 + $8000 ' 2400 baud, open
IRbBaud CON IRb96
BufEnd CON 254 ' end of buffer
System CON 0 ' system code for this Stamp
On CON 1
Off CON 0
AllOff CON 13 ' "Mute" key on Philips remote
Parallax, Inc. • IR Buddy Demo Kit (#28016) • 11/2002 Page 9
' -----[ Variables ]------------------------------------------------------------
buffer VAR Byte(8) ' RC-5 RX buffer
idx VAR Nib ' loop counter
sysCode VAR Byte ' received system code
cmdCode VAR Byte ' received command code
' -----[ Initialization ]-------------------------------------------------------
Setup:
Ports = Off ' all outputs off
DirA = %1111 ' all ports are outputs
GOSUB IR_Buddy_Reset
' -----[ Program Code ]---------------------------------------------------------
Main:
SEROUT IRbSIO, IRbBaud, [IRbRc5Rx, 10] ' start RC-5 RX
SERIN IRbSIO, IRbBaud, [STR buffer\8\255] ' get data
Process_Commands:
FOR idx = 0 TO 6 STEP 2
sysCode = buffer(idx) ' extract system code
IF (sysCode = BufEnd) THEN Loop_Pad ' reached end of buffer
IF (sysCode <> System) THEN Skip_Key ' check for valid system code
cmdCode = buffer(idx + 1) ' extract command
Check_All_Off:
IF (cmdCode <> AllOff) THEN Check_Toggle
Ports = Off ' all outputs off
Check_Toggle:
IF (cmdCode = 0) OR (cmdCode > 4) THEN Skip_Key
TOGGLE (cmdCode -1)
Skip_Key:
NEXT
Loop_Pad:
PAUSE 500 ' give IR Buddy time to work
GOTO Main
END
' -----[ Subroutines ]----------------------------------------------------------
' Reset the IR Buddy. This code is useful for clearing data from the RX
' buffer and prepping to switch modes. Timing specific; do not change.
IR_Buddy_Reset:
LOW IRbSIO ' signal reset
PAUSE 5
INPUT IRbSIO ' release reset signal
PAUSE 50 ' allow time for reset actions
RETURN
Parallax, Inc. • IR Buddy Demo Kit (#28016) • 11/2002 Page 10
IR Buddy Application: Intelligent Beam-Break Detection
This application uses two IR Buddies and a BASIC Stamp to form an intelligent IR beam-break detector as
might be used in an alarm system. The first IR Buddy sends a coded message to the second. If the
second does not receive the message properly, an error is generated. If enough errors accumulate, an
alarm output in enabled. Performance can be improved by shielding the IR Buddies from extraneous IR
sources.
The use of the error accumulator allows the system to work in and be fine-tuned for IR-noisy
environments. The use of random coded message prevents defeat –even from a duplicate circuit
because the extreme difficulty of synchronizing the counterfeit circuit with transmit IR Buddy.
' -----[ Title ]----------------------------------------------------------------
'
' IRB Beam Break.BS2
' {$STAMP BS2}
' -----[ I/O Definitions ]------------------------------------------------------
IRbTX CON 15 ' transmitter IRB
IRbRX CON 14 ' receiver IRB
AlarmLED CON 0
' -----[ Constants ]------------------------------------------------------------
IRbRc5Tx CON $74 ' RC-5 protocol TX
IRbRc5Rx CON $72 ' RC-5 protocol RX
IRbMod CON 38 ' modulation freq: 30, 38 or 56
IRb96 CON 84 + $8000 ' 9600 baud, open
IRb48 CON 188 + $8000 ' 4800 baud, open
IRb24 CON 396 + $8000 ' 2400 baud, open
IRbBaud CON IRb96