Searching \ for 'Beginner needs help' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=beginner+needs+help
Search entire site for: 'Beginner needs help'.

Truncated match.
PICList Thread
'Beginner needs help'
1996\09\30@141741 by D. R. Chicotel

flavicon
face
I am new to PICs and would appreciate some help.  My question concerns the
use of resistors.  What is a "pull-up" resistor for, why and when do you
need it?  I see them used sometimes and not other times.  Can you connect an
I/O pin directly to 5 volts and read a logic high or is a resistor of some
kind needed. Can you connect an I/O pin directly to another I/O pin or to a
pin from other TTL chips, transistor etc.?  Is there some rule of thumb that
I don't know about?  I know my ignorance is bare naked here, but bear with me.

Thanks in advance.

1996\09\30@150516 by fastfwd

face
flavicon
face
D. R. Chicotel <spam_OUTPICLISTTakeThisOuTspamMITVMA.MIT.EDU> wrote:

> I am new to PICs and would appreciate some help.  My question
> concerns the use of resistors.  What is a "pull-up" resistor for,
> why and when do you need it?

Some ICs have output pins that can drive both high and low... You may
want to think of them as a switch that cen be toggled instantaneously
between +5 and Ground.  With the outrput driving high, such a switch
would look like this:

   +5V
    |
    |
    |
    o
     \
      \____________ Output Pin


    o
    |
    |
    |
   GND

...And with the output low, the switch would look like this:

   +5V
    |
    |
    |
    o

       ____________ Output Pin
      /
     /
    o
    |
    |
    |
   GND

When (most) PIC I/O pins are configured as outputs, for instance,
they behave this way.  No pullup resistor is needed for this output to
drive another input.

Some ICs, on the other hand, have output pins that can only drive
LOW; in their other state, they're just OPEN.  Pictorially, they
look like this:

      \
       \__________ Output Pin
   o
   |
   |
   |
  GND

These outputs are called "open collector" or "open drain".  For an
input to "see" a high level when the switch is open, you need to add
a pullup resistor, like this:

            +5V
             |
             |
             \
             /
             \
      \      |
       \_____|____ Output Pin
   o
   |
   |
   |
  GND

With the pullup resistor in place and the switch open, the output
pin is PULLED UP (through the resistor) to 5V.  When the switch is
closed, there's MUCH less resistance between the output pin and GND
than between it and +5V, so the output pin is pulled down to
(essentially) ground.

Does that help?  I've tried to make this easy to understand, so I've
glossed over some of the finer points.  If you have more questions,
please feel free to ask.

-Andy

Andrew Warren - .....fastfwdKILLspamspam@spam@ix.netcom.com
Fast Forward Engineering, Vista, California
http://www.geocities.com/SiliconValley/2499

1996\09\30@150720 by Miller, Steve

flavicon
face
Hello,

Pullup resistors have two common uses.

1.  They are used to pull unused input pins to a Logic High, usually
five volts. While you can tie inputs directly to five volts, a resistor
is  often used so that at a later time an output from another device can
be  connected to this unused input without harm.  If the input is
connected
directly to five volts, then this direct connection would have to be
removed before an output from another device can be hooked to the  input
pin.  With a pullup resistor, the connection can be made without
removing the resistor.  This is because the resistor limits the sink
current into the output of the driving device to a safe level.

2.  The other use is when the output device where your signal is
exiting from is an open collector device.  Open collector systems have
an internal transistor that can drive the pin to LOGIC Low, but there is
no provision to pull the line to 5 volts for a LOGIC One.   The pullup
resistor provides this path to 5 volts.  On an open collector output if
you omit the pullup resistor, you willl never output a LOGIC One.  The
reason for open collector outputs is to allow several output to be
connected in parallel.  I2C and SDI buses that allow numerous chips  to
be connected together in a bus use open collector outputs.  Any  output
in an open collector system can pull the line Low without  any  damage to
itself or another device.

Quick rule of thumb:

If you need to connect any pin of a microcontroller to Vcc (5 volts) or
whatever the power supply is,  use a resistor of 4700 ohms.  You usually
cannot go wrong adding this resistor, it may not be necessary, but you
will be safe.  If the manufacturer or someone tells you expicitly to make
a direct connection, then do it.  However, when in doubt use a resistor
first.
(Of course the VCC power input to the chip goes directly to the power
supply with no resistor.)
----------
From:  pic microcontroller discussion [SMTP:PICLISTspamKILLspamMITVMA.MIT.EDU]
Sent:  Monday, September 30, 1996 1:16 PM
To:  Multiple recipients of list PIC
Subject:  Beginner needs help

To:           Multiple recipients of list PICLIST
<.....PICLISTKILLspamspam.....MITVMA.MIT.EDU>

I am new to PICs and would appreciate some help.  My question concerns
the
use of resistors.  What is a "pull-up" resistor for, why and when do you
need it?  I see them used sometimes and not other times.  Can you connect
an
I/O pin directly to 5 volts and read a logic high or is a resistor of
some
kind needed. Can you connect an I/O pin directly to another I/O pin or to
a
pin from other TTL chips, transistor etc.?  Is there some rule of thumb
that
I don't know about?  I know my ignorance is bare naked here, but bear
with me.

Thanks in advance.

1996\09\30@190640 by Robert Lunn

flavicon
face
>Pullup resistors have two common uses.
>
> 1.  They are used to pull unused input pins to a Logic High, usually
> five volts. While you can tie inputs directly to five volts, a resistor
> is often used so that at a later time an output from another device can
> be connected to this unused input without harm.  If the input is
> connected
> directly to five volts, then this direct connection would have to be
> removed before an output from another device can be hooked to the input
> pin.  With a pullup resistor, the connection can be made without
> removing the resistor.  This is because the resistor limits the sink
> current into the output of the driving device to a safe level.
>
> snip...

       Historically, the pull-up resistor was required with unused
       _TTL_ inputs to limit the current into the gate (and this is
       where the later reference to a 4700 ohm resistor derives).

       This had nothing to do with subsequently wishing to connect
       a signal to the unused input.

       The nature of _CMOS_ inputs is such that a resistor is not
       needed to limit the current.  A CMOS input can be connected
       directly to a power rail without excessive current drain.

       In my experience, it is not standard practice to include
       pull-ups on unused CMOS inputs.

       The argument given for using pull-ups is valid.  Its level
       of persuasion depends on the particular application.

___Bob

1996\09\30@215704 by John Payson

flavicon
face
> I am new to PICs and would appreciate some help.  My question concerns the
> use of resistors.  What is a "pull-up" resistor for, why and when do you
> need it?  I see them used sometimes and not other times.  Can you connect an
> I/O pin directly to 5 volts and read a logic high or is a resistor of some
> kind needed. Can you connect an I/O pin directly to another I/O pin or to a
> pin from other TTL chips, transistor etc.?  Is there some rule of thumb that
> I don't know about?  I know my ignorance is bare naked here, but bear with me.

A digital input pin on may be thought of as having small capacitors to +5
and to ground, and (usually) large resistors in series to both.  Generally
the capacitor to ground is larger than the one to +5 (though both are small);
depending upon the chip, the implicit resistors to +5 or ground may be very
large and they may or may not be sufficiently unbalanced that the input
swings consistently to +5 or ground.

Whenever possible, all inputs should be at a voltage potential of less than
1v or more than 4v.  While some chips (such as the 8x51) have inputs with
sufficiently small resistors to +5 that the inputs will go to +5 without any
assistance, the inputs to many CMOS chips have sufficiently large resistance
that they may tend to float around due to nearby signals and such; it is
not uncommon for the data seen on a floating input to change when someone's
hand or a piece of measuring equipment is placed _near_ it.  This is very
much an observable phenomenon with PICS.

Given that it's necessary to ensure that all inputs are pulled "somewhere",
the question then arises how this may best be accomplished.  There are a
number of common methods, each with pros and cons:

[1] Ignore the problem
   Generally, on a PIC, you can get away with this.  If you read the inputs
   in question, the value read will do whatever the PIC--not you--feels
   like but there aren't likely to be any major problems if you do this on
   the bench.  Since power consumption and reliability may be adversely
   affected by floating inputs, however, this technique really isn't recom-
   mended, at least not compared with #2

[2] Set unused pins to outputs
   This approach has the advantage that no extra hardware is required and
   it may usually be easily accomplished.  Although the extra pins will be
   floating whenever the device is in reset, this will probably not be a
   concern in most applications.

[3] Strap unused pins to "hard" +5 or ground (no resistors)
   This approach requires no extra hardware vs #2 though it may require
   extra layout work; if either +5 or ground is acceptable one or the
   other should usually be available near the pin.  The primary disadvan-
   tages to this method are: (a) If the "unused" pin gets set to be an
   output, current consumption may go "through the roof" (30+ mA/pin) and
   the chip may be destroyed if this condition persists for very long;
   (b) If the unused pin is needed for something else, there may be no
   convenient way to "override" the strap; certainly no way to do so as
   a temporary measure.  If you use this approach on a four-layer board,
   it may be a good idea to pop a +5 via near the pin and run a short
   trace to the pin itself; otherwise, removing the VDD connection will
   be a real pain.

[4] Strap unused pins together, and pull them all up with approx. 4.7K
   This approach is used frequently; it requires only one extra part vs
   #'s 1-3, is more effective than #1-#2, and may be safer than #3.  In
   particular, shorting one of the unused pins to ground briefly will
   not kill power for the whole board and there is less risk of undue
   power consumption if the ports get set to outputs (if two or more
   pins get set to conflicting outputs, power consumption will be very
   bad and the device could be damaged, but since the device's source
   and sink transistors would be in series, the power consumption would
   not be as bad as in #3.

[5] Pull up unused pins individually with 4.7K or similar resistors
   This approach is the nicest approach if the need for resistors is not
   a problem (e.g. if you already have unused resistors in resistor-SIPs).
   In many cases, if a design change or a piece of test software requires
   a formerly-unused pin to be used as an input, the pin may safely be
   tied to whatever is supposed to feed it without any other design or
   board changes.

Personally, I tend to use #1 more than I should (esp. with the RTCC pin),
but usually try to use #2.  The other techniques may be useful with other
chips, however.


'Beginner needs help'
1996\10\01@092224 by Miller, Steve
flavicon
face
>        Historically, the pull-up resistor was required with unused
>       _TTL_ inputs to limit the current into the gate (and this is
>        where the later reference to a 4700 ohm resistor derives).

>        This had nothing to do with subsequently wishing to connect
>        a signal to the unused input.

>        The nature of _CMOS_ inputs is such that a resistor is not
>        needed to limit the current.  A CMOS input can be connected
>        directly to a power rail without excessive current drain.

>        In my experience, it is not standard practice to include
>        pull-ups on unused CMOS inputs.

>___Bob


Actually Bob, when I first studied TTL we were told to use pullup
resistors of 1K not 4.7K.  I selected the value of 4.7K (4700 ohms) to
limit the maximum current to about 1mA when VCC = 5 volts.  Your comments
are quite accurate.  However the original post was from a beginner who
was asking the eternal question: (Use resistor or not use a resistor).
My point is that when in doubt ALWAYS use a resistor instead of just a
jumper wire.  These resistors may not be necessary, but they won't hurt.



Should the  experimenter mis-count the IC pins, he or she could
inadvertantly ties two outputs together.  If a resistor is used, instead
of a jumper wire, no damage will be done by these misconnections, and the
experimenter will can track down the connection error with no component
damage.  If the experimenter is only making one or two of the devices in
question, then a few extra resistors can be left in the design.  No real
cost savings to remove them.  When in production volumes, Bob is correct
that you will removed every unnecessary resistor.


'Beginner needs help'
1998\10\04@043947 by Marc D. Spencer
picon face
What am I doing wrong? this should be the simplest start...turn all port b
pins on.

Code:

0000    MOVLW   00
       MOVWF   0A
       GOTO    005
       NOP
       NOP
0005    CLRF    04
       CLRF    03
       MOVLW   07
       MOVWF   1F
0009    BSF     03,5
       CLRF    06
       MOVLW   FF
       BCF     03,5
       MOVWF   06
       GOTO    009


Using a 16C622, wired trivially:

pin 4 1K to Vcc, .1uF to Gnd
pin 5 gnd
pin 14 to TTL clock module, 10MHz
pin 12 to +5

looking at pins 6-13...all have about .25 v on them, but won't sink an LED
(with 1K res).

Help?

(I don't have a scope, but im pretty sure the power is clean - 7805 with
appropriate filtering off a wall wart)

1998\10\04@050310 by g.daniel.invent.design

flavicon
face
Mark,
It makes everything much easier with the right tools:
Download MPLAB from microchip.com
you can use names for all your jump locations, file registers etc.
check out the *.inc files after downloading MPLAB, they contain register
names etc for each processor. Also you will find example files.

Your code listing will look ancient after doing this.

regards,
Graham Daniel.

Marc D. Spencer wrote:
{Quote hidden}

1998\10\04@192447 by andre

flavicon
face
Marc:

I am not sure how did you write your code it looks to me
that you first used c then generated assembly code then
you did some filtering then you post it to pic list. reason for
this is c always generates extra junk code . I do not thing
assembly user will write   movwf    06. any way  if you just need
to turn all portb on simple test is this


       movlw    0xFF
       movwf    portb

or your way will be

   movlw    0xFF
   movwf    0x06


Andre

Marc D. Spencer wrote:

{Quote hidden}

1998\10\04@202343 by Tony Nixon

flavicon
picon face
Hi Marc,

perhaps you could try this..


> Marc D. Spencer wrote:
>
> > What am I doing wrong? this should be the simplest start...turn all port b
> > pins on.
> >
> > Code:
> >
> > 0000    MOVLW   00
> >         MOVWF   0A

No need to clear the PCLATH register because it automatically resets to
0 on reset.

> >         GOTO    005
> >         NOP
> >         NOP

If you are not using interrupts, you can keep writing code in these
locations.

> > 0005    CLRF    04
> >         CLRF    03

Don't know why you are clearing the FSR and status registers ???
However, there is no need to do this.

Status resets to a known value, the main thing to note is the RP0 bit
which is set to RAM Page 0.
The value in FSR does not matter because you are not using it.

> >         MOVLW   07
> >         MOVWF   1F

This needs to be done to disconnect the comparators from porta inputs.

> > 0009    BSF     03,5
> >         CLRF    06
> >         MOVLW   FF
> >         BCF     03,5
> >         MOVWF   06
> >         GOTO    009

You do not need to go back to '0009' because you code has already done
what you wanted it to do. You can just sit in a closed loop afterwards.


> > Using a 16C622, wired trivially:
> >
> > pin 4 1K to Vcc, .1uF to Gnd

You can use the POR reset to eliminate the external .1uF cap if you
like. That means that you can also hard wire the MCLR pin to 5V to save
a resistor.
To enable the POR timer, the PWRTE bit should be set to 1.
Your programmer should have a visible selector for this.
Also, make sure the WDT is disabled.

> > pin 5 gnd

ok

> > pin 14 to TTL clock module, 10MHz

Your clock input should be pin 16 (Osc1) not pin 14.

> > pin 12 to +5

Pin 14 is Vdd and should be at +5V. Pin 12 is portb pin RB6.

> >
> > looking at pins 6-13...all have about .25 v on them, but won't sink an LED
> > (with 1K res).

Probably confusing to you, but your chip is not set up properly.

> > Help?

Try this code.

Title "Activate Port B"
;
list p=16c622,                  ; processor type
;
status  equ 3h                  ; these definitions help you understand
rp0 equ 5h                      ; your code a little easier
porta   equ 5h
portb   equ 6h
trisa   equ 85h
trisb   equ 86h
CmCon   equ 1fh
;
; -------------
; PROGRAM START
; -------------
;
       org 000h

       movlw 7h                ; set comparator inputs as digital
       movwf CmCon

       bsf status,rp0          ; Ram Page 1 to access tris registers
       clrf trisa              ; porta = all outputs (stops floating inputs)
       clrf trisb              ; portb = all outputs
       bcf status,rp0          ; back to Ram Page 0

       movlw 0xff
       movwf portb             ; set all PortB pins = 5 Volt

here    goto here               ; finished, stay here forever

       end

> > (I don't have a scope, but im pretty sure the power is clean - 7805 with
> > appropriate filtering off a wall wart)

Good idea for a beginner to have a fixed 5V supply. It's very easy to
connect the wrong voltage with a 'Lab' type supply.

--
Best regards

Tony

Multimedia 16F84 Beginners PIC Tools.
**New Improved PicNPost**

http://www.picnpoke.com
Email EraseMEpicnpokespam_OUTspamTakeThisOuTcdi.com.au

More... (looser matching)
- Last day of these posts
- In 1998 , 1999 only
- Today
- New search...