Pentax IR Remote


Closed Thread
Results 1 to 24 of 24

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by ardhuru View Post
    Hi,

    Speaking of intervalometers, did you see the one at http://www.doc-diy.net/photo/hdr-jack/#thecircuit ?

    It uses an atmel and is meant for a Canon, but the design is ingenious.

    Or this: http://cms.diodenring.de/en/electron...tervalltimerv2 ; based on 10F222, works with Canon, Nikon & the newer Pentaxs.

    Planning to build one for my Canon 500D...

    Regards,

    Anand
    I started with a Canon A570is and CHDK but wanted to use the DSLR for its many advantages, built the diodenring timelapse but my brand new pentax K-x does not have the 2.5mm jack as my previous pentax K-100, stupid me I realized this AFTER building it so the only choice left was to build it using the IR sensor. Crossed many mails with Achim (from diodenring) he is a helpfull guy.

    Regarding the HDR-jack I think this can also be implemented via IR, but not looked into it yet.

    Regarding the program in this thread, I know the timing loop at the begining can be improved using a better way to count time. I could use some help there


    Pablo

  2. #2
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by peu View Post
    Regarding the program in this thread, I know the timing loop at the begining can be improved using a better way to count time. I could use some help there
    Darrel has some great interrupt include files. It makes it pretty easy to do some great things with interrupts, and they can be very efficient as well. Here is a link to a timer example of his. http://darreltaylor.com/DT_INTS-14/elapsed.html
    Last edited by ScaleRobotics; - 6th January 2011 at 15:35.
    http://www.scalerobotics.com

  3. #3
    Join Date
    Feb 2005
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    interesting, never looked deeply into them, now that I did I have some warnings at compile time, maybe you can help me

    PIC12F683
    pbp 2.60b
    latest mapsm from MPLAB IDE v8.63
    Downloaded ReEnterPBP.bas and DT_INTS-14.bas from Darrel Site and placed at pbpw folder
    And Im trying the example you linked (http://darreltaylor.com/DT_INTS-14/elapsed.html)
    this example requires Elapsed_INT.bas which I found in this thread: http://www.picbasic.co.uk/forum/show...7473#post17473 also placed it at pbpw folder. Is this the current version?


    when I compile the example (using MPASM from microcodestudio) I get these errors:

    Warning[219] C:\progra~1\picbas~1\pbppic14.lib 2934 : Invalid RAM location specified.
    Warning[219] C:\progra~1\picbas~1\pbppic14.lib 2939 : Invalid RAM location specified.
    Warning[219] C:\progra~1\picbas~1\pbppic14.lib 3059 : Invalid RAM location specified.
    Warning[219] C:\progra~1\picbas~1\pbppic14.lib 3075 : Invalid RAM location specified.

    What Im doing wrong?

  4. #4
    Join Date
    Feb 2005
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    the problem was the LCDOUT, doh! back to learning this interesting interrupt stuff
    Last edited by peu; - 6th January 2011 at 18:34.

  5. #5
    Join Date
    Feb 2005
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    Added the timer as suggested and it works! BUT, now I lost two things and I don't know why:

    1) the led thats supposed to flash once a second inside the time counting loop only flashes once.

    2) When outside the timelapse function in the previous version if I left the button pressed the camera shooted continuously, now it shots one time per press

    As a BONUS I translated all the comments to English

    Code:
    '****************************************************************
    '*  Name    : pentax.BAS                                        *
    '*  Author  : PEU based on examples from www.rentron.com        *
    '*  Notice  : Copyleft (c) 2011                                 *
    '*          : No Rights Reserved on derived work                *
    '*  Date    : 05-ENE-11                                         *
    '*  Version : 1.01                                               *
    '*  Notes   : pablou at gmail dot com                           *
    '****************************************************************
    @ #define IRTX GPIO  ; Define port to use for IR out
    @ #define PIN 2      ; Define port pin to use for IR out
    
    ' 12F683.INC at picbasic folder has this defined already for MPASM use
    ' __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _CP_ON
    '@ device pic12f683,INTRC_OSC_NOCLKOUT , wdt_on, mclr_off, protect_on
    
    
    INCLUDE "DT_INTS-14.bas"
    INCLUDE "ReEnterPBP.bas"
    INCLUDE "Elapsed_INT.bas"  ; Elapsed Timer Routines  by Darrel Taylor
    
    DEFINE OSC 4
    
      GPIO = 0      
      TRISIO.2 = 0      ' LED IR
      TRISIO.1 = 0      ' Red LED 
      TRISIO.5 = 1      ' Normal open pushbutton (w/ pulldown)
      CMCON0   = 7      ' Comparators disabled
      ANSEL = 0         ' A/D disabled
    '  GIE       VAR INTCON.7  ' Global interrupt enable 1=ON, 0=OFF
      GPIE      VAR INTCON.3  ' Port change interrupt enable 1=ON, 0=OFF
      GPIF      VAR INTCON.0  ' Port Change Interrupt Flag bit   
    
      Cycles    VAR BYTE    ' Number of carrier cycles
      ContaSec  var word    ' Seconds Counter
      TLFlag    var byte    ' Timelapse counter programmed?
      IRLED     var GPIO.2  ' alias LED IR
      LED       var GPIO.1  ' alias red LED 
      BOTON     var GPIO.5  ' pushbutton
      
      GIE = 0            ' Disable global ints
      GPIE = 1           ' Enable port change int
      IOC.5 = 0          ' Int-on-change for GPIO.5 disbled
      PAUSE 100          ' little pause to settle the processor after cold start
      
    
    GOTO OverASM     ' jump over ASM routines
    
    ' Generate "Cycles" number of ~38.4kHz pulses   Bruce at www.rentron.com
    ASM
    _Pulse38
       bcf IRTX,PIN     ; 1uS, LED=on
       goto $+1         ; + 2uS = 3uS
       goto $+1         ; + 2uS = 5uS
       goto $+1         ; + 2uS = 7uS
       goto $+1         ; + 2uS = 9uS
       goto $+1         ; + 2uS = 11uS
       goto $+1         ; + 2uS = 13uS   
       bsf IRTX,PIN     ; 1uS, LED=on
       goto $+1         ; + 2uS = 3uS
       goto $+1         ; + 2uS = 5uS
       goto $+1         ; + 2uS = 7uS
       goto $+1         ; + 2uS = 9uS
       nop              ; + 1uS = 10uS
       decfsz _Cycles,f ; + 1uS = 11S    
       goto _Pulse38    ; + 2uS = 13uS
       return           ; Return to caller    
    ENDASM
    
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler   TMR1_INT,  _ClockCount,   PBP,  yes
        endm
        INT_CREATE            ; Creates the interrupt processor
    
        INT_ENABLE  TMR1_INT  ; Enable Timer 1 Interrupts  
    ENDASM
    
    OverASM:    ' END of ASM routines
    
    contasec=0
    tlflag=0
    
    
    ' New timer
    GOSUB ResetTime           ' Reset Time to  0d-00:00:00.00
    GOSUB StartTimer          ' Start the Elapsed Timer
    
    while boton = 1           ' Loops while the button is pressed
            if SecondsChanged = 1 then 'if the seconds changed flash the red led
            high led
            pause 50
            low led
            SecondsChanged = 0      ' set flag back to 0
            endif
        tlflag=1                    ' This flags lets me know if the timer was used
    wend
    
    contasec = Seconds + (Minutes * 60) ' Total time elapsed
    gosub StopTimer
    
    'Loop del TimeLapse      
    if tlflag = 1 then              ' if the timer was used continue
    
        while boton = 0  
            sleep contasec  ' sleep programmed time
            gosub trigger   ' trigger 
            high led        ' red LED on
            pause 50        ' little pause
            low led         ' red LED off
        wend
        
    ' Timelapse ended because the button was pushed
        for contasec = 1 to 15  ' flash red LED to let the user know
            high led
            pause 100
            low led 
            pause 100
        next
    
    endif
      IOC.5 = 1             ' Int-on-change for GPIO.5 enabled
      GPIO = 0 
      Main:                 ' main Loop 
      
       ASM
        sleep              ; Sleep
       endasm
        
        while boton=0       ' wait for button push
        wend
        GPIF = 0            ' Clear port change interrupt flag
        gosub trigger       ' trigger
        high led            ' red LED on
        pause 50
        low led             ' red LED off
        pause 200           ' debounce
       
      GOTO Main
      
    Trigger:                ' PENTAX pulse train
      Cycles = 255      
      CALL Pulse38
      Cycles = 239      
      CALL Pulse38
      pauseus 3000
      cycles = 38
      CALL Pulse38
      pauseus 1000
      cycles = 38
      CALL Pulse38
      pauseus 1000
      cycles = 38
      CALL Pulse38
      pauseus 1000
      cycles = 38
      CALL Pulse38
      pauseus 1000
      cycles = 38
      CALL Pulse38
      pauseus 1000
      cycles = 38
      CALL Pulse38
      pauseus 1000
      cycles = 38
      CALL Pulse38
      pauseus 5000              ' end PENTAX pulse train
    return
      
      
      END                       ' Fin   :)

  6. #6
    Join Date
    Feb 2005
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    While debugging the firmware I took so many pictures that I decided to make a timelapse out of them

    Enjoy in 1080p


  7. #7
    Join Date
    Feb 2005
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    Solved the trigger by holding button, ingenuity works
    I still can't figure out why the led does not blink while counting time at the first while wend

    And I noticed the ASM SLEEP does not work, consumption is the same (0.4mA) regardless I use it or comment it out. I replaced @ sleep with ASM SLEEP ENDASM to compile with MPASM do I need to add something else?

    changed code:

    Code:
    '****************************************************************
    '*  Name    : pentax.BAS                                        *
    '*  Author  : PEU based on examples from www.rentron.com        *
    '*  Notice  : Copyleft (c) 2011                                 *
    '*          : No Rights Reserved on derived work                *
    '*  Date    : 05-ENE-11                                         *
    '*  Version : 1.10                                              *
    '*  Notes   : pablou at gmail dot com                           *
    '****************************************************************
    @ #define IRTX GPIO  ; Define port to use for IR out
    @ #define PIN 2      ; Define port pin to use for IR out
    
    ' 12F683.INC at picbasic folder has this defined already for MPASM use
    ' __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _CP_ON
    '@ device pic12f683,INTRC_OSC_NOCLKOUT , wdt_on, mclr_off, protect_on
    
    
    INCLUDE "DT_INTS-14.bas"
    INCLUDE "ReEnterPBP.bas"
    INCLUDE "Elapsed_INT.bas"   ; Elapsed Timer Routines  by Darrel Taylor
    
    DEFINE OSC 4
    
      GPIO = 0      
      TRISIO.2 = 0              ' LED IR
      TRISIO.1 = 0              ' Red LED 
      TRISIO.5 = 1              ' Normal open pushbutton (w/ pulldown)
      CMCON0   = 7              ' Comparators disabled
      ANSEL = 0                 ' A/D disabled
    '  GIE       VAR INTCON.7   ' Global interrupt enable 1=ON, 0=OFF
      GPIE      VAR INTCON.3    ' Port change interrupt enable 1=ON, 0=OFF
      GPIF      VAR INTCON.0    ' Port Change Interrupt Flag bit   
    
      Cycles    VAR BYTE    ' Number of carrier cycles
      ContaSec  var word    ' Seconds Counter
      TLFlag    var byte    ' Timelapse counter programmed?
      IRLED     var GPIO.2  ' alias LED IR
      LED       var GPIO.1  ' alias red LED 
      BOTON     var GPIO.5  ' pushbutton
      
      GIE = 0               ' Disable global ints
      GPIE = 1              ' Enable port change int
      IOC.5 = 0             ' Int-on-change for GPIO.5 disbled
      PAUSE 100             ' little pause to settle the processor after cold start
      
    
    GOTO OverASM            ' jump over ASM routines
    
    ' Generate "Cycles" number of ~38.4kHz pulses   Bruce at www.rentron.com
    ASM
    _Pulse38
       bcf IRTX,PIN         ; 1uS, LED=on
       goto $+1             ; + 2uS = 3uS
       goto $+1             ; + 2uS = 5uS
       goto $+1             ; + 2uS = 7uS
       goto $+1             ; + 2uS = 9uS
       goto $+1             ; + 2uS = 11uS
       goto $+1             ; + 2uS = 13uS   
       bsf IRTX,PIN         ; 1uS, LED=on
       goto $+1             ; + 2uS = 3uS
       goto $+1             ; + 2uS = 5uS
       goto $+1             ; + 2uS = 7uS
       goto $+1             ; + 2uS = 9uS
       nop                  ; + 1uS = 10uS
       decfsz _Cycles,f     ; + 1uS = 11S    
       goto _Pulse38        ; + 2uS = 13uS
       return               ; Return to caller    
    ENDASM
    
    ASM
    INT_LIST  macro         ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler   TMR1_INT,  _ClockCount,   PBP,  yes
        endm
        INT_CREATE          ; Creates the interrupt processor
    
        INT_ENABLE  TMR1_INT ; Enable Timer 1 Interrupts  
    ENDASM
    
    OverASM:                ' END of ASM routines
    
    contasec=0
    tlflag=0
    
    
                            ' New timer
    GOSUB ResetTime         ' Reset Time to  0d-00:00:00.00
    GOSUB StartTimer        ' Start the Elapsed Timer
                            
    while boton = 1         ' Loops while the button is pressed
            if SecondsChanged = 1 then 'if the seconds changed flash the red led
                high led
                pause 50      'should blink once a second but it doesn't
                low led
                SecondsChanged = 0      ' set flag back to 0
            endif
            tlflag=1        ' This flags lets me know if the timer was used
    wend
    
    contasec = Seconds + (Minutes * 60) ' Total time elapsed
    gosub StopTimer
    
    'Loop del TimeLapse      
    if tlflag = 1 then      ' if the timer was used continue
    
        while boton = 0  
            sleep contasec  ' sleep programmed time
            gosub trigger   ' trigger 
            high led        ' red LED on
            pause 50        ' little pause
            low led         ' red LED off
        wend
        
    ' Timelapse ended because the button was pushed
        for contasec = 1 to 15  ' flash red LED to let the user know
            high led
            pause 100
            low led 
            pause 100
        next
    
    endif
    
    IOC.5 = 1               ' Int-on-change for GPIO.5 enabled
    GPIO = 0   
    
    Main:                   ' main Loop 
    
      ASM
        SLEEP               ; Sleep
      endasm
        
      while boton=0         ' wait for button push
      wend
    
      GPIF = 0              ' Clear port change interrupt flag
    
      while boton=1         ' shoot while pressed    
        gosub trigger       ' trigger
        high led            ' blink red LED
        pause 50
        low led              
      wend
      
    GOTO Main
      
    Trigger:                ' PENTAX pulse train
      Cycles = 255      
      CALL Pulse38
      Cycles = 239      
      CALL Pulse38
      pauseus 3000
      cycles = 38
      CALL Pulse38
      pauseus 1000
      cycles = 38
      CALL Pulse38
      pauseus 1000
      cycles = 38
      CALL Pulse38
      pauseus 1000
      cycles = 38
      CALL Pulse38
      pauseus 1000
      cycles = 38
      CALL Pulse38
      pauseus 1000
      cycles = 38
      CALL Pulse38
      pauseus 1000
      cycles = 38
      CALL Pulse38
      pauseus 5000          ' end PENTAX pulse train
    return
      
      
      END                   ' Fin   :)

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts