sirc

SIRC library for decoding and encoding SIRC protocol

Author Mike Reynolds, Copyright © 2009, all rights reserved.
Adapted-by
Compiler >=2.4l

Description

this library provides functions for sending and receiving SIRC
infrared remote control codes



SIRC infrared remote control codes
SIRC is widely used protocol for consumer entertainment devices
such as TV's, VCR's, DVD players, Hi-Fi receivers, etc
SIRC is found in 12-bit, 15-bit, 20- bit versions
This decoder is for the 12-bit version



12-bit SIRC is comprised of a pulse-width modulated bit stream
with 5 address bits and 7 data bits. A logical 1 is represented
by a 1.2 mS burst of the 40 khz carrier, whereas a logical 0
is represented by a 0.6 mS burst of the carrier.



The data stream is preceeded by a start burst 2.4 mS in duration
of the 40 khz carrier and then the data is sent LSB first with the
command preceeding the address. Commands are repeated every 45 mS
(measured from start to start) as long as the button is pressed.


Sources

http://www.sbprojects.com/knowledge/ir/sirc.htm
http://www.ustr.net/infrared/sony.shtml
http://web.archive.org/web/20071212170236/http://www.geocities.com/CapeCanaveral/Launchpad/4652/sircs.htm


Notes



**************************************************************************
**************************************************************************
*****                                                                *****
***** In your user code you must define whether you are building     *****
***** a transmitter or receiver so that the correct procedures       *****
***** will be included .                                             *****
*****                                                                *****
***** To define a transmitter:                                       *****
*****  const SIRC_transmitter = 1                                    *****
*****  const SIRC_receiver    = 0                                    *****
*****                                                                *****
***** To define a receiver:                                          *****
*****  const SIRC_receiver    = 1                                    *****
*****  const SIRC_transmitter = 0                                    *****
***** You must declare  either an input or output pin and direction  *****
***** such as var bit sirc_pulse_in is pin_B0                             *****
***** or var bit IR_pulse_out is pin_B1                              *****
*****                                                                *****
**************************************************************************
**************************************************************************



Some example Device and Command codes
Device ID Code
1      TV
2      VTR1
4      VTR2
6      laserdisk
7      VTR2
11     VTR3
12     Surround Sound Processor
18     Equalizer
16     Cassette Deck and Tuner
17     CD Player
164    TV digital effects (note 8 bit device code)



Commnad (Button) Codes for TV
value  function               value   function
000    1 button                021    Power
001    2 button                022    Reset TV
002    3 button                023    Audio Mode:Mono/SAP/Stereo
003    4 button                024    Picture up
004    5 button                025    Picture down
005    6 button                026    Color up
006    7 button                027    Color down
007    8 button                030    Brightness up
008    9 button                031    Brightness down
009    10 button/0 button      032    Hue up
011    Enter                   033    Hue down
016    channel up              034    Sharpness up
017    channel down            035    Sharpness down
018    volume up               036    Select TV tuner
019    volume down             038    Balance Left
020    Mute                    039    Balance Right


 
041    Surround on/off         094    PIP position
042    Aux/Ant                 095    PIP swap
047    Power off               096    Guide
048    Time display            097    Video setup
054    Sleep Timer             098    Audio setup
058    Channel Display         099    Exit setup
059    Channel jump            107    Auto Program
064    Select Input Video1     112    Treble up
065    Select Input Video2     113    Treble down
066    Select Input Video3     114    Bass up
074    Noise Reduction on/off  115    Bass down
078    Cable/Broadcast         116    + key
079    Notch Filter on/off     117    - key
088    PIP channel up          120    Add channel
089    PIP channel down        121    Delete channel
091    PIP on                  125    Trinitone on/off
092    Freeze screen           127    Displays a red RtestS on the screen



Command (Button) Codes for VCR
Buttons 1 - 0 (10) have same value as TV buttons
value   function                 value  function
010 11 button                    035    X 1/5 play
011 12 button                    040    reverse visual scan
012 13 button                    041    forward visual scan
013 14 button                    042    TV/VTR
020 X 2 play w/sound             045    VTR from TV
021 power                        047    power off
022 eject                        048    single frame reverse/slow reverse play
023 L-CH/R-CH/Stereo             049    single frame advance/slow forward play
024 stop                         060    aux
025 pause                        070    counter reset
026 play                         078    TV/VTR
027 rewind                       083    index (scan)
028 FF                           106    edit play
029 record                       107    mark
032 pause engage



Variable descriptions:
sirc_addr_rx  =  address received from IR transmitter
sirc_cmd_rx   =  command received from IR transmitter
sirc_addr_tx  =  address to be transmitted
sirc_cmd_tx   =  command to be transmitted
IR_pulse_out  =  processor pin that IR pulse will be output on
*** IR_pulse_out MUST be declared by user as an output and set low such as ***
var bit sirc_pulse_out is pin_B0
pin_B0_direction = output
sirc_pulse_out = low



sirc_pulse_in     =  processor pin that will connect to IR receiver
*** sirc_pulse_in MUST be declared by user as an input such as ***
var bit sirc_pulse_in is pin_B1
pin_B1_direction = input



**********************************************************************
**********************************************************************
***** In your user code you must define whether you are building *****
***** a transmitter or receiver so that the correct procedures   *****
***** will be included .                                         *****
***** To define a transmitter use const SIRC_transmitter = 1     *****
***** To define a receiver use const SIRC_receiver = 1           *****
**********************************************************************
**********************************************************************


Dependencies

No dependency found



Summary

Global variables/contants

Procedures

Functions


API details

Global variables/contants

Procedures

Functions


Related samples

Here are the list of samples which use this library:

16f648a16f648a_sirc.jal
16f72316f723_sirc.jal
16f7316f73_sirc.jal
16f87716f877_sirc.jal
16f877a16f877a_sirc.jal
16f8816f88_sirc.jal
18f245018f2450_sirc.jal
18f252018f2520_sirc.jal
18f255018f2550_sirc.jal
18f262018f2620_sirc.jal
18f45218f452_sirc.jal
18f455018f4550_sirc.jal
18f462018f4620_sirc.jal
18f67j5018f67j50_sirc.jal