PDA

View Full Version : Config word / pullup resistors



Tomexx
- 24th November 2004, 01:21
Hi,
Couple of questions:
1.
I've been playing with 16F628A till now and was putting the following line at the top of my programs to set the config word:


@ DEVICE PIC16F628A, INTRC_OSC_NOCLKOUT, WDT_OFF, LVP_OFF, PWRT_OFF, PROTECT_OFF, BOD_OFF

I'm getting a 16F877A (it's on order). What would be the correct config word for use with the F877A (I'll be using an external crystal)?

2.
If I can enable "weak pullup resistors" on Ports A & E of the F877A, does this mean that I don't have to use real resistors for the inputs on those ports?

Thanks,
Tom

mister_e
- 24th November 2004, 05:07
I'm getting a 16F877A (it's on order). What would be the correct config word for use with the F877A (I'll be using an external crystal)?


well depending of what you want to set... if external crystal is 20 MHZ

@ DEVICE PIC16F877A, HS_OSC


here's the list for config

;================================================= =========================
;
; Configuration Bits
;
;================================================= =========================

_CP_ALL EQU H'1FFF'
_CP_OFF EQU H'3FFF'
_DEBUG_OFF EQU H'3FFF'
_DEBUG_ON EQU H'37FF'
_WRT_OFF EQU H'3FFF' ; No prog memmory write protection
_WRT_256 EQU H'3DFF' ; First 256 prog memmory write protected
_WRT_1FOURTH EQU H'3BFF' ; First quarter prog memmory write protected
_WRT_HALF EQU H'39FF' ; First half memmory write protected
_CPD_OFF EQU H'3FFF'
_CPD_ON EQU H'3EFF'
_LVP_ON EQU H'3FFF'
_LVP_OFF EQU H'3F7F'
_BODEN_ON EQU H'3FFF'
_BODEN_OFF EQU H'3FBF'
_PWRTE_OFF EQU H'3FFF'
_PWRTE_ON EQU H'3FF7'
_WDT_ON EQU H'3FFF'
_WDT_OFF EQU H'3FFB'
_RC_OSC EQU H'3FFF'
_HS_OSC EQU H'3FFE'
_XT_OSC EQU H'3FFD'
_LP_OSC EQU H'3FFC'


2.
If I can enable "weak pullup resistors" on Ports A & E of the F877A, does this mean that I don't have to use real resistors for the inputs on those ports?


that's suppose to do it. but usually i always use external pullups as safe. maybe i'm wrong here


regards`

Melanie
- 25th November 2004, 00:36
You don't get internal weak Pull-Up's on Ports A & E, just on Port B.

Tomexx
- 25th November 2004, 03:46
Thanks Melanie, I thought I read somewhere about the pullups on ports A & E. Must have been something else.

Anyway, do you use real resistors even when pullups are enabled on port B?

Melanie
- 25th November 2004, 09:46
If the internal weak pull-up's were of no use, then MicroChip wouldn't have included them.

It depends on your application. As pull-ups for Buttons, absolutely perfect. As pull-ups for a cheap way of interfacing slow-speed devices (< 10K), even opto-couplers, perfect. As pull-ups for high speed devices (such as on an I2C bus), they're too weak. Also depends on the environment... in an industrial noisy environment, they're too weak, you need something heavier. In a domestic or non-critical commercial environment, again perfect.

Don't be afraid to use the internal weak pull-up's. I use them a lot (even in industrial applications).

mister_e
- 25th November 2004, 17:50
Hi Melanie,
I was a bit confused about these internal pullups. Now it's a little more clear about their use.

But as a safe i always use external one. Also as a safe i always tie to ground/VCC unused pin to avoid interference or PIC malfunction or PIC blow due to environement as i got in the past.

thanks for making things clear here!

regards