├── .DS_Store ├── .gitignore ├── LANC Documenation ├── .DS_Store ├── .lanc.c.swp ├── lanc.htm ├── lanc_files │ ├── 0.gif │ ├── bg2.gif │ ├── cnt.gif │ ├── cou_0.gif │ ├── flagdt.gif │ ├── flaguk.gif │ ├── i.gif │ ├── l_protoc.gif │ ├── lanc.gif │ ├── lanc_kli.gif │ ├── lanc_min.gif │ ├── legend.gif │ ├── mailtext.gif │ └── styles.css └── sony_lanc.html ├── LANC_REMOTE copy.png ├── LANC_REMOTE.png └── Lanc_remote2.ino /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fred-dev/arduino_lanC/b09e9648a138b70071ff6021e83a49a51ab31f64/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.zip 2 | *.mov 3 | *.jpg 4 | *.jxml 5 | 6 | *.app/ 7 | *.o 8 | *.exe 9 | .DS_Store -------------------------------------------------------------------------------- /LANC Documenation/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fred-dev/arduino_lanC/b09e9648a138b70071ff6021e83a49a51ab31f64/LANC Documenation/.DS_Store -------------------------------------------------------------------------------- /LANC Documenation/.lanc.c.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fred-dev/arduino_lanC/b09e9648a138b70071ff6021e83a49a51ab31f64/LANC Documenation/.lanc.c.swp -------------------------------------------------------------------------------- /LANC Documenation/lanc.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fred-dev/arduino_lanC/b09e9648a138b70071ff6021e83a49a51ab31f64/LANC Documenation/lanc.htm -------------------------------------------------------------------------------- /LANC Documenation/lanc_files/0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fred-dev/arduino_lanC/b09e9648a138b70071ff6021e83a49a51ab31f64/LANC Documenation/lanc_files/0.gif -------------------------------------------------------------------------------- /LANC Documenation/lanc_files/bg2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fred-dev/arduino_lanC/b09e9648a138b70071ff6021e83a49a51ab31f64/LANC Documenation/lanc_files/bg2.gif -------------------------------------------------------------------------------- /LANC Documenation/lanc_files/cnt.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fred-dev/arduino_lanC/b09e9648a138b70071ff6021e83a49a51ab31f64/LANC Documenation/lanc_files/cnt.gif -------------------------------------------------------------------------------- /LANC Documenation/lanc_files/cou_0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fred-dev/arduino_lanC/b09e9648a138b70071ff6021e83a49a51ab31f64/LANC Documenation/lanc_files/cou_0.gif -------------------------------------------------------------------------------- /LANC Documenation/lanc_files/flagdt.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fred-dev/arduino_lanC/b09e9648a138b70071ff6021e83a49a51ab31f64/LANC Documenation/lanc_files/flagdt.gif -------------------------------------------------------------------------------- /LANC Documenation/lanc_files/flaguk.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fred-dev/arduino_lanC/b09e9648a138b70071ff6021e83a49a51ab31f64/LANC Documenation/lanc_files/flaguk.gif -------------------------------------------------------------------------------- /LANC Documenation/lanc_files/i.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fred-dev/arduino_lanC/b09e9648a138b70071ff6021e83a49a51ab31f64/LANC Documenation/lanc_files/i.gif -------------------------------------------------------------------------------- /LANC Documenation/lanc_files/l_protoc.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fred-dev/arduino_lanC/b09e9648a138b70071ff6021e83a49a51ab31f64/LANC Documenation/lanc_files/l_protoc.gif -------------------------------------------------------------------------------- /LANC Documenation/lanc_files/lanc.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fred-dev/arduino_lanC/b09e9648a138b70071ff6021e83a49a51ab31f64/LANC Documenation/lanc_files/lanc.gif -------------------------------------------------------------------------------- /LANC Documenation/lanc_files/lanc_kli.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fred-dev/arduino_lanC/b09e9648a138b70071ff6021e83a49a51ab31f64/LANC Documenation/lanc_files/lanc_kli.gif -------------------------------------------------------------------------------- /LANC Documenation/lanc_files/lanc_min.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fred-dev/arduino_lanC/b09e9648a138b70071ff6021e83a49a51ab31f64/LANC Documenation/lanc_files/lanc_min.gif -------------------------------------------------------------------------------- /LANC Documenation/lanc_files/legend.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fred-dev/arduino_lanC/b09e9648a138b70071ff6021e83a49a51ab31f64/LANC Documenation/lanc_files/legend.gif -------------------------------------------------------------------------------- /LANC Documenation/lanc_files/mailtext.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fred-dev/arduino_lanC/b09e9648a138b70071ff6021e83a49a51ab31f64/LANC Documenation/lanc_files/mailtext.gif -------------------------------------------------------------------------------- /LANC Documenation/lanc_files/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family:Arial,Helvetica,sans-serif; 3 | font-size:14; 4 | line-height:14pt; 5 | color:#000000; 6 | background-color:#ffffff; 7 | } 8 | table { 9 | font-size:14; 10 | line-height:14pt; 11 | } 12 | .legend { 13 | font-size:10; 14 | line-height:normal; 15 | } 16 | .font2 { 17 | font-size:12; 18 | line-height:normal; 19 | } 20 | h1 { 21 | font-size:28; 22 | line-height:normal; 23 | } 24 | h2 { 25 | font-size:22; 26 | } 27 | h3 { 28 | font-size:16; 29 | } 30 | a:link { 31 | color:#000060; 32 | text-decoration:none; 33 | } 34 | a:visited { 35 | color:#400060; 36 | text-decoration:none; 37 | } 38 | a:active { 39 | color:#801010; 40 | text-decoration:underline; 41 | } 42 | a:hover { 43 | color:#707070; 44 | text-decoration:underline; 45 | } 46 | a:focus { 47 | color:#404040; 48 | text-decoration:underline; 49 | } 50 | -------------------------------------------------------------------------------- /LANC Documenation/sony_lanc.html: -------------------------------------------------------------------------------- 1 | Miscellaneous bits on Sony LANC 2 |

The Sony Control-L LANC Protocol

3 |
4 |

I have been collecting info on LANC for several years. Below is a 5 | collection of what I have for your files.

6 | 7 |
8 |
=======================================================================
  9 |       A small hardware Summary of the SONY LANC Control L Protocol
 10 |                October 27, 1994  (dmeed@nbnet.nb.ca)
 11 | =======================================================================
 12 | 
 13 |   For the inside scoop on the Sony LANC Control L order the Protocol
 14 | manual for Control L/Lf from Sony.  I ordered it from:
 15 | 
 16 |      Sony Service Company
 17 |      Parts Division
 18 |      8281 NW 107th Terrace
 19 |      Kansas City, MO 64153
 20 |      (816) 891-7550
 21 | 
 22 |      Part # 9-972-453-11   "Protocol of Control L/LF"
 23 | 
 24 |   You get to find out where to order it in your country, but I'm sure
 25 | they will send you a copy from the address above if you give them a
 26 | call.  About $20US or so (but don't quote me!)  (Somebody let me know
 27 | if they do manage to get it from the US overseas.)
 28 | 
 29 |   Control L is a two-way serial open collector 9600 baud protocol.
 30 | Cameras (control-L) use a three pin sub-mini jack that has ground on
 31 | the sleeve, power (up to 100ma unregulated 5-9v) at the tip and LANC
 32 | signal on the ring.
 33 | 
 34 |   VCRs with the five pin mini-DIN connector have DC out on pin 1,
 35 | LANC bus on pin 4 and GND on pin 5.  Pin 3 may be a power switch line
 36 | (ground to switch power on and off) and pin 2 may put out a square wave
 37 | locked to the video frames.  (pins 2 & 3 are optional, not used on
 38 | consumer equipment.)
 39 | 
 40 |   The LANC bus is open collector so it is normally pulled high to about
 41 | 5v and is pulled low to send commands or status information. You can
 42 | hook the LANC signal directly to the input of a 1488 RS232 line driver
 43 | and feed that into your PC serial port and capture the 9600 baud data
 44 | stream.  It will have to be inverted before you use it (00 will read as
 45 | FF).
 46 | 
 47 |   The data stream is 8 bytes, then a gap (1.7ms? until the end of the
 48 | current frame) then 8 bytes for the next frame, another gap and so on.
 49 | If you can write your serial driver to sync to that gap you can read it
 50 | easily.  I wrote a program in modula 2 to display the signal, but I
 51 | don't know enough about PC timing to detect that gap in the data
 52 | stream.
 53 | 
 54 | The camcorder puts out an 8 byte data packet with each video frame.
 55 | The first two bytes are for controllers to command the camera and are
 56 | usually 00 00. The next two are for tuners and are also usually 00 00.
 57 | The last four bytes are for the VCR status and carry the counter and
 58 | several other status bits.
 59 | 
 60 |   Reading is the easy part . .  .
 61 | 
 62 |   To send a command you have to wait until you detect the start bit of
 63 | the first byte in a frame then impose your signal on the LANC line
 64 | (remember it is open collector and inverted, so 00 is all high - you
 65 | just pull low for your command bits). I haven't the foggiest how to
 66 | send a byte on the serial port in response to an external start bit.  I
 67 | think you might almost have to bit bang it in software.  Wouldn't be
 68 | bad - only need to send 2 bytes in each frame. Oh yeah - and in at
 69 | least 5 consecutive frames to make sure the VCR hears and understands
 70 | your command.
 71 | 
 72 | I've got a Sony RM95 wired remote here.  These are the codes I see by 
 73 | pressing the buttons on the remote and eavesdropping on the LANC line
 74 | with a PC @9600 baud.
 75 | 
 76 |  Button on remote    Code sent on bytes 1 & 2
 77 |  ================    ========================
 78 |  (these buttons work in camera mode)
 79 |      Zoom tele            28 35
 80 |      Zoom wide            28 37
 81 |      focus                28 41 (toggle between manual and autofocus)
 82 |      focus farther        28 45
 83 |      focus closer         28 47
 84 |      start/stop rec       18 33
 85 |      edit search -        18 65
 86 |      edit search +        18 67
 87 |      rec review           18 69
 88 |      power                18 5E
 89 | 
 90 |   (these buttons work in VTR mode)
 91 |      stop                 18 30
 92 |      pause                18 32
 93 |      play                 18 34
 94 |      rewind               18 36
 95 |      fast forward         18 38
 96 |      record               18 3A
 97 |      slow                 18 46
 98 |      frame advance        18 62
 99 |      counter reset        18 8C
100 |      data screen          18 B4
101 | 
102 | I'm looking for the codes for slow zoom, fade, index, and all the other
103 | goodies on the side of my V101 camera.  Would be nice to be able to
104 | press those buttons without having to touch the camera jiggle jiggle).
105 | If you find them please let me know.  You could always try sending
106 | all the possibilities and see what you get...
107 | 
108 | 
109 | Update - 95/07
110 | I've just managed to write a simple program for the PIC16C84 processor
111 | which will control a camcorder remotely - Sort of a homemade version of
112 | the RM100 remote control
113 | 
114 | David Meed       dmeed@nbnet.nb.ca
115 | 
116 | =======================================================================
117 | Additional Resources (haven't been there to check it out yet):
118 | >>LANC info can be found in the file collection of the Amer. Soc. of
119 | >>Reverse Engineers.  It can be accessed via ftp to tracker.vet.uga.edu.
120 | >>The files are in the /pub/asre directory.  In addition to several files
121 | >>on LANC, they have a file on the VCRPLUS protocol.
122 | >>
123 | >>Dave Dunfield has some files on LANC in association with his DBOX project
124 | >>(a do-it-yourself LANC controller).  His files are on his BBS at
125 | >>613-256-6289.
126 | =======================================================================
127 | And the rest is some stuff I was sent from "NEIL HIGGINS, SEQEB" 
128 | 
129 | =======================================================================
130 | 
131 | 
132 | Xref: un rec.video:39939
133 | Path: un!bunyip.cc.uq.oz.au!munnari.oz.au!spool.mu.edu!howland.reston.ans.net!europa.eng.gtefsd.com!news.umbc.edu!haven.umd.edu!purdue!mozo.cc.purdue.edu!pasture.ecn.purdue.edu!laird
134 | From: laird@pasture.ecn.purdue.edu (Kyler Laird)
135 | Newsgroups: rec.video
136 | Subject: Re: LANC Protocol
137 | Date: 29 Sep 1994 01:23:10 GMT
138 | Organization: Purdue University
139 | Lines: 852
140 | Message-ID: <36d4tu$buq@mozo.cc.purdue.edu>
141 | References: 
142 | NNTP-Posting-Host: pasture.ecn.purdue.edu
143 | X-Newsreader: NN version 6.5.0 (NOV)
144 | 
145 | nh007@un.seqeb.gov.au ( NEIL HIGGINS) writes:
146 | 
147 | >Can anyone direct me to a specification for the LANC protocol, used for
148 | >edit control, etc. on Sony cameras? The local rep. tells me the protocol
149 | >specification is not available. I find that hard to believe.
150 | 
151 | Reps can be so full of it, can't they...
152 | 
153 | Here's the unedited brain dump.
154 | 
155 | --kyler
156 | 
157 | 
158 | Xref: noose.ecn.purdue.edu comp.multimedia:6121 comp.sources.wanted:14178 comp.sys.amiga.multimedia:2644
159 | Path: noose.ecn.purdue.edu!mentor.cc.purdue.edu!purdue!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!sdd.hp.com!portal!cup.portal.com!DonD
160 | From: DonD@cup.portal.com (Don Robert DeCosta)
161 | Newsgroups: comp.multimedia,comp.sources.wanted,comp.sys.amiga.multimedia
162 | Subject: Re: sony Control-L documentation
163 | Message-ID: <78191@cup.portal.com>
164 | Date: Wed, 24 Mar 93 22:37:07 PST
165 | Organization: The Portal System (TM)
166 | References:  
167 | Lines: 759
168 | 
169 | >Does anyone have any information on where I can get documentation for the
170 | >SONY (I guess) control-L protocol for talking to VCRs, camcorders, etc.?
171 | >
172 | 
173 | Greeting LANC fans,
174 | 
175 | I just went through this back in September... Here's the repsonses
176 | I got.
177 | 
178 | 
179 | Don DeCosta           |The nice thing about sanity is|  VM/Nomad2
180 | DonD@cup.portal.com   |you can lose it more than once|  Amiga/Imagine
181 | ==========================================================================
182 | ==========================================================================
183 | ==========================================================================
184 | =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
185 | 
186 | You can try to get information from Sony although there is little chance
187 | to get an up-to-date specification.
188 | 
189 | You can also find some partial information on mrcnext.cso.uiuc.edu from
190 | someone who made a Control-L interface.
191 | 
192 | Regards,
193 | --
194 | Michael van Elst
195 | UUCP:     universe!local-cluster!milky-way!sol!earth!uunet!unido!mpirbn!p554mve
196 | Internet: p554mve@mpirbn.mpifr-bonn.mpg.de
197 |                                 "A potential Snark may lurk in every tree."
198 | ==========================================================================
199 | 
200 | 
201 | What kind of system are you working on?
202 | 
203 | I have a Mac with some Hypercard XCMDs of a company called Video Production
204 | Controls.
205 | Control L is essentially a 9600 baud serial line with an external (ie.
206 | dictated by the VCR) clock.  This means reading is easy: just a rs-232
207 | 9600 baud hookup works, writing commands is harder because you will have
208 | to 'clock in' to the VCR.
209 | 
210 | Sony provided me with lists with all the codes.
211 | I would send if I had them here.
212 | 
213 | Lex van Sonderen
214 | lex@aimla.com
215 | 
216 | 
217 | ==========================================================================
218 | ~Date: Tue, 15 Sep 92 17:28:07 PDT
219 | ~From: jphealy@luna.dpl.scg.hac.com (John P. Healy)
220 | Message-Id: <9209160028.AA07356@luna.DPL.SCG.HAC.COM>
221 | To: DonD@cup.portal.com
222 | ~Subject: Re: Sony LANC/Control L
223 | ~Newsgroups: comp.multimedia
224 | In-Reply-To: <65824@cup.portal.com>
225 | Organization: Hughes Aircraft Co., El Segundo, CA
226 | Cc:
227 | 
228 | Have you already looked at Mark Abbate's VideoTolkit? It may do
229 | everything you want (and more).
230 | 
231 | ==========================================================================
232 | Hi,
233 | 
234 | we are going to sell the Video Workshop, a PC based Video cut system,
235 | where you have a Sony Control L interface and a Panasonic 5 pin
236 | interface to control a player and a recorder VCR.
237 | It starts from 999.-DM and comes with the PC-Titler juniour program to
238 | generate titles during cuting.
239 | 
240 | Best regards Stefan Hartmann.
241 | email to: leo@zelator.in-berlin.de
242 | 
243 | 
244 | --
245 | 
246 | *************************************************************
247 | *  Stefan Hartmann       This is how to contact me:         *
248 | *  EMAIL: leo@zelator.in-berlin.de                          *
249 | *  Phone : ++ 49 30 344 23 66      FAX : ++ 49 30 344 92 79 *
250 | *************************************************************
251 | 
252 | ==========================================================================
253 | ======================== LANC1.txt =======================================
254 | ==========================================================================
255 | ~Date: Tue, 19 Feb 91 14:32:11 PST
256 | ~From: root@shuksan (Operator )
257 | Message-Id: <9102192232.AA13431@>
258 | ~Subject: control L code
259 | 
260 |  Hi there -- here is my C code and asm code for my camera
261 | control stuff.  It is uuencoded to keep the mailers happy
262 | (I hope).  The code is somewhat hardware dependant and is
263 | not the cleanest in the world (that is what you get when
264 | it "evolves" via a 'scope and bit fiddling!).  I am running
265 | a 10mhz AST 286 with a VGA monitor.  Feel free to do what
266 | you want with this code.  When figuring the loop timing, if
267 | you are using the assy ref. guide with TASM, the number of
268 | clocks shown for some instructions are NOT correct!  I discovered
269 | for example on some of the jump instructions, it lists for
270 | example 4 clocks - in reality, it is 4 clocks + the number
271 | of bytes in the following instruction .... just a slight
272 | difference!  The interface looks very sim. to the drawing
273 | in the ctl L manual (if you want, I will get it and describe 
274 | it for you --- I forgot it at home today!)
275 | 
276 | I will have my schematic in postscript form if you are interested.
277 | My schematic capture routine generates postscript for a plotter
278 | (I use a laserjet II with the Adobe ps cart.)
279 | 
280 | 
281 | Mikey (yes "he likes it!")
282 | =======================================================   Mike Fields
283 | ==>  uunet!bcstec!shuksan!mikey  (206) 657-6136 [work]    12022 NE 138th Pl.
284 | uw-beaver!ssc-vax!shuksan!mikey  (206) 821-3492 [home]    Kirkland, Wa. 98034
285 | 
286 | 
287 | 
288 | ==========================================================================
289 | ======================== LANC2.txt =======================================
290 | ==========================================================================
291 | 
292 |  
293 | 
294 | ~Subject: Control-L Info (was Re: LANC interface?)
295 | ~From: lindh@uhasun.hartford.edu (Andrew Lindh)
296 | Path: ux1.cso.uiuc.edu!moe.ksu.ksu.edu!zaphod.mps.ohio-state.edu!usc!apple!news
297 | .bbn.com!noc.near.net!uhasun!lindh
298 | ~Reply-To: lindh@uhasun.hartford.edu (Andrew Lindh)
299 | ~Newsgroups: rec.video
300 | Message-ID: <708@ultrix.uhasun.hartford.edu>
301 | ~References: <1991Sep17.172210.12851@gtc.com> <1991Sep17.234413.01054822@locus.c
302 | om> <1991Sep22.150545.11650@bilver.uucp>
303 | ~Date: 29 Sep 91 01:41:55 GMT
304 | 
305 | 
306 | I have a (old, 1986) copy of the Control-L protocol. It does talk about
307 | Beta and Video 8 (8mm), but NOT VHS. Here is some short info:
308 | 
309 | Pin     Color   Function
310 | 1       Red     DC OUT (5.9 to 9V DC 100mA)
311 | 2       White   Option CTL (Lf Mode ONLY)
312 |                 ________
313 | 3       Black   Power SW
314 | 4       Yellow  Serial Bus
315 | 5       Blue    Ground
316 | 
317 | The Bus Line is a bi-directional Serial line (Async 9600 baud/1 start bit
318 | 2 stop?) The start is syncronized with each FIELD and is 8 words (8 bits each)
319 | Pin 2 is not used in consumer units, it has to do with tape direction
320 | you don't need it....
321 | 
322 | There must always be a Commander and a Slave. A VTR or Camera is a 
323 | slave, a Computer, Editor, VTR (with built-in a Edit Controller) is
324 | a Commander. The commander uses the first 2 words to send commands
325 | and the last 6 are for returnned info.
326 | 
327 | But there are other setups:
328 | UNIT            WORDS
329 |                 0 1 2 3 4 5 6 7
330 | Console VTR     R R W W W W W W
331 | CTR with tuner  R R W W W W W W
332 | Portable VTR    R R R R W W W W
333 | Camcorder       R R R R W W W W
334 | AC Adapter      - - W W R R R R
335 | TT unit         - - W W R R R R
336 | Camera          A W B - R R R R A=R(Sometimes)/W B=R(sometimes)
337 | Editor          W W - - R R R R
338 | Computer        W W R R R R R R
339 | Remote          W W - - R R R R
340 | 
341 |         Word 0          Device Code (4 bits)/Guide Code (4)
342 |         Word 2          Device Code (4)/Guide Code
343 |         Word 1/3        Basic Command to VTR (8 bits)
344 |         Word 1/3        Command To Camera (8)
345 |         Word 3          TV channel (8)
346 |         Word 4          VTR Mode (8)
347 |         Word 5          VTR Status (4)/Guide Code (4)
348 |         Word 6          VTR Status
349 |         Word 7          VTR Status
350 |         Word 7          Insert Status
351 |         Word 6/7        4-digit counter
352 |         Word 6/7        Hour/Minute/Second
353 | 
354 | If you are connected from a computer to a VTR:
355 | Shorting 3 to ground turns the VTR off.
356 | Start bit is sent from the VTR
357 | First 2 words (0 and 1) are commands from the computer to the VTR
358 | the last 6 are from the VTR to the computer
359 |            
360 | 
361 |                      +5V
362 |                       |
363 |                       ~4.7K=VTR or 10K in other
364 |                       |        47k   /------INPUT
365 | pint 4--+------+--|<--+-->|-----~-+-|
366 |         |      |  signal diode    |  \>+
367 |         |      |                  |    |
368 |         _      |                  ~----+--G
369 |         ^      \         47k
370 |         |       |----+----~------OUTPUT
371 |         G     
388 | ~References: <1991Sep17.234413.01054822@locus.com> <3230@news.chips.com>
389 | ~Date: 1 Oct 91 15:33:08 GMT
390 | 
391 | >Uh, I have a Sony CCDV101 Hi8 Camcorder with control-L on a mini-phono jack...
392 | >Is this just the pin 4 serial bus?  Or is it a Tip-Ring(stereo mini) with
393 | >power or something else on the ring?
394 | 
395 | It's a Tip-Ring.  One is power and the other is the TTL level serial
396 | bus.  I don't remember which is which.  The power is the unregulated 6V
397 | power from the battery.
398 | 
399 | The serial signal is sending data at 9600 baud in a standard 1 start bit,
400 | 8 data bits, and 1 stop bit format.  To feed this into a standard RS-232
401 | port you just need an RS-232 level converter (and maybe an inverter?).
402 | The level converter needs +-12 volts, you you will also need an external
403 | power source.  Sending data back to the VCR is harder.
404 | 
405 | The serial line is normally high (+5V), the start bit is low (0V). The
406 | data bits are inverted, i.e. 1 -> 0V, 0 -> +5V, the stop bit is high (+5V).
407 | 
408 | The VCR sends out a set of 8 bytes once every field (i.e., 60 times a
409 | second for NTSC VCRs).  Other than the stop and start bits, there is
410 | no time gap between each of the 8 bytes.  There is a gap between each
411 | set of 8 bytes.  To know when the set of 8 bytes begins, you are supposed
412 | to watch for this time gap.  However, because of the consistent format
413 | of the data, you should be able to determine were the set begins just by
414 | examining the data from multiple sets of bytes.
415 | 
416 | Bytes 0 and 1 (The first two bytes in the 8 byte set), are used by 
417 | "Camera, personal computer and editor" to send commands to the VCR.
418 | 
419 | Bytes 2 and 3 are used buy "Tuner and timer" to send commands to VCR
420 | and "Status to exterior".
421 | 
422 | Bytes 4, 5, 6, and 7 are used by the VCR to send out status and counter
423 | information.
424 | 
425 | The serial line is an open-collector type data line.  This means that
426 | the VCR normally holds the line at +5V with a pull-up resistor.  An
427 | external unit that wants to send data uses an open-collector type
428 | TTL gate that does nothing to send a +5V signal, and grounds the
429 | line to send a 0V signal.
430 | 
431 | The VCR will send the start bit for the first 4 words, but will leave
432 | the line at +5V (all zeros) for the data.  Command bytes of all zero
433 | are defined to be a no-op.
434 | 
435 | A unit (like an edit controller) that wants to send a command must
436 | wait for the VCR to send the start bit, and then start transmitting
437 | the correct 8 data bits, in sync with the VCR.  Making a serial port
438 | on a PC do this is hard.  I got e-mail from one guy that said he did
439 | it all in software.  He connected the serial data line to something
440 | like the CD line, and used something like DTR for output.  He then
441 | wrote a timing loop in software to read and transmit the bits at
442 | the correct time.  Simple hardware but really tricky and machine
443 | dependent software.
444 | 
445 | The serial line can also have multiple controllers connected to it.
446 | Because of this, any controller should do bit checking.  This is where
447 | you read the commands bits as you send them to check and see if another
448 | controller is sending a command at the same time. (i.e., you must
449 | look for collisions.)
450 | 
451 | If two devicess send a 5V, or 0V signal at the same time, you can't see
452 | the collision.  But if one sends 5V and one sends 0V, then the 0V
453 | signal will "win".  If you try to send a 5V signal, but read back a 0V
454 | level on the line, then you know there was a collision and you should
455 | stop sending and let the other guy complete his command.
456 | 
457 | I don't now for sure, but I think this might happen in a device like
458 | a camcorder if you press a button (like stop) on the unit at the same
459 | time your computer is trying to send a command.
460 | 
461 | The manual also says that you must send evey command multiple times
462 | to make sure the VCR responds to it.  It says: "In order that the VTR
463 | makes the command effective, it is necessary to transmit the
464 | same code continuously over 4 fields.  Therefore, it is required for the
465 | peripheral side to transmit over 5 fields of the same code."  I don't
466 | quite understand the logic in that statement, but I think it's saying
467 | you have to transmit every command for 5 fields.
468 | 
469 | The tables that define all the bits, and all the commands take up
470 | 6 pages (double sided) in the manual, and I don't intend to type
471 | them all in, but here is enough to get you started:
472 | 
473 | Bits are numbered 0 to 7, with 0 being the first bit sent.
474 | 
475 | Byte 0
476 | 
477 |   B0-3
478 |   0000 Command from Camera
479 |   0001 Command from Commander
480 | 
481 |   B4-7
482 |   0000 Use prohibited (i.e. no-op)
483 |   1000 Basic VTR command
484 |   0100 Camera comand
485 |   1000 Special VTR command
486 | 
487 | Byte 1 (Depends on B4-7 of Byte 0)
488 | 
489 |  Basic VTR commands - Byte 0 = 0001-1000 (This is not the complete list)
490 |   00000000 CH-1/1       (I think this is like pressing the 1 button)
491 |   01000000 CH-2/2
492 |   00100000 CH-3/3
493 |   ...
494 |   01001000 CH-10/0
495 |   more strange channel buttons.
496 | 
497 |   01010100 Power on/off
498 |   00111010 Power on
499 |   01111010 Power off
500 | 
501 |   00001100 STOP
502 |   01001100 PAUSE
503 |   00101100 PB (Play Back??)
504 |   01101100 REWIND
505 |   00011100 FF
506 |   01011100 REC
507 |   00000010 STILL
508 | 
509 |   00000110 REVERSE
510 |   01000110 FOWARD
511 |   00011110 PAY (should this be PLAY???)
512 | 
513 |  Special VTR command - Byte 0 = 0001-1100
514 |   10001011 + Frame advance
515 |   10011011 - Frame advance
516 | 
517 |  Camera comand - Byte 0 = 0001-0100
518 |   11010100 Camera Power on/off
519 |   10101100 Zoom Tele
520 |   11101100 Zoom Wide
521 | 
522 | Byte 4 - VTR mode
523 |   (the xxx bits have different meaning for each mode which I don't
524 |    list here.  For example 00100110 is REC with VIDEO INSERT)
525 |   1000xxxx Tape Ejected
526 |   0100xxxx Stoped
527 |   1100xxx0 FF
528 |   1100xxx1 RWD
529 |   0010xxxx REC
530 |   0001xxxx More REC modes
531 |   0110xxxx PB (Play Back)
532 |   1110xxxx SLOW/STILL
533 | 
534 | Byte 5 - VTR status and guide code
535 |   B0-3 status bits
536 |   B0   1 -> undefined command. (you sent a command that this VCR doesn't know)
537 | 
538 |   B4-7 (defines the contents of the last two bytes (6 and 7))
539 |   0000 Use prohibited
540 |   1000 8mm VTR status
541 |   0100 Decimal 4-digit counter
542 |   1100 first half of hour, minute and second counter
543 |   0010 second half of hour, minute and second counter
544 |   1110 Beta VTR status
545 | 
546 | Byte 6 for decimal 4-digit counter
547 |   B0-3 first digit 
548 |   0000 0
549 |   1000 1
550 |   0100 2
551 |   1100 3
552 |   ...
553 |   1001 9
554 | 
555 |   B4-7 second digit
556 | 
557 | Byte 7 for decimal 4-digit counter
558 |   B0-3 third digit
559 |   B4-7 forth digit
560 | 
561 | Byte 6 for first half of HMS counter
562 |   B0-3 units digit of seconds (encoded like above)
563 |   B4-7 tens digit of seconds
564 | Byte 7 for first half of HMS counter
565 |   B0-3 units digit of minutes
566 |   B4-7 tens digit of minutes
567 | 
568 | Byte 6 for second half of HMS counter
569 |   B0-3 units digit of hours
570 |   B4-7 tens digit of hours
571 | Byte 7 for second half of HMS counter (only 1 bit used)
572 |   B7
573 |   0 +
574 |   1 -
575 |  
576 | On your V101, the single frame record can not be activated with the
577 | play/rec button on the camara.  It can only be activated with the play/rec
578 | buttons on the remote.  I don't know what it will do if you sent it
579 | the REC command.  Will it start a single frame record cycle?  If it doesn't
580 | then maybe they defined a new command for the V101 to make that work.
581 | 
582 | I own a V101 and I too want to test this some day.
583 | 
584 | Curt Welch
585 | curt@oasys.dt.navy.mil
586 | Code 3531
587 | David Taylor Research Center (A Navy Lab)
588 | Bethesda, MD
589 | (301) 227-1428
590 | ~Subject: Sony Control-L Protocol Hacke!
591 | ~From: pierce@chips.com (John Pierce)
592 | Path: ux1.cso.uiuc.edu!uwm.edu!cs.utexas.edu!swrinde!mips!pacbell.com!iggy.GW.V
593 | italink.COM!nocsun.NOC.Vitalink.COM!indetech!daver!news.chips.com!pierce
594 | ~Reply-To: pierce@chips.com (John Pierce)
595 | ~Newsgroups: rec.video
596 | Message-ID: <3493@news.chips.com>
597 | ~References: 
598 | ~Date: 29 Oct 91 01:39:19 GMT
599 | 
600 | Well, after reading a couple of postings here about Sony Control-L protocol
601 | we called Sony and got the official spec on Control-L.  Its bad reading!
602 | Direct translation?  Lotsa typos.  But.  We made it WORK!
603 | 
604 | Following is a hacked up piece of C for a IBM-PC parallel port.    Take a
605 | DB-25P.  Connect a sub-mini MONO jack to ground (pin 18 will do) and
606 | pin 17 ("Select").  Voila'   Build following piece of C with MS C6.0 using
607 | at least -Oi (Optimize Intrinsics--- put I/O inline!)  bunches of oneletter
608 | commands will make my Sony CCD-V101 do all kinda tricks!  Lotsa fun.
609 | 
610 | Please for to excuse hacked style of program ...  This was written for
611 | the heck of it on a Saturday afternoon, after several beers!
612 | 
613 | Oh.  This has only been tested on 20Mhz 386DX (no cache) and faster boxes.
614 | I don't know how slow a box it might work on, but it is speed independant 
615 | as long as your box is fast enuf.  Note the Delay(t104/4) after start bit
616 | detection.  This can be trimmed to better align the transmitted bits with
617 | the remote devices timing.  If your computer was infinitely fast, it s/b
618 | Delay(t104/2)....   i.e.  sample in mid-bit.  But since pc's take time
619 | to do anything, we just tweaked it til it looked good on a scope...
620 | 
621 | Also note that we make no attempt to display the status while there is
622 | a command being actively sent.  This is cuz its written with STDIO instead
623 | of clever PC screen blasting, and we were losing too many messages...
624 | 
625 | Obviously this whole shabang should be in assembler.
626 | 
627 | ==================cut-here=================================
628 | #include 
629 | #include 
630 | 
631 | // Copyright (C) 1991, Acme Software Inc.
632 | // All rights reserved EXCEPT the right to use for NON-COMMERCIAL
633 | //      PURPOSES.  I.E.  Hack away but DON'T sell this!
634 | // This copyhack must accompany all copies of this source code.
635 | 
636 | 
637 | #define dataport 0x37A
638 | // #define dataport 0x3BE
639 | 
640 | #define outbit(b) outp(dataport,((inp(dataport)&(0xFF^bit)) | (((b)&1)<< t);
641 |         rt += t;
642 |         }
643 | 
644 | 
645 | void framesync(void)
646 |         {
647 |         int i;
648 |         while(1)                // frame sync
649 |                 {
650 |                 rt = readpic();
651 |                 while ((readpic()-rt) < t1700 && (i=(inp(dataport)&bit)==0));
652 |                 if(i) break;
653 |                 }
654 |         }
655 | 
656 | unsigned DoByte(unsigned char O)
657 |         {
658 |         static int x=0;
659 |         unsigned d,i;
660 |         
661 |         rt = readpic();
662 |         while((inp(dataport)&bit)==0)   // wait for start bit...
663 |                 if((readpic()-rt) > 45000) return 0;    //   OOPS, TIMEOUT!!!
664 | 
665 |         rt = readpic();
666 |         delay(t104/4);          // halfway (almost) into start bit
667 |         d = 0;
668 |         for(i=0;i<8;i++)
669 |                 {
670 |                 d >>= 1;
671 |                 delay(t52);     // wait start of next bit
672 |                 outbit(O);
673 |                 O >>= 1;
674 |                 delay(t52);     // wait middle of bit
675 |                 if (inp(dataport)&bit) d |= 0x80;
676 |                 }
677 |         delay(t104*2);  // wait for stop bit
678 |         return d;
679 |         }
680 | 
681 | void DoFrame()
682 |         {
683 |         int i;
684 | 
685 |         _asm {cli};
686 |         framesync();
687 |         for(i=0;i<8;i++)
688 |                 In[i] = DoByte(Out[i]);
689 |         _asm{sti};
690 |         }
691 | 
692 | void main(int argc, char *argv[])
693 |         {
694 |         int i;
695 |         unsigned char data[8];
696 |         unsigned char Command = ' ';
697 |         long frame=0;
698 |         int f=0;
699 |         int Lapse = 0;
700 |         int Time = 300;
701 | 
702 |         outbit(0);      // clear serial line 
703 | 
704 |         printf("\n      p - Play                r - Record");
705 |         printf("\n      , - Rewind              . - FF");
706 |         printf("\n      s - Stop                S - Pause");
707 |         printf("\n      < - Shuttle <<          > - Shuttle >>");
708 |         printf("\n      t - Tele Zoom           w - Wide Zoom");
709 |         printf("\n      e - Eject               l - Time Lapse");
710 |         printf("\n      d - Display             q - Quit");
711 |         printf("\n      x - Start/Stop");
712 |         printf("\n       - Clear command");
713 |         printf("\n");
714 | 
715 | 
716 |         while (1)
717 |                 {
718 |                 if (kbhit()) 
719 |                         {
720 |                         Command = getch();
721 |                         switch(Command)
722 |                                 {
723 |                         case 'd':       // Display ON/OFF
724 |                                 Out[0] = 0x18;
725 |                                 Out[1] = 0xB4;
726 |                                 f = 5;
727 |                                 break;
728 |                         case 'l':
729 |                                 Lapse = Time;
730 |                         case 'r':       // VTR Record
731 |                                 Out[0] = 0x18;
732 |                                 Out[1] = 0x3A;
733 |                                 f = 5;
734 |                                 break;
735 |                         case 'p':       // VTR Playback
736 |                                 Out[0] = 0x18;
737 |                                 Out[1] = 0x34;
738 |                                 f = 5;
739 |                                 break;
740 |                         case 's':       // VTR Stop
741 |                                 Out[0] = 0x18;
742 |                                 Out[1] = 0x30;
743 |                                 f = 5;
744 |                                 break;
745 |                         case 'S':       // VTR Pause
746 |                                 Out[0] = 0x18;
747 |                                 Out[1] = 0x32;
748 |                                 f = 5;
749 |                                 break;
750 |                         case '>':       // Fast Forward >> continous
751 |                                 Out[0] = 0x18;
752 |                                 Out[1] = 0x38;
753 |                                 f = -1;
754 |                                 break;
755 |                         case '<':       // Fast Rewind << continuous
756 |                                 Out[0] = 0x18;
757 |                                 Out[1] = 0x36;
758 |                                 f = -1;
759 |                                 break;
760 | 
761 |                         case '.':       // Fast Forward >>
762 |                                 Out[0] = 0x18;
763 |                                 Out[1] = 0x38;
764 |                                 f = 5;
765 |                                 break;
766 |                         case ',':       // Fast Rewind <<
767 |                                 Out[0] = 0x18;
768 |                                 Out[1] = 0x36;
769 |                                 f = 5;
770 |                                 break;
771 |                         case 'e':       // Eject
772 |                                 Out[0] = 0x18;
773 |                                 Out[1] = 0x2C;
774 |                                 f = 5;
775 |                                 break;
776 |                         case 'x':       // Start/Stop
777 |                                 Out[0] = 0x18;
778 |                                 Out[1] = 0x33;
779 |                                 f = 5;
780 |                                 break;
781 |                         case 'w':       // Wide Zoom
782 |                                 Out[0] = 0x28;
783 |                                 Out[1] = 0x37;
784 |                                 f = -1;
785 |                                 break;
786 |                         case 't':       // Tele Zoom
787 |                                 Out[0] = 0x28;
788 |                                 Out[1] = 0x35;
789 |                                 f = -1;
790 |                                 break;
791 |                         case 'q':
792 |                                 exit(0);
793 |                                 break;
794 |                         case ' ':
795 |                         default:
796 |                                 Out[0] = 0x00;
797 |                                 Out[1] = 0x00;
798 |                                 Command = ' ';
799 |                                 f = 0;
800 |                                 break;
801 |                                 }
802 |                         }
803 |                 DoFrame();
804 |                 frame++;
805 |                 if(f>0)
806 |                         {
807 |                         f--;
808 |                         if (f == 0) 
809 |                                 {
810 |                                 Out[0] = 0x00;
811 |                                 Out[1] = 0x00;
812 |                                 if (Command != 'l') Command = ' ';
813 |                                 f = 0;
814 |                                 }
815 |                         }
816 |                 if(Command == ' ')
817 |                         {
818 |                         if((In[5]&0xF0)==0x30) 
819 |                                 {
820 |                                 ss = In[6];
821 |                                 mm = In[7];
822 |                                 }
823 |                         else if((In[5]&0xF0)==0x40)
824 |                                 {
825 |                                 hh = In[6];
826 |                                 sign = ((In[7]&0x80)?'-':' ');
827 |                                 }
828 |                         for(i=0;;i++)
829 |                                 {
830 |                                 if(Status[i].code == 0) break;
831 |                                 if(In[4]==Status[i].code) break;
832 |                                 }
833 |                         printf("\r%c%2X:%02X:%02X %-16.16s",
834 |                                 sign,hh,mm,ss,
835 |                                 Status[i].name);
836 | 
837 |                         if(Status[i].code == 0)
838 |                                  for(i=0;i<8;i++)
839 |                                         printf(" %02X", In[i]);
840 | 
841 |                         }
842 |                 if(Command == 'l')
843 |                         {
844 |                         Lapse--;
845 |                         if(Lapse <= 0)
846 |                                 {
847 |                                 Lapse = Time;
848 |                                 Out[0] = 0x18;
849 |                                 Out[1] = 0x3A;
850 |                                 f = 5;
851 |                                 }
852 |                         }
853 |                 }
854 |         }
855 |  
856 | 
857 | ==========================================================================
858 | 
859 | Try 1800-352-SONY. Its the VISCA Developers hotline
860 | 
861 | PS I have nothing to do with this stuff except personal interest. I work
862 | for a different division of Sony.
863 | 
864 | Bob Berger  -  SONY Advanced Video Technology Center
865 | 685 River Oaks Parkway  San Jose, CA 95134 408-944-4964 FAX:  408-954-1027
866 | INTERNET: berger@sfc.sony.com   UUCP: [uunet,mips]!sonyusa!sfcsun!berger
867 | JAPAN:    berger@sfc.sony.co.jp--
868 | 
869 | (Message inbox:279)
870 | Return-Path: o-intelhouse@dlb.com
871 | Received: from bank.ecn.purdue.edu by pasture.ecn.purdue.edu (5.65/1.32jrs)
872 |      id AA23943; Mon, 10 Jan 94 00:50:06 -0500
873 | Received: from daver.bungi.com by bank.ecn.purdue.edu (5.65/1.32jrs)
874 |      id AA27269; Mon, 10 Jan 94 00:49:57 -0500
875 | Received: from dlb by daver.bungi.com with bsmtp
876 |      (Smail3.1.28.1 #1) id m0pJEzB-00009Fa; Sun, 9 Jan 94 21:16 PST
877 | Received: from bucksm by dlb.com with bsmtp
878 |      (Smail3.1.27.1 #4) id m0pJDtk-0000BNa; Sun, 9 Jan 94 20:06 PST
879 | Received: by bucksm.dlb.com (Smail3.1.27.1 #6)
880 |      id m0pJC1L-000Apea; Sun, 9 Jan 94 19:06 MST
881 | Message-Id: 
882 | From: daver!dlb!bucksm!dlb!netcomsv.netcom.com!wheaton.wheaton.edu!sga!dougs
883 | To: o-intelhouse@dlb.com
884 | Date: Sun, 9 Jan 94 15:48:12 CST
885 | Subject: RE: Sony remote control protocol
886 | X-L2L: dlb.com
887 | Precedence: bulk
888 | Errors-To: o-intelhouse@dlb.com
889 | 
890 | > >   The following is a reference guide to using a microcomputer to 
891 | > >control Sony equipment via the SIRCS protocol.  This can occur either 
892 | > >via an infrared interface, or with a Control-S port. It is being 
893 | > >released in the hope that it will be useful to some of you. Apparently 
894 | > >there is no documentation on the protocol available from Sony (at least, 
895 | > >that's what their publications office said).
896 | > 
897 | > You spoke to the wrong person/people.  You need to ask for "Sony
898 | > Remote Control Systems" (2RM383-1).  Mine was $5.  SIRCS is described
899 | > on pages 17-27.  (SIRCS intro from 17-22, System III on 22, Beta on 23,
900 | > and Audio on 25-27)
901 | 
902 | The codes are also the same as documented in the service manual "Protocol
903 | of Control L/LF" (86C0943-1).  However the timing is different.  The
904 | control L frame is 16.7ms consisting of 8 words.  The first few words
905 | send the command and the remaining words return a status from the device.
906 | I wonder if a similar reason is why Ed didn't find the need to have the
907 | packet take a full 45ms but Scott did?  Could it be that room must be left
908 | for a status response when using a wired interface?
909 | 
910 | By the way, does anyone know if a device with a Control-L port will
911 | accept Control-S commands?  My camcorder has a Control-L port but there
912 | is almost no mention of it in the manual.  According to the Control-L
913 | service manual, Control-L is bidirectional and is primarily used 
914 | between a VTR and peripherals.  Control-S is uni-directional and is
915 | used to remote control all devices.
916 | 
917 | The Control L manual is dated March, 1986 even though I purchased it only
918 | a year ago.  It is missing information on current equipment but covers
919 | Beta and Video 8 fairly well.
920 | 
921 | Do you have the phone number to order documents?  I can't seem to find it
922 | and would like to order the manual you mentioned.
923 | 
924 | > Good work, guys!  I started observing these signals (with an
925 | > MC68HC11), but after I got them and was able to send them, I
926 | > bought the manual.  Much easier.
927 | 
928 | I would be glad to document the codes used on my camcorder (CCD-V101)
929 | and receiver (STR-D1011) however, I don't have access to an O'scope at
930 | home.  Does anyone know of a simple program to poll a PC paralell port
931 | bit and display the result?  That should do the job when attached to
932 | a Sharp IR cube.
933 | 
934 | -- Doug Smith, SGA * Loves Park, IL * dougs@sga.uucp 
935 | -- AppleLink: G0231 * CompuServe: 72727,3532
936 | 
937 | 
938 | --
939 | 
940 | =============================================================================
941 | Neil Higgins                                   E-Mail: esa_neilh@seqeb.gov.au
942 | Network Automation Engineer                    Ph:  +61 7 223 4327
943 | The South East Queensland Electricity Board    Fax: +61 7 210 0149
944 | G.P.O. Box 1461, Brisbane, Q. 4001 AUSTRALIA
945 | 
946 | 947 |
948 |

See also PicLanc.asm - A rough assembly listing 949 | for bit banging LANC on the PIC16c84 from Microchip

950 | 951 |

Return to home page

952 | 953 |
954 | I'd love to have your feedback: Email dmeed@nbnet.nb.ca 955 |
956 | 957 |

Last modified: November 8, 1998.

958 |
959 |
960 |
961 | 962 | -------------------------------------------------------------------------------- /LANC_REMOTE copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fred-dev/arduino_lanC/b09e9648a138b70071ff6021e83a49a51ab31f64/LANC_REMOTE copy.png -------------------------------------------------------------------------------- /LANC_REMOTE.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fred-dev/arduino_lanC/b09e9648a138b70071ff6021e83a49a51ab31f64/LANC_REMOTE.png -------------------------------------------------------------------------------- /Lanc_remote2.ino: -------------------------------------------------------------------------------- 1 | //commit/* 2 | //commit/* 3 | //commit/* 4 | 5 | SIMPLE LANC REMOTE 6 | Version 1.0 7 | Sends LANC commands to the LANC port of a video camera. 8 | Tested with a Canon XF300 camcorder 9 | For the interface circuit interface see 10 | http://controlyourcamera.blogspot.com/2011/02/arduino-controlled-video-recording-over.html 11 | Feel free to use this code in any way you want. 12 | 2011, Martin Koch 13 | 14 | "LANC" is a registered trademark of SONY. 15 | CANON calls their LANC compatible port "REMOTE". 16 | */ 17 | 18 | #define cmdPin 7 19 | #define lancPin 11 20 | #define recButton 6 21 | #define zoomOutButton 5 22 | #define zoomInButton 4 23 | #define focusNearButton 3 24 | #define focusFarButton 2 25 | int cmdRepeatCount; 26 | int bitDuration = 104; //Duration of one LANC bit in microseconds. 27 | 28 | 29 | //LANC commands byte 0 + byte 1 30 | //Tested with Canon XF300 31 | 32 | //Start-stop video recording 33 | boolean REC[] = {LOW,LOW,LOW,HIGH,HIGH,LOW,LOW,LOW, LOW,LOW,HIGH,HIGH,LOW,LOW,HIGH,HIGH}; //18 33 34 | 35 | //Zoom in from slowest to fastest speed 36 | boolean ZOOM_IN_0[] = {LOW,LOW,HIGH,LOW,HIGH,LOW,LOW,LOW, LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW}; //28 00 37 | boolean ZOOM_IN_1[] = {LOW,LOW,HIGH,LOW,HIGH,LOW,LOW,LOW, LOW,LOW,LOW,LOW,LOW,LOW,HIGH,LOW}; //28 02 38 | boolean ZOOM_IN_2[] = {LOW,LOW,HIGH,LOW,HIGH,LOW,LOW,LOW, LOW,LOW,LOW,LOW,LOW,HIGH,LOW,LOW}; //28 04 39 | boolean ZOOM_IN_3[] = {LOW,LOW,HIGH,LOW,HIGH,LOW,LOW,LOW, LOW,LOW,LOW,LOW,LOW,HIGH,HIGH,LOW}; //28 06 40 | boolean ZOOM_IN_4[] = {LOW,LOW,HIGH,LOW,HIGH,LOW,LOW,LOW, LOW,LOW,LOW,LOW,HIGH,LOW,LOW,LOW}; //28 08 41 | boolean ZOOM_IN_5[] = {LOW,LOW,HIGH,LOW,HIGH,LOW,LOW,LOW, LOW,LOW,LOW,LOW,HIGH,LOW,HIGH,LOW}; //28 0A 42 | boolean ZOOM_IN_6[] = {LOW,LOW,HIGH,LOW,HIGH,LOW,LOW,LOW, LOW,LOW,LOW,LOW,HIGH,HIGH,LOW,LOW}; //28 0C 43 | boolean ZOOM_IN_7[] = {LOW,LOW,HIGH,LOW,HIGH,LOW,LOW,LOW, LOW,LOW,LOW,LOW,HIGH,HIGH,HIGH,LOW}; //28 0E 44 | 45 | //Zoom out from slowest to fastest speed 46 | boolean ZOOM_OUT_0[] = {LOW,LOW,HIGH,LOW,HIGH,LOW,LOW,LOW, LOW,LOW,LOW,HIGH,LOW,LOW,LOW,LOW}; //28 10 47 | boolean ZOOM_OUT_1[] = {LOW,LOW,HIGH,LOW,HIGH,LOW,LOW,LOW, LOW,LOW,LOW,HIGH,LOW,LOW,HIGH,LOW}; //28 12 48 | boolean ZOOM_OUT_2[] = {LOW,LOW,HIGH,LOW,HIGH,LOW,LOW,LOW, LOW,LOW,LOW,HIGH,LOW,HIGH,LOW,LOW}; //28 14 49 | boolean ZOOM_OUT_3[] = {LOW,LOW,HIGH,LOW,HIGH,LOW,LOW,LOW, LOW,LOW,LOW,HIGH,LOW,HIGH,HIGH,LOW}; //28 16 50 | boolean ZOOM_OUT_4[] = {LOW,LOW,HIGH,LOW,HIGH,LOW,LOW,LOW, LOW,LOW,LOW,HIGH,HIGH,LOW,LOW,LOW}; //28 18 51 | boolean ZOOM_OUT_5[] = {LOW,LOW,HIGH,LOW,HIGH,LOW,LOW,LOW, LOW,LOW,LOW,HIGH,HIGH,LOW,HIGH,LOW}; //28 1A 52 | boolean ZOOM_OUT_6[] = {LOW,LOW,HIGH,LOW,HIGH,LOW,LOW,LOW, LOW,LOW,LOW,HIGH,HIGH,HIGH,LOW,LOW}; //28 1C 53 | boolean ZOOM_OUT_7[] = {LOW,LOW,HIGH,LOW,HIGH,LOW,LOW,LOW, LOW,LOW,LOW,HIGH,HIGH,HIGH,HIGH,LOW}; //28 1E 54 | 55 | //Focus control. Camera must be switched to manual focus 56 | boolean FOCUS_NEAR[] = {LOW,LOW,HIGH,LOW,HIGH,LOW,LOW,LOW, LOW,HIGH,LOW,LOW,LOW,HIGH,HIGH,HIGH}; //28 47 57 | boolean FOCUS_FAR[] = {LOW,LOW,HIGH,LOW,HIGH,LOW,LOW,LOW, LOW,HIGH,LOW,LOW,LOW,HIGH,LOW,HIGH}; //28 45 58 | 59 | boolean FOCUS_AUTO[] = {LOW,LOW,HIGH,LOW,HIGH,LOW,LOW,LOW, LOW,HIGH,LOW,LOW,LOW,LOW,LOW,HIGH}; //28 41 60 | 61 | //boolean POWER_OFF[] = {LOW,LOW,LOW,HIGH,HIGH,LOW,LOW,LOW, LOW,HIGH,LOW,HIGH,HIGH,HIGH,HIGH,LOW}; //18 5E 62 | //boolean POWER_ON[] = {LOW,LOW,LOW,HIGH,HIGH,LOW,LOW,LOW, LOW,HIGH,LOW,HIGH,HIGH,HIGH,LOW,LOW}; //18 5C Doesn't work because there's no power supply from the LANC port when the camera is off 63 | //boolean POWER_OFF2[] = {LOW,LOW,LOW,HIGH,HIGH,LOW,LOW,LOW, LOW,LOW,HIGH,LOW,HIGH,LOW,HIGH,LOW}; //18 2A Turns the XF300 off and then on again 64 | //boolean POWER_SAVE[] = {LOW,LOW,LOW,HIGH,HIGH,LOW,LOW,LOW, LOW,HIGH,HIGH,LOW,HIGH,HIGH,LOW,LOW}; //18 6C Didn't work 65 | 66 | 67 | 68 | void setup() { 69 | 70 | pinMode(lancPin, INPUT); //listens to the LANC line 71 | pinMode(cmdPin, OUTPUT); //writes to the LANC line 72 | 73 | pinMode(recButton, INPUT); //start-stop recording button 74 | digitalWrite(recButton, HIGH); //turn on an internal pull up resistor 75 | pinMode(zoomOutButton, INPUT); 76 | digitalWrite(zoomOutButton, HIGH); 77 | pinMode(zoomInButton, INPUT); 78 | digitalWrite(zoomInButton, HIGH); 79 | pinMode(focusNearButton, INPUT); 80 | digitalWrite(focusNearButton, HIGH); 81 | pinMode(focusFarButton, INPUT); 82 | digitalWrite(focusFarButton, HIGH); 83 | 84 | digitalWrite(cmdPin, LOW); //set LANC line to +5V 85 | delay(5000); //Wait for camera to power up completly 86 | bitDuration = bitDuration - 8; //Writing to the digital port takes about 8 microseconds so only 96 microseconds are left for each bit 87 | } 88 | 89 | void loop() { 90 | 91 | 92 | if (!digitalRead(recButton)) { 93 | lancCommand(REC); 94 | } 95 | 96 | if (!digitalRead(zoomOutButton)) { 97 | lancCommand(ZOOM_OUT_4); 98 | } 99 | 100 | if (!digitalRead(zoomInButton)) { 101 | lancCommand(ZOOM_IN_4); 102 | } 103 | 104 | if (!digitalRead(focusNearButton)) { 105 | lancCommand(FOCUS_NEAR); 106 | } 107 | 108 | if (!digitalRead(focusFarButton)) { 109 | lancCommand(FOCUS_FAR); 110 | } 111 | } 112 | 113 | 114 | 115 | void lancCommand(boolean lancBit[]) { 116 | 117 | cmdRepeatCount = 0; 118 | 119 | while (cmdRepeatCount < 5) { //repeat 5 times to make sure the camera accepts the command 120 | 121 | while (pulseIn(lancPin, HIGH) < 5000) { 122 | //"pulseIn, HIGH" catches any 0V TO +5V TRANSITION and waits until the LANC line goes back to 0V 123 | //"pulseIn" also returns the pulse duration so we can check if the previous +5V duration was long enough (>5ms) to be the pause before a new 8 byte data packet 124 | //Loop till pulse duration is >5ms 125 | } 126 | 127 | //LOW after long pause means the START bit of Byte 0 is here 128 | delayMicroseconds(bitDuration); //wait START bit duration 129 | 130 | //Write the 8 bits of byte 0 131 | //Note that the command bits have to be put out in reverse order with the least significant, right-most bit (bit 0) first 132 | for (int i=7; i>-1; i--) { 133 | digitalWrite(cmdPin, lancBit[i]); //Write bits. 134 | delayMicroseconds(bitDuration); 135 | } 136 | 137 | //Byte 0 is written now put LANC line back to +5V 138 | digitalWrite(cmdPin, LOW); 139 | delayMicroseconds(10); //make sure to be in the stop bit before byte 1 140 | 141 | while (digitalRead(lancPin)) { 142 | //Loop as long as the LANC line is +5V during the stop bit 143 | } 144 | 145 | //0V after the previous stop bit means the START bit of Byte 1 is here 146 | delayMicroseconds(bitDuration); //wait START bit duration 147 | 148 | //Write the 8 bits of Byte 1 149 | //Note that the command bits have to be put out in reverse order with the least significant, right-most bit (bit 0) first 150 | for (int i=15; i>7; i--) { 151 | digitalWrite(cmdPin,lancBit[i]); //Write bits 152 | delayMicroseconds(bitDuration); 153 | } 154 | 155 | //Byte 1 is written now put LANC line back to +5V 156 | digitalWrite(cmdPin, LOW); 157 | 158 | cmdRepeatCount++; //increase repeat count by 1 159 | 160 | /*Control bytes 0 and 1 are written, now don’t care what happens in Bytes 2 to 7 161 | and just wait for the next start bit after a long pause to send the first two command bytes again.*/ 162 | 163 | 164 | }//While cmdRepeatCount < 5 165 | } 166 | 167 | 168 | --------------------------------------------------------------------------------