Yep
that about how I run mine
power up pic & camera it take a 10 sec. test movie then powerdown
until INTERRUPT from PIR
change 470 res. to 1k on each pin .no pull down res.
I will try to test for you by 2morrow afternoon and post
thanks
Yep
that about how I run mine
power up pic & camera it take a 10 sec. test movie then powerdown
until INTERRUPT from PIR
change 470 res. to 1k on each pin .no pull down res.
I will try to test for you by 2morrow afternoon and post
thanks
" be nice it's people like me that make people like you look smart"
yes I read the datasheet, of the 300 pages I understood 10
Sorry but I'm just not having any luck with this.
look this over and see if I missed anything.
hardwire:
1k resistor from portc.5 to Lanc line
1k resistor from portc.4 to Lanc line
Lanc ground to system ground
put the PBP code in and nothing
I can drop in my assembly code in and lift portc.5 wire it works
it 's got to be that the PBP timing is off but I don't have a scope to check
after playing with this Lanc stuff for about 2 years let me share some of things I learned the hardway.
1. this one cause me to lose more hair than all others put together
the Lanc line can backfeed a small amount of voltage to the chip
which can and will keep the program running with supply to the chip turn off
which means that cycling power may not reset the program to the begining
what I do is use a double pole power switch that not only kills power to the board but also opens the lanc line
2. 27 record and 29 stop are listed under special commands
2827 and 2829 none of my cameras with work with this
BUT THEY WILL WORK USING 1827 & 1829
3. I put my cams to sleep with 185E and wake up with the standard pulse lanc line low then send the record command I have never had to use the
185C power on command ( on my command sheet it list 5c but does not
tell what it is .
4. I think most people that does this shift 48 to 52us to read and write in the middle of the bit
maybe some one else on the forum can come up with some answers
Sorry I could not make it work
Code:'**************************************************************** '* Name : pbp_1.BAS * '* Author : GROUNDED * '* Notice : Copyright (c) 2009 Copyright (c) * '* : All Rights Reserved * '* Date : 9/23/2009 * '* Version : 1.0 * '* Notes : portc.4 read /portc.5 write * '* : testing sending Lanc commands using PBP * '**************************************************************** '**************************************************************** pic16F676 @ __config _XT_OSC & _WDT_ON & _MCLRE_OFF & _CP_OFF PAUSE 5000 CMCON = 7 'COMPARATOR OFF VRCON = 0 'VOLTAGE REF. DISABLE TRISA = %00001000 'MAKE A.2 & A.3 INPUTS TRISC = %00000000 'MAKE .C.0,C.1 PORTC INPUTS .4 &.5 FOR LANC USE ANSEL = %00000000 OPTION_REG=%01000000 'RAISING EDGE/WEAK PULL UP WPUA = %00000000 'NO WEAK PULLUPS HIGH PORTC.0 :PAUSE 10000 :LOW PORTC.0 command_bit var bit syncbit var byte syncbyte var word counter var byte value var byte Bits var byte Time var byte Goto start Sync_byte: syncbyte = 0 while syncbyte < 700 pulsin portc.4, 1, syncbyte wend Return Sync_bit: syncbit = 0 while syncbit < 9 pulsin portc.4, 0, syncbit wend Return Command_byte: gosub sync_byte pauseus 80 input portc.5 'first byte to send (LSB 1ST)Hex 18 %0001,1000 pauseus 312 '000 low portc.5 pauseus 208 '11 input portc.5 pauseus 312 '000 input portc.5 'Stop bits set high Return Start: pause 1000 counter = 0 gosub Power_off pause 10000 'gosub DelayTime counter = 0 gosub Wakeup 'gosub Power_on pause 3000 counter = 0 gosub Record_on pause 10000 counter = 0 gosub Record_on pause 500 goto Start Power_off: gosub Command_byte gosub sync_bit input portc.5 'Power off command #5E (LSB 1ST) %0101,1110 pauseus 104 '0 low portc.5 pauseus 416 '1111 input portc.5 pauseus 104 '0 low portc.5 pauseus 104 '1 input portc.5 pauseus 104 '0 input portc.5 'Stop bits set high counter = counter + 1 if counter = 3 then Return goto Power_off Power_on: gosub Command_byte gosub Sync_bit input portc.5 pauseus 208 '00 'Power on Command 5C (LSB 1ST) %0101,1100 low portc.5 pauseus 312 '111 input portc.5 pauseus 104 '0 low portc.5 pauseus 104 '1 input portc.5 pauseus 208 '00 ????? maybe 104 input portc.5 'Stop bits set high counter = counter + 1 if counter = 5 then Return goto Power_on Record_on: gosub Command_byte gosub Sync_bit low portc.5 'Start Recording pauseus 208 '11 'Record On 33 (LSB 1ST) %0011,0011 input portc.5 pauseus 208 '00 low portc.5 pauseus 208 '11 input portc.5 pauseus 208 '00 input portc.5 'Stop bits set high counter = counter + 1 if counter = 5 then Return goto Record_on DelayTime: For Time = 0 to 60 pause 60000 Next Time Return Wakeup: low portc.5 'This wakes camera up for short period to accept commands pause 500 input portc.5 pause 100 Return
" be nice it's people like me that make people like you look smart"
yes I read the datasheet, of the 300 pages I understood 10
Grounded
I ran it today and my camera would turn off only, nothing else, Yesterday everything was working great. Then I remembered why I used two pins while setting this up. So I installed a 20k resistor from stamp pin b1 sync pin to ground and everything started working perfectly. I used two pins because I did not want to pull the sending line low, my scope showed only 3vdc on my camera not the 5vdc I expected.
grounded
2. 27 record and 29 stop are listed under special commands
2827 and 2829 none of my cameras with work with this
BUT THEY WILL WORK USING 1827 & 1829
Yes I found the same thing remember the command_byte2 that I said was not used that was hex 28.
grounded
3. I put my cams to sleep with 185E and wake up with the standard pulse lanc line low then send the record command I have never had to use the
185C power on command ( on my command sheet it list 5c but does not
tell what it is .
I understand, and have not tried this yet ( but will ) when setting something up I always use the full steps first, and then take the shortcuts later I would not be sure it works with all camers or not.
grounded
4. I think most people that does this shift 48 to 52us to read and write in the middle of the bit
Your talking about sending data to the first two bytes, not sending right after the syncbit but waiting until the middle of the 1.4 ms frame and sending then. I have a sinc_bit which looks for the camers syncbit and sends right after it finishes so my timing is right on not just sending somewhere in the middle. But when using a different osc 4mhz and not 10 mhz it could be too tight for a slower speed and this is something I need to check.
Now let me ask this Did you camera Power Down when you first turned on the pic's power. there is no delay so if the camera is not on and the switch between the camera and pic is not on and the pic is powered it will go into limbo and do nothing. So everything must be on then power the pic it should turnoff the camera immediately and be in sync.
Larry no the cam did not turn off, it just "did nothing"
But I really be leave the problem is in the tight time this needs and my 4mhz
maybe my problem with using PBP code. I no were near smart enough to know the if, &'s and butts of this but I have been told more than once that because of the timing you could not do this with PBP but I'm sure hoping that you
are someone here will prove then wrong
pm sent
" be nice it's people like me that make people like you look smart"
yes I read the datasheet, of the 300 pages I understood 10
Grounded
I don't know whats wrong! I do indeed have it running right now, It has been running all day taking pictures every 15 minutes for 5 seconds at a time. PBP does indeed work and the timing is really not that tight. I did notice your using xt setting I have always used HS mode, have not looked over your program much yet. I see no reason that 4 mhz would not work.
grounded,
here try this I made some changes in your program headers see if this works better for you.
Code:@ DEVICE PIC16F676, HS_OSC, WDT_ON, PWRT_ON, PROTECT_OFF DEFINE OSC 4 TRISC = %00010000 command_bit var bit syncbit var byte syncbyte var word counter var byte value var byte Bits var byte Time var byte PAUSE 2000 Goto start Sync_byte: syncbyte = 0 while syncbyte < 700 pulsin portc.4, 1, syncbyte wend Return Sync_bit: syncbit = 0 while syncbit < 9 pulsin portc.4, 0, syncbit wend Return Command_byte: gosub sync_byte pauseus 80 input portc.5 'first byte to send (LSB 1ST)Hex 18 %0001,1000 pauseus 312 '000 low portc.5 pauseus 208 '11 input portc.5 pauseus 312 '000 input portc.5 'Stop bits set high Return Start: pause 1000 counter = 0 gosub Power_off pause 10000 'gosub DelayTime counter = 0 gosub Wakeup 'gosub Power_on pause 3000 counter = 0 gosub Record_on pause 10000 counter = 0 gosub Record_on pause 500 goto Start Power_off: gosub Command_byte gosub sync_bit input portc.5 'Power off command #5E (LSB 1ST) %0101,1110 pauseus 104 '0 low portc.5 pauseus 416 '1111 input portc.5 pauseus 104 '0 low portc.5 pauseus 104 '1 input portc.5 pauseus 104 '0 input portc.5 'Stop bits set high counter = counter + 1 if counter = 3 then Return goto Power_off Power_on: gosub Command_byte gosub Sync_bit input portc.5 pauseus 208 '00 'Power on Command 5C (LSB 1ST) %0101,1100 low portc.5 pauseus 312 '111 input portc.5 pauseus 104 '0 low portc.5 pauseus 104 '1 input portc.5 pauseus 208 '00 ????? maybe 104 input portc.5 'Stop bits set high counter = counter + 1 if counter = 5 then Return goto Power_on Record_on: gosub Command_byte gosub Sync_bit low portc.5 'Start Recording pauseus 208 '11 'Record On 33 (LSB 1ST) %0011,0011 input portc.5 pauseus 208 '00 low portc.5 pauseus 208 '11 input portc.5 pauseus 208 '00 input portc.5 'Stop bits set high counter = counter + 1 if counter = 5 then Return goto Record_on DelayTime: For Time = 0 to 60 pause 60000 Next Time Return Wakeup: low portc.5 'This wakes camera up for short period to accept commands pause 500 input portc.5 pause 100 RETURN
Larry 676 does not have hs_osc so it would not compile thanks for trying
BUT:
I'm up and running (cross fingers)
remember I said something about adjusting to midpoint of the bit
well I did 'Command_byte:you had dropped it from104 to 80 to adjust timing
I dropped to 60 (about half) and bingo it's running (started@ 70 and it ran)
I think 80 is right on the edge that's why sometime it work and then the next
it did'n
and this is with my standard Lanc control board using
1 pin to read / write no pull up or down 60 ohm resistor in Lanc line
this basic program just start recording 10 sec. movie then stop wait
5 sec. and start over. If it will run one command it should run ALL
it's been running for about 2 hr. with out missing abeat
Now the bad news the next few days are full full full . not sure it I will have time to eat much less to play I mean work on this
I would be interested to know how it looks on the scope
grounded
Code:'**************************************************************** '* Name : pbplanc_T_1833.BAS '* Author : GROUNDED '* Notice : Copyright (c) 2009 '* : All Rights Reserved '* Date : 9/25/2009 '* Version : 1.0 '* Notes : testing pbp lanc basic just record and stop ' '**************************************************************** pic16F676 @ __config _XT_OSC & _WDT_ON & _MCLRE_OFF & _CP_OFF PAUSE 5000 CMCON = 7 VRCON = 0 TRISA = %00001000 TRISC = %00000000 ANSEL = %00000000 OPTION_REG=%01000000 WPUA = %00000000 HIGH PORTC.0 :PAUSE 3000 :LOW PORTC.0 'POWER UP LED PAUSE 1000 command_bit var bit syncbit var byte syncbyte var word counter var byte value var byte Bits var byte Goto start Sync_byte: syncbyte = 0 while syncbyte < 700 pulsin PORTC.4, 1, syncbyte wend Return Sync_bit: syncbit = 0 while syncbit < 9 pulsin PORTC.4, 0, syncbit wend Return Command_byte: '00011000 SEND 18 gosub sync_byte pauseus 60 'CHANGED FROM 80 TO 60 (LITTLE OVER HALF OF 104) TIMING ADJUST input PORTC.4 pauseus 312 '000 low PORTC.4 pauseus 208 '11 input PORTC.4 pauseus 312 '000 input PORTC.4 'Stop bits set high Return START: Record_on: '11001100 SEND 33 gosub Command_byte gosub Sync_bit low PORTC.4 pauseus 208 '11 input PORTC.4 pauseus 208 '00 low PORTC.4 pauseus 208 '11 input PORTC.4 pauseus 208 '00 input PORTC.4 'Stop bits set high counter = counter +1 if counter = 4 then GOTO MT goto Record_on MT: COUNTER =0 PAUSE 10000 '10 SEC. MOVIE Record_off: '11001100 SEND 33 gosub Command_byte gosub Sync_bit low PORTC.4 pauseus 208 '11 input PORTC.4 pauseus 208 '00 low PORTC.4 pauseus 208 '11 input PORTC.4 pauseus 208 '00 input PORTC.4 'Stop bits set high counter = counter +1 if counter =4 then GOTO OVER goto Record_OFF OVER: PAUSE 5000 GOTO START
" be nice it's people like me that make people like you look smart"
yes I read the datasheet, of the 300 pages I understood 10
Bookmarks