Noobie Question


Closed Thread
Results 1 to 20 of 20

Thread: Noobie Question

Hybrid View

  1. #1
    Join Date
    Jun 2006
    Posts
    60

    Default Noobie Question

    I'm using a 12f675 to control a camera to take pictures of wildlife.I have a motion sensor hooked to gp3 which is a input only, but can't figure out why it never reads this. I need to hold that input low until the motion sensor sees motion which will bring this input high. Here's the code.********************************************* *******************
    '* Name : hpcam.BAS *
    '* Author : [select VIEW...EDITOR OPTIONS] *
    '* Notice : Copyright (c) 2006 [select VIEW...EDITOR OPTIONS] *
    '* : All Rights Reserved *
    '* Date : 6/22/2006 *
    '* Version : 1.0 *
    '* Notes : *
    '* : *
    '************************************************* ***************
    symbol cambut=4
    symbol pir=pin3
    symbol on=2
    symbol lite=1
    symbol led=0
    symbol counter=5
    symbol CMCON=$19
    symbol ANSEL=$9f

    main:
    poke ANSEL,$00
    poke CMCON,$07
    high on
    pause 250

    loop:
    if pir=1 then takepic
    high led
    pause 250
    low led
    pause 250
    b1=b1+1
    if b1>230 then camoff
    goto loop

    camoff:
    low on
    pause 2000
    high on
    pause 8000
    b1=0
    goto loop

    takepic:
    high lite
    pause 250
    high cambut
    pause 1000
    low lite
    low cambut
    pulsout 5,2
    pause 250
    for b0=1 to 4
    pause 60000
    high led
    pause 250
    low led
    next b0
    goto camoff

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    as i'm not familiar with the PBC lines i can just ask if you correctly set the configuration fuse when you program your device?

    Be sure you set MCLR to i/o, internal or INTRC depending of the syntax of your device programmer software.

    If your PIR signal is comming from a relay (wich i suspect) be sure you're using pull down/up resistor... uneless this pin is floating and it may work sometimes, sometime not.

    EDIT: by reading your post again... i suspect you miss the pull-down resistor
    I need to hold that input low until the motion sensor sees motion which will bring this input high.
    Last edited by mister_e; - 28th June 2006 at 03:34.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Jun 2006
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    I have a 10k pulldown resistor on board, the motion sensor gives a +5 volts when triggered, which should pull this input high. I have one of these working using a PICAXE chip, but switched chips to gain the extra I/O. I just need to know how to configure the GP3 pin. Sorry for not making this clear on first post. Thanks for any help.

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    O.K.
    whe you program your PIC, your device programmer software MUST allow you to set the configuration fuse somewhere. Find it first..

    Got it?

    Now it must have at least 1 place to configure the MCLR pin and one other for the Oscillator

    YES... set it to I/O, INTRC, or something else than MCLR or RESET.

    This is a ScreenShot of PICSTART (MPLAB)
    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=942&stc=1&d=1151464220 ">

    This is a screenshot of BK precision 844a
    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=941&stc=1&d=1151464220 ">


    About now?
    Attached Images Attached Images   
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    In addition to Steve's comments ...

    Does your LED blink while waiting for PIR to go high? (i.e., Is your PIC alive - are you sure the PIC is working.)

    What happens if you hardwire GP3 high – does your IF THEN catch it and turn on your camera?

    Have you measured GP3 with a meter to make sure it really goes high when the PIR is triggered?

    Is there a chance you could be missing the PIR high signal? Your loop only looks for high signal once (for a singe uS) every ½ second.

    You have not initialized b1 to zero at the beginning of your code. It gets set later but you should set it early as well.

    Is this the same program you used with your axe?

    I just need to know how to configure the GP3 pin
    you have no choice it is auto configured as an input, which is what you want.

    Out of interest, what are you going to film? A guy a few weeks ago set one of these up to video hedgehogs.

    Paul Borgmeier
    Salt Lake City, Utah
    USA

  6. #6
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by paul borgmeier
    you have no choice it is auto configured as an input, which is what you want.
    Only if you set the config fuse to disable MCLR and make GPIO.3 an input.
    Attached Images Attached Images  
    Last edited by dhouston; - 28th June 2006 at 11:37.

  7. #7
    Join Date
    Jun 2006
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    Thanks for all the help, the program is working like a champion. My resistor on GP3 pulling to ground was not pushed into proto board all the way.
    Also for Paul, I'm using this to run a digital camera to photograph deer.THANKS again for everybody's help. I'm sure you'll be hearing from me again, as I'm building a solar charger for this camera setup, just not sure what I want it to do yet.

Similar Threads

  1. Extreme Noobie question 12F675
    By Jeff in forum mel PIC BASIC
    Replies: 11
    Last Post: - 22nd September 2009, 01:13
  2. noobie to PICs and PBPro... Programming question.
    By mcphill in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 25th October 2007, 18:35
  3. noobie question
    By 02GF74 in forum General
    Replies: 1
    Last Post: - 29th November 2006, 18:47
  4. Question for a math guru
    By Christopher4187 in forum General
    Replies: 3
    Last Post: - 22nd November 2006, 09:45
  5. Please answer my first question
    By John_001 in forum Off Topic
    Replies: 1
    Last Post: - 15th September 2006, 06:49

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