Trouble with PIC12F683 - GP0 GP1 as inputs


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2007
    Posts
    74

    Default Trouble with PIC12F683 - GP0 GP1 as inputs

    Having trouble gettin the PIC to understand that I want GPIO.0 and GPIO.1 set as inputs, when receiving a 5v signal on either port to execute accordingly. Instead it sits there and does nothing, I think it is in the registers.

    define OSC 4 'Set oscillator (clk) to 4MHz
    GPIO = %00001000 'High/Low
    TRISIO = %00101011 'Input/Output
    ANSEL = %00110000
    CMCON0 = %00000000
    CCP1CON = %00000000
    VRCON = %00000000

    'ADCON0 = %00000000
    'OPTION_REG = %0
    'WPU = %00000011

    only common points these two pins share is serial programmer, and comparator inputs, and convienently the comparator ouput pin as an output works just fine!

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by erice1984 View Post
    CMCON0 = %00000000
    ... only common points these two pins share is serial programmer, and comparator inputs, and convienently the comparator ouput pin as an output works just fine!
    Exactly as it should.

    Comparator mode 0 has both GP0 and GP1 as ANALOG inputs, with GP2/COUT as DIGITAL.
    Configurations can be seen in FIGURE 8-3 COMPARATOR I/O OPERATING MODES.

    The configuration you want is CMCON0 = %00000111 ... (ALL DIGITAL).
    <br>
    DT

  3. #3
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    sorry, I didnt make my question clear enough.

    I don't want to use the comparator. I just want them GP0, GP1 as inputs, and GP2 stays as output to flash a simple LED.

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


    Did you find this post helpful? Yes | No

    Default

    OR ... maybe I wasn't clear ...

    Cause that's what I meant too.
    <br>
    DT

  5. #5
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    lol, I test it. and it just goes crazy and nothing else seems to work.

    I dont know, maybe I should just play with it. I wish they had a register that would DISABLE it completely, not make me fumble with options until I find the right combination

  6. #6
    Join Date
    Jul 2007
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    nevermind, you were right, I was wrong.

    I switched from my program I had working and everything and went to my 'trusted' test program, forgot about using the MCLR pin as an input, saw it, corrected it.

    The settings you proposed work as we both thought they should have.

    Thanks for the help

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


    Did you find this post helpful? Yes | No

    Default

    There's one you won't forget next time.

    Cheers!
    <br>
    DT

Members who have read this thread : 1

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