In SX Microcontrollers, SX/B Compiler and SX-Key Tool, mojorizing wrote: Hi Jim, Nice project you got here. I did a similar thing to control a Sony Handycam. The Sony protocol is called LANC and I learned about all the particulars from [url]http://www.boehmel.de/lanc.htm[/url] My project consisted of a Sony camcorder in a pelican box inside a waterproof backback. A external mini cam from [url]http://www.helmetcamera.com/[/url] is afixed to a Gath surf helmet along with a single waterproof button on the chest strap. Both video and button control wires are lead thru watertight connections to the Camcorder. This system enables a surfer to film in-water video by controlling the "record" and "stop" functions of the camcorder from the one push button on the chest strap. The micro I used was a PIC , but that assembly is easily transformed into SX ASM. [code] ;********************************************************************** ; * ; Filename: lanc5.asm * ; Date: 3/28/02 * ; File Version: 1 * ; * ; Author: mojorizing * ; Company: * ; * ; * ;********************************************************************** ; * ; Files required: * ; * ; * ; * ;********************************************************************** ; * ; Notes: * ; * ; * ; * ; * ;********************************************************************** list p=16f84 ; list directive to define processor #include ; processor specific variable definitions ;********************************************************************** ;RA 0 LANC output/input to/from camera ; 1 unused- output ; 2 unused- output ; 3 unused- " ;RB 0 button input normally high, one push=start, 2+ pushes= stop ; 1-7 unused- output ;********************************************************************** ; Equates ; bit 0 of port A....is the output to the camera ; RB0/INT is the button, goes to ground when pressed CBLOCK H'0C' command command1 count count1 counter N M temp ENDC ;********************************************************************** org 0x000 ; processor reset vector goto begin ; go to beginning of program ;*********************************************************************** org 0x004 ; interrupt vector location ;----------------------------------------------------------------------- begin ;------------------------------------------------------------------------------------- movlw b'10000000' ;falling edge for interrupt option movlw b'00000001' ;port RA0 is output/input to camera, start as input tris PORTA movlw b'00000001' ;port B is input ; RB0/INT which is button tris PORTB bcf INTCON,1 ;clear INT flag bcf INTCON,7 ;disable global ;set to do next instruction after waking up bsf INTCON,4 ;enable INT interupts snooze sleep nop nop change ;----------------------------------------------------------------------- ; How many times has the button been pressed? movlw D'40' ;for forty samples at 50msec each for 2 second sample period movwf count1 loop btfss PORTB,0 ;is button pressed? goto $-1 ;yes, wait for release movlw D'20' ;debounce release call nmsec ; btfss PORTB,0 ;is button pressed still? goto $-5 ;yes?,go back and wait for release sample movlw D'100' ;50msec delay call nmsec btfss PORTB,0 goto stop ;need to debounce,then stop code decfsz count1,1 goto sample ;delay and then sa goto start stop btfss PORTB,0 goto $-1 ; movlw b'11001111' ;stop command....inverted hex'30' movwf command1 movlw D'5' ;commands to be sent for 5 times movwf count1 goto main start movlw b'11000101' ;record command....inverted hex'3A' movwf command1 ;******************************************************************** movlw D'5' ;commands to be sent for 5 times movwf count1 main call sync_up movlw b'11100111' ; movwf command call wait_strt call send movf command1,0 movwf command call wait_strt call send decfsz count1,1 goto main goto reset ;*********************************************************************** ; ; First we want to synchronize our reception. We do this by waiting ; until the lanc line has been held high for at least 1 word time. ; (1352 us. or more) sync_up clrf counter ; clear sync counter to 0 sync_loop btfss PORTA,0 ; Wait for interframe gap goto sync_up ; This loop takes 6 us, so if the nop ; counter overflows before incfsz counter,1 ; a transition on the LANC goto sync_loop ; line, it is the interframe gap.. ; (1530 us) return ;*************************************************************************** ; Once synchronized we wait for a start bit to show up. wait_strt btfsc PORTA,0 ; wait for start bit goto wait_strt ; start_bit movlw d'33' ; Constant for start bit time (52us) movwf counter ; set counter l1 decfsz counter,1 ; loop on counter (3us/loop) goto l1 ; return ;*************************************************************************** send movlw d'8' movwf count movlw b'00000000' ;port RA0 is output/input to camera, now to output tris PORTA nop nop loop2 btfsc command,0 bsf PORTA,0 btfss command,0 bcf PORTA,0 movlw d'31' movwf temp delay decfsz temp,1 goto delay rrf command,1 decfsz count,1 goto loop2 movlw b'00000001' ;port RA0 is output/input to camera, as input tris PORTA nop nop return ;**************************************************************************** nmsec ;time is actually 1/2 of the number in W in milliseconds movwf N ; save 'W' in a register of our own loadm movlw d'167' movwf M dlyloop decfsz M,f goto dlyloop decfsz N,f goto loadm return ;****************************************************************************** reset ;need to put for delay for multiple button presses ;so that succesive presses don't restart it when stop is requested bcf INTCON,1 ;clear INT flag bsf INTCON,4 ;disable global ;set to do next instruction after waking up bsf INTCON,7 ;enable INT interupts ;******************************************************************************** goto snooze end ; directive 'end of program' [/code] as far as pan/tilt mounts, Pelco makes various mounts and they can be readily attained from Ebay. It seems there are a lot of business that are upgrading their security systems. These are generally not servo controlled because position feedback is the actual video image...you point it were you want to look. later, Kevin ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=78732#m79308 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)