Don't you hate when you got the complicated thing to work, but the simple things just seem beyond you?
I'm building a IR Camera trigger using a PIC 16F648A, and I spent all last night getting the 38.5Khz modulated carrier to work perfectly. I was testing it on a timer, so that every 5 seconds, it would send the pulse out. I now want to try triggering it from a button press, but I don't seem to be having ANY luck getting the PIC to see the press.
Code is as follows:
I've tried using "While TRISB.4 = 0 : WEND", and that (if memory serves) just fires the subroutine constantly (which makes sense).Code:@ device pic16F648A, wdt_off, intrc_osc_noclkout, mclr_off, protect_off DEFINE OSC 4 CMCON = 7 ' Turn all comparators to fully digital (needed??) TRISB.3 = 0 ' IR Output Pin TRISB.4 = 1 ' Shutter Input Pin HPWM 1,127,38500 ' Configure HPWM for 50% duty cycle PWM signal at 38.5kHz CCP1CON = 0 'PWM OFF start: while TRISB.4 = 1 : WEND gosub shutter pause 250 goto start
I've attached the "schematic" for how the button is attached, just in case I've mangled that somehow. The button is a normally open momentary contact. I've checked with a logic probe that B4 on the PIC sits low normally, and goes high with the button press.
Sadly enough, I'm pretty sure this is going to be one of those simple "you missed..." answers.
Thanks in advance!




Bookmarks