Stupid simple question.....


Closed Thread
Results 1 to 19 of 19

Hybrid View

  1. #1
    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.

  2. #2
    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.

  3. #3
    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

  4. #4
    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.

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default

    Hi,
    If you look at section 4 in the datasheet you'll see a note there saying:
    Note: The ANSEL and CMCON0 registers must be initialized to configure an analog channel as a digital input. Pins configured as analog inputs will read ‘0’.
    There's also an example showing how to do it but it's in ASM so it's not that easy to understand.

    If you then look at figure 8.4 you'll see the various configurations for the comparator module and in the bottom right hand corner it shows that you should write 7 (the three lower bits are set) to CMCON0 in order to disable the comparator.

    If you then look at the bottom of table 2.2 it'll show you that ANSEL "comes up" with the lower 4 bits set and if you look at register 4-3 (page 33) you'll see that when bit 0-3 is set it means that the pin is in "analog mode".

    As for the rest, $9F is the adress for ANSEL register and $19 is the adress for the CMCON0 register and that can be found if you look at figure 2.2 in the same datasheet. PBP makes it a lot easier as it allows you to write directly the the registers without having to look up the actual adress of it "manually".


    It's a very common thing to overlook untill you've been bitten by it, next time a pin doesn't work as you think it should it'll be the first thing you'll think of checking ;-)

    /Henrik.

  6. #6
    Join Date
    Jun 2008
    Posts
    16


    Did you find this post helpful? Yes | No

    Default

    oy...
    Thanks guys, you rock..
    How I wish I could be using my Arduino for this project..
    www.theLanguageBear.com - Multi-Lingual books for kids and adults of all skill levels.

  7. #7
    Join Date
    Jun 2008
    Posts
    16


    Did you find this post helpful? Yes | No

    Default Another dumb ass problem

    I really hate this stuff.... it makes me want to stab myself in the eyeball with a fork.

    I'm measuring 3v from Pin1 (GP1) on my 12F683.
    I'm using a 3v coin cell. It measures 3v.
    I connect a LED to Pin1, it lights.
    YAY! Next frickin challenge....

    I connect a small vibe motor to my 3v battery, it vibrates like crazy. Yay.
    I connect my small vibe motor to Pin1 (measuring 3v) It does absolutely nothing.
    I connect the LED to Pin1.. it lights..
    I connect the motor to Pin1 ... it does nothing
    I punch stuff... that doesn't help.

    I don't know what else to try...
    The vibe motor draws about 35-40mA

    I see that the IO pins supply 25 mA but the GPIO can supply 90mA...
    What's the difference?
    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