Stupid simple question.....


Closed Thread
Results 1 to 19 of 19

Hybrid View

  1. #1
    Join Date
    Jun 2008
    Posts
    16

    Default Stupid simple question.....

    I'm trying to make a button work...
    here is my test code:

    Code:
    input Pin4
    
    loop:
    
    if Pin4 = 1 then cycle
    
    goto loop
    
    
    cycle:
    
    if Pin4 = 0 then loop
    
    high 0 : pause 100
    high 1 : pause 100
    high 2 : pause 100
    low 0 : pause 100
    low 1 : pause 100
    low 2 : pause 100
    
    
    goto cycle
    
    
    end
    When I connect pin4 to high nothing happens... Do I need to pull the pin high or low or something? Should I have something other than the "input Pin4" command?

    This seems like it should be super fricking simple, but it just doesn't work... I feel like I'm taking crazy pills!! Someone please help.
    www.theLanguageBear.com - Multi-Lingual books for kids and adults of all skill levels.

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Pin4 is usually PORTB.4, and not actually Pin4 on the chip.

    Which chip are you using?
    <br>
    DT

  3. #3
    Join Date
    Jun 2008
    Posts
    16


    Did you find this post helpful? Yes | No

    Default

    I'm using a 12F683, GP4 (which I believe is the same as PORTB.4?) is Pin3.
    www.theLanguageBear.com - Multi-Lingual books for kids and adults of all skill levels.

  4. #4
    Join Date
    Jun 2008
    Posts
    16


    Did you find this post helpful? Yes | No

    Default

    I could use some help here... I am completely at a loss. I can't get any input to work at all, am I going crazy?
    www.theLanguageBear.com - Multi-Lingual books for kids and adults of all skill levels.

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    For a 12F683, you need to turn off the Analog inputs and Comparator.

    SYMBOL ANSEL = $9F
    SYMBOL CMCON0 = $19

    POKE ANSEL, 0
    POKE CMCON0, 7

    hth,
    DT

  6. #6
    Join Date
    Jun 2008
    Posts
    16


    Did you find this post helpful? Yes | No

    Default

    I cannot express enough gratitude. It works! Thank you so much kind sir. Now where might one learn a bit of information like that? That seems fairly basic, but I don't recall coming across that in any of my "pic'n" books or the 12F datasheet...
    www.theLanguageBear.com - Multi-Lingual books for kids and adults of all skill levels.

Similar Threads

  1. Really simple question for you experts :)
    By lew247 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 4th June 2008, 01:43
  2. SIMPLE question
    By ngeronikolos in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 5th February 2008, 18:27
  3. Stupid question
    By Meriachee in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 20th July 2007, 05:47
  4. really simple, dumb question
    By picster in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 3rd March 2007, 22:02
  5. really simple adcin question
    By kitcat in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 21st April 2006, 09:06

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