+ Reply to Thread
Results 1 to 3 of 3

Thread: Internal pullups not working on PIC12F675

  1. #1
    Yobortsa Newbie
    Join Date
    Aug 2009
    Location
    Brisbane, Australia
    Posts
    26

    Internal pullups not working on PIC12F675

    Hi all,

    Does anybody have any idea why internal pullups might be working on GPIO5 but not GPIO4 on a PIC12F675?

    Code:
    RESET	clrf	STATUS			;
    		clrf	GPIO			; Init GPIO
    		movlw	b'00000111'		;
    		movwf	CMCON			; comparator off, digital I/O
    		bsf     STATUS,RP0      ; bank 1                          |B1
            call    h'3FF'          ; get factory calibration value   |B1
            movwf   OSCCAL          ; set OSCCAL calibration value    |B1
    		movlw   b'00111000'     ; Set 0,1,2 to outputs; 3,4,5 to inputs (switches)
            movwf   TRISIO          ; 
    		movlw	b'00110000'		; Enable port 4,5 pullups
    		movwf	WPU				; Set Weak Pull Up register
      		bcf     OPTION_REG, 7	;  Enable Pull Ups
            bcf     STATUS,RP0      ; bank 0                          |B0
    
    I have tried programming with PICKit1 and PICKit2 and on test boards with connections going nowhere GPIO5 works fine (5V) but GPIO4 has varying voltage below 1.3V. I have tried with 3 PIC chips. Have also tried in my circuit which has GPIO4 and GPIO5 going to ground via microswitches. I never get GPIO4 held high with internal pullup. Do I need to disable the Analog port somehow perhaps?

    Regards,

    David


  2. #2
    geko Good geko Good geko Good geko Good
    Join Date
    Mar 2006
    Location
    Rutland, England, UK
    Posts
    247

    Yes you need to clear the bit in the ANSEL register to set the port bit to digital mode. Check the datasheet for more info.

  3. #3
    Yobortsa Newbie
    Join Date
    Aug 2009
    Location
    Brisbane, Australia
    Posts
    26

    Yep, worked - thankyou so much

    Code:
    clrf ANSEL
    

+ Reply to Thread

Similar Threads

  1. Pullups - Rule of thumb?
    By UTMonkey in forum General Electronics Chat
    Replies: 5
    Latest: 10th May 2008, 08:07 AM
  2. PIC12f675
    By MERV in forum Micro Controllers
    Replies: 18
    Latest: 10th December 2007, 08:18 PM
  3. Reprogramming PICs with Internal OSC on & MCLR disabled (internal) Inchworm+
    By blueroomelectronics in forum Micro Controllers
    Replies: 5
    Latest: 11th April 2007, 05:10 PM
  4. BAD night.. 16F628A weak pullups.
    By mramos1 in forum Micro Controllers
    Replies: 6
    Latest: 12th December 2006, 05:57 PM
  5. internal comparator - table (pic12f675)
    By alamy in forum Micro Controllers
    Replies: 3
    Latest: 30th September 2004, 06:55 AM

Tags for this Thread