Help with pic 12f629


Closed Thread
Results 1 to 40 of 53

Hybrid View

  1. #1
    Join Date
    Sep 2010
    Posts
    23

    Default Help with pic 12f629

    Hi there,

    I am new to this worl of pics, and know very little about them. I started this as a new hobby, and got really into it.

    At the moment, I am having difficulties to make my pic count upto 3 presses of a switch connected to pin 2, and turn off a led connected to pin 1.

    Please any advice will be much appreciated.

    Best regards.
    Frank.
    Code:
    cnt VAR BYTE
    boton VAR GPIO.2
    mosfet VAR GPIO.1
    
    CMCON = 7
    
    'Ports
    Output mosfet
    Input boton
    
    cnt=0
    boton = 1
    
    'Begin Program
    TEST:
    high mosfet
    count 2, 1, cnt
        if cnt = 3 then
            cnt = 0
            low mosfet
            pause 1000
        endif
    
    
    GOTO TEST
    end

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Welcome to the forum.

    Maybe this will get you started.
    Code:
    CHECK:
    high mosfet
    IF boton = 0 THEN TEST
    GOTO CHECK
    
    TEST:
    cnt = cnt +1
    IF cnt = 3 THEN OFF_LED
    RETURN
    
    OFF_LED:
    cnt = 0
    low mosfet
    pause 1000
    GOTO CHECK
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Sep 2010
    Posts
    23


    Did you find this post helpful? Yes | No

    Default

    Thanks Dave!!! grate stuff!!!
    I will post the results later on.

    Thanks again.

  4. #4
    Join Date
    Sep 2010
    Posts
    23


    Did you find this post helpful? Yes | No

    Default

    No Dave...no luck....I am going mad!!!....

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    What exactly is happining?
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default

    now to show off my newbieness. If that is the entire program, won't he need SOME sort of init type stuff? setup tris,osc,...? something?
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

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