Enabling internal pullups

f2cf1g

Member
Hi forum. I have been trying to enable the internal pullups on a 14M without success so far. I read the PIC data sheet which references the COMCON0, ANSEL, TRISA and WPUA registers in connection with WPU control. I wrote a simple test program to initialise these registers but it failed to deliver the goods. Out of curiosity I then wrote another program which simply reads these registers as initialised by the PICAXE interpreter.

Code:
#picaxe 14M
#no_table
#no_data
setfreq m8
pause 100
aa:	
	peek      $19,b1	'COMCON0
	peek	      $91,b2	'ANSEL
	peek      $85,b3	'TRISA
	peek	      $95,b4	'WPUA 
	sertxd("COMCON0 ",#b1," ANSEL ",#b2," TRISA ",#b3," WPUA ",#b4,13,10)
	pause 2000
	goto aa

The results I get are as follows:

COMCON0 = %00000111, ANSEL = %00000000, TRISA = %00111000, WPU = %00110111

My reading of the 16F684 data sheet is that this should enable the pullups but clearly it doesn't (and shouldn't). What am I missing?
Roy
 

f2cf1g

Member
Thanks Hippy, that did the trick for WPUA4 which I can now cycle OK. I still have some anomalies but they will have to wait until the morning. Thanks again. Roy
 

hippy

Ex-Staff (retired)
The way the PICmicro PORTA pins are allocated for PICAXE use, I think only WPUA4 will fuction ( Input Pin 4 ).

A0 - Used as Output Pin 0
A1 - Used as Output Pin 1
A2 - Used as Output Pin 2
A3 - No WPU by silicon design when Input Pin 3
A4 - Input Pin 4 ( works )
A5 - Serial In
 
Top