From: Spehro Pefhany
Subject: Re: Best way to power array of LEDs?
References: <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org> <email@example.com>
X-Newsreader: Forte Agent 1.92/32.572
Date: Fri, 06 Dec 2002 10:58:35 GMT
NNTP-Posting-Date: Fri, 06 Dec 2002 05:58:35 EST
On Fri, 06 Dec 2002 08:41:57 +0000 (GMT), the renowned Tony Williams
> It's that warning in every PIC data sheet Speff.
> An output pin that is driven to 0/1 must be allowed
> to reach the correct 0/1 voltage. If not, undefined
> things happen during subsequent writes to that o/p.
The RMW issue can be gotten around with software-
avoid BCF/BSF to the port under conditions like that,
since read-modify-write instructions use the values
read from the port pins (NOT the latch). If you write
the entire latch, the issue doesn't arise
(the values may in fact be read, but they are
discarded). Sometimes it's convenient to maintain a
shadow register, update that, then slap it out to
the real port latch.
By the way, the 18F series have an alternate PORTx
address called LATx that uses latch values rather
than pin levels.
> In the original software, the sequence of "set port-
> pins to logic 0, then set port-pins to outputs"
> resulted in the pins being set to logic 1, the LED
> lit up like a searchlight, with 130mA drawn off the 5v.
Hmm.. so the voltage must have been high enough at
the inputs to read as a "1", since most of the PIC
inputs are TTL levels, it doesn't take much. I'll bet
you wished you put a little transistor in there. ;-)
Must have been written as a series of BSFs.
> Fortunately that 20mA could be gated-Off for a few uS.
> If that was done, then the original sequence worked
Hardware solutions work too. ;-)
"it's the network..." "The Journey is the reward"
firstname.lastname@example.org Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.co