■ FIGURE 2. IR output.
interface, timing, etc.) into an SX28.
The one thing that my camera doesn't have is a
manual control port — not a physical port, anyway. It does,
however, have an IR port and a small remote that allows
me to take pictures. Using January's project (SIRCS
"sniffer"), I was able to determine the 12-bit SIRCS codes
that the remote sends. The chore for this project, then, is
to send the command that corresponds to the shutter
button at the interval of my choosing. In addition to the
SIRCS output, I'm going to add a couple open-collector
outputs — just in case I want to control other devices later.
After determining the code and building it into a little
test program, I got absolutely bupkis from the camera
when transmitting the 12-bit SIRCS code. On the thought
that the remote may be sending a sequence of codes, I
connected the IR receiver output to a scope and boy was
I surprised! The camera remote wasn't sending 12-bit
codes at all. It was sending 20-bit codes!
I'd heard about 20-bit SIRCS codes but this is the
first time I actually ran into them. In Figure 1, you can see
the captured output of my camera remote when pressing
the shutter button; it sends the same 20-bit code five
After a half day of Google-ing, I was never able to
come up with a specification for the 20-bit SIRCS code
but there was the suggestion that the 20-bit code used an
eight-bit device code and a 12-bit command code. I
updated the SIRCS sniffer code for 20 bits and used a
Sony DVD remote to confirm this.
Last time, we dealt with receiving the SIRCS stream
which was pretty easy because it is simply a matter of
accepting pulses from a standard IR detector. Transmitting
isn't very complicated, but it's not just a matter of sending
out a pulse stream; we also have to modulate the IR LED.
In order to keep everything in one chip, I decided to
connect both leads of the LED directly to the SX and use
one of them (the cathode) as the modulation source; this
needs to be 40 kHz. Keeping with the KISS philosophy,
I set the interrupt to run at 80 kHz and then toggle
the cathode through each pass to create the proper
The top of the ISR looks like this:
INTERRUPT NOPRESERVE 80_000
isrFlag = 1
IrLedK = ~IrLedK
As with other programs, we set a bit called isrFlag at
the top of the ISR; this is used by the foreground code for
timing when needed. The modulation signal to the LED is
simply a matter of inverting the output signal to the
cathode. As this pin gets inverted 80,000 times a second,
we end up with a modulation signal of 40 kHz with a
duty cycle of 50 percent.
If you look at Figure 2, you'll see that both sides of the
IR LED are tied to SX pins. The cathode pin provides the
modulation and the anode gates the LED on and off. By
making the anode pin high, the LED will be on whenever
the cathode side is low. When the anode side is low, the
LED will always be off, no matter what is happening on
the cathode side.
Now that we can modulate the IR LED, we just have
to create a control stream to the anode side to generate
the SIRCS output. You'll remember that the SIRCS signal
has a 2.4 millisecond start bit, "1" bits are 1.2 milliseconds
wide, and "0" bits are 0.6 milliseconds wide — and every
bit is spaced by a 0.6 millisecond off-time.
With the ISR running at 80 kHz, we can't use
or PAUSEUS so we'll need to create a set of custom routines. With the isrFlag, we're able to create sub-millisecond
timing; this is done with the DELAY_TIX subroutine:
March 2009 17