PDA

View Full Version : 16f630 help please



grounded
- 25th August 2005, 02:04
I've been using the 12f629 on few home hobby projects and now I need more I/O and I found that the 16f630 is about the same as the 629 but with more I/O and should fill the need. what little programing I do I use PBP-CDlite
this is how I was shown to config. the I/O , set to digital and turn weak pull ups on. But Iam not sure how to do it with the 16f630. Any help?. Looking at the data sheet I can read that RC0-RC5 do not have weak pulls.
If some one would show me how to read the data sheet to config the I/O and pullups I would be very thankful

@ DEVICE pic12F629

TRISIO = %00001100 ' make gpio 2 / 3 inputs

' FOR REFERENCE ONLY
'00111111 = ALL PINS INPUTS

'00100000= GPIO.5 PIN 2 IS A INPUT
'00010000= GPIO.4 PIN 3 IS A INPUT
'00001000= GPIO.3 PIN 4 IS A INPUT
'00000100= GPIO.2 PIN 5 IS A INPUT
'00000010= GPIO.1 PIN 6 IS A INPUT
'00000001= GPIO.0 PIN 7 IS A INPUT



OPTION_REG.7 = 0 ' gpio 0 - 2 digital
WPU = 255 ' week pull ups on all pins
CMCON = 7 ' turn weak pull ups on

SYMBOL RED = GPIO.0 'PIN 7
SYMBOL GREEEN = GPIO.1 'PIN 6
SYMBOL PB = GPIO.2 'PIN 5
SYMBOL BLUE = GPIO.4 'PIN 3
SYMBOL ORANGE = GPIO.5 'PIN 2

grounded
- 26th August 2005, 02:27
OK I think I've got the I/O config

TRISA =
00111111= ALL PINS INPUTS
00100000 =PORTA.5 /PIN 2 IS A INPUT
00010000=PORTA.4/PIN 3 IS A INPUT
00001000=PORTA.3/PIN 4 IS A INPUT (can only be input)
00000100=PORTA.2/PIN 11 IS A INPUT
00000010=PORTA.1/PIN 12 IS A INPUT
00000001=PORTA.0/PIN 13 IS A INPUT
TRISC =
00100000=PORTC.5 /PIN 5 IS A INPUT
00010000=PORTC.4/PIN 6 IS A INPUT
00001000=PORTC.3/PIN 7 IS A INPUT
00000100=PORTC.2/PIN 8 IS A INPUT
00000010=PORTC.1/PIN 9 IS A INPUT
00000001=PORTC.0/PIN 10 IS A INPUT

but still not sure on the turning on weak pull ups
any help

Melanie
- 26th August 2005, 02:58
Weak Pull-Up's are only avaialble on PortA on this PIC with the exception of RA3 which does not have one.

There are TWO STEPS to enabling the Weak Pull-Up's on this PIC...

Step 1. You must first enable the Weak Pull-Ups by CLEARING the RAPU bit in the OPTION Register (see Datasheet section 2.2)... ie...

OPTION_REG.7=0

Step 2. Then you have to INDIVIDUALLY SET the bits for each pin you require them on in the WPUA Register (Datasheet 3.3). For example if you wish weak pull ups on RA0, RA1 and RA4, then you would set...

WPUA=%00010011

grounded
- 26th August 2005, 04:29
thank you
just trying to learn