12F675 output dependency


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2007
    Posts
    12

    Default 12F675 output dependency

    I'm using PIC12F675. I have problems with digital outputs. It seems, that they are dependent to eachother.

    DEFINE OSC 4 ' 4MHZ
    ADCON0 =0 ' No analog inputs
    ANSEL = 0
    VRCON = 0
    TRISIO = %00000000 ' Only digital outputs

    loop:
    GPIO.0 = 1 'LED 0
    Pause 1000

    GPIO.2 = 1 'LED 2
    Pause 1000

    GPIO.1 = 1 'LED 1
    PAUSE 1000

    goto loop
    end

    The outcome of this code is following:
    LED 0 turns on, pause,
    LED 0 turns off and LED 2 turns on, pause,
    LED 1 turns on, pause,
    LED 1 turns off and LED 0 turns on.
    etc.
    LED 2 remains all the time switched on. It seems, that GPIO.2 is somehow independent, and GPIO.0 and GPIO.1 are dependent. Why is it so? What I'm doing wrong? As much as I've read about it, all digital outputs should be independent.

    Kristjan

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


    Did you find this post helpful? Yes | No

    Default

    How about if you add CMCON=7 ?

    sure i miss something around OPTION_REG.5=0 or something like that... i feel lazy today...
    Last edited by mister_e; - 4th May 2007 at 23:57.
    Steve

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

  3. #3
    Join Date
    May 2007
    Posts
    12


    Did you find this post helpful? Yes | No

    Default

    Yep. It works now Tnx.
    Stupid question maybe, but why CMCON has to be 7 not 6 or 5? If I want to use also some analog inputs, then how CMCON has to be set? I'm also trying to find out the answer by myself.

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


    Did you find this post helpful? Yes | No

    Default

    Look at section 7 (if my memory serves me well) of your datasheet (analog comparator section) there, should should find a table with the possible settings.

    Analog comparator and analog to digital converter are two different animals...
    Steve

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

  5. #5
    Join Date
    May 2007
    Posts
    12


    Did you find this post helpful? Yes | No

    Default

    Tnx. I got my problem solved

Similar Threads

  1. Help changing CCP3 output pin
    By ChrisHelvey in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 15th July 2008, 03:30
  2. Bit Banging input to output on PIC16F876A
    By Bronurstomp in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 26th June 2008, 20:50
  3. Serious Serial Situation Setbacks...
    By Dansdog in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th February 2007, 04:46
  4. Using LEDs as light sensors
    By skimask in forum Code Examples
    Replies: 3
    Last Post: - 30th December 2006, 23:19
  5. HSEROUT Newbie question/problem
    By Mark Scotford in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 11th July 2006, 15:44

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