Re: writing bits to PORTA on p16f84
From: Guillaume (grs-NO-SPAM_at_NO-mail.com)
Date: 02/06/04
- Next message: Yuri Tregubov: "Re: Using Visual C/C++ to do 8051 development"
- Previous message: Dave Hansen: "Re: IAR VisualSTATE"
- In reply to: Gary Kato: "Re: writing bits to PORTA on p16f84"
- Next in thread: Gary Kato: "Re: writing bits to PORTA on p16f84"
- Reply: Gary Kato: "Re: writing bits to PORTA on p16f84"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 06 Feb 2004 16:39:41 +0100
> From the diagram in the datasheet, if the bit is set as an input, the output
> from the latch would be 1.
The TRIS latch, yes. But it would put the ouput driver (the P/N pair)
in Hi-Z, exactly as is stated in the data sheet:
"Setting a TRISA bit (=1) will make the corresponding
PORTA pin an input, i.e., put the corresponding output
driver in a hi-impedance mode."
The upper transistor drawn in the diagram is a "P" type. It won't
act as a weak pull-up if the TRIS bit is 1, as you seem to mean.
Port B pins have weak pull-ups, see PORTB description to see the
difference.
> If nothing is driving the input pin high or low, I
> would think that is the value that would be read. What would be a reason for
> the value to be 0? Doesn't something need to pull the signal low to make it
> read 0?
No reason for it to be 1 either. See above. In input mode, the pin is
simply left "floating". A floating pin is a no-no in the "real world".
It could read anything, and possibly even oscillate in some cases,
with the side effect of consuming more current. That's why it's
important that you connect unused inputs either to ground or Vcc,
depending on the circuit.
In a simulator, they obviously have to choose a fixed state in this
case, since they probably won't simulate a real circuit with all its
complexity. That's why you have to use those simulators with a bit
of caution.
- Next message: Yuri Tregubov: "Re: Using Visual C/C++ to do 8051 development"
- Previous message: Dave Hansen: "Re: IAR VisualSTATE"
- In reply to: Gary Kato: "Re: writing bits to PORTA on p16f84"
- Next in thread: Gary Kato: "Re: writing bits to PORTA on p16f84"
- Reply: Gary Kato: "Re: writing bits to PORTA on p16f84"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|