GPIO.2 of 12F509 doesn't work.


Closed Thread
Results 1 to 5 of 5
  1. #1
    Peter Oors's Avatar
    Peter Oors Guest

    Unhappy GPIO.2 of 12F509 doesn't work.

    At the first time of using the 12F509 instead of the 12F629 I discovered a problem.
    @ device INTRC_OSC,MCLR_OFF
    'cmcon=7 'for the 12F629 only
    trisio=%001000
    GPIO=%000000
    GPIO=%110111
    Pause 1000
    GPIO=%000000
    Stop

    All 5 outputs of the 629 went high for 1 second.
    The 509 GPIO.2 doesn't do anything, GPIO.0, 1, 4 and 5 went high for one second.
    Both PIC's are tested on the same PCB.
    What could be wrong or what do I do wrong?
    I use PBP2.46, MPLab7.1 and PICStart Plus.

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Try this... and tell us if it works...

    Code:
    	TRISIO=%00001000
    Loop:	
    	High GPIO.2
    	Pause 1000
    	Low GPIO.2
    	Pause 1000
    	Goto Loop
    
    	end

  3. #3
    Peter Oors's Avatar
    Peter Oors Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie
    Try this... and tell us if it works...

    Code:
    	TRISIO=%00001000
    Loop:	
    	High GPIO.2
    	Pause 1000
    	Low GPIO.2
    	Pause 1000
    	Goto Loop
    
    	end
    Hello Melanie,
    I tried and: GPIO.2 stays low, GPIO.0 , 1 , 4 and 5 are high.
    If I put GPIO=%00000000 after Trisio all outputs are low.
    I took a new PIC509 and the same happens, very strange.
    The 629 GPIO.2 works fine.....

  4. #4
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Datasheet, Datasheet, Datasheet!!!!!

    Really.... you gotta get this tatooed in some prominent place...

    Walk with me on this one...

    GPIO.2 is also the T0CKI pin...

    Table 6-1 on Page 34 Reference Note (3) at the bottom states "The TRIS of the T0CKI pin is over-ridden when T0CKS=1". There's also a great-big NOTE to this effect at the top of Page 22!

    T0CKS is part of the OPTION REGISTER.

    See Register 4-3 on Page 22 and cross-reference this with Table 7-3 (Reset Conditions) on Page 44... you will note that this register bit is set to '1' on Power-up, therefore TRISIO is over-ridden...

    So set OPTION_REG.5=0 before your TRISIO statement.

  5. #5
    Peter Oors's Avatar
    Peter Oors Guest


    Did you find this post helpful? Yes | No

    Talking

    Thanks Melanie,

    It's all working now.
    Your explanation was very clear.
    I understand now why it didn't work, but I couldn't find it out by myself.

    Thanks a lot.

Similar Threads

  1. 12F509 doesn't do anything
    By madphys in forum General
    Replies: 2
    Last Post: - 31st January 2010, 09:00
  2. Timer and 12F509
    By Pedro Santos in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 3rd November 2008, 14:51
  3. 12F629 Strange interupt behavior
    By BGreen in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 25th May 2007, 15:35
  4. blink.bas help cant make any 18f's work
    By Bonxy in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 13th December 2004, 21:28
  5. Pin RA4 doesn't work
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 0
    Last Post: - 15th July 2004, 12:03

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