piclist 2001\12\12\133431a >
Thread: 12C509A Questions
www.piclist.com/techref/microchip/devices.htm?key=pic
flavicon
face BY : mike@spam_OUTwhitewing.co.uk



The external load is slowing down the slew-rate of the port pin. Both the bsf/bcf operations and the XORWF are reading the whole port
byte, modifying the required bits, and then writing it back. If the
pin has not stabilised from the previous write, it may read back the
wrong value. I suspect it's the bsf/bcf in your case, as 1K/100n is not a heavy
load. Look at it in slow-motion. Assume the port is initially 00

bsf GPIO,0
voltage on pin starts rising....
bcf GPIO,1
reads port, but due to loading, bit 0 has not yet got all the way up to the input 'high' threshold, so it reads back as 0,
not the 1 you want it to be, so this operation reads bit 0 as 0, clears bit 1, and writes the
result to GPIO, i.e. 00
The fix is to either avoid read-modify-write instructions, or add some
delay between them. e.g. replacing your bsf/bcf with  movlw 1
movwf gpio

would work, but the XORWF operation may still suffer the same problem
- either add some delay (for 1K/100n, only a few cycles should be
necessary), or flip the bits in W or another variable and write the
new value



On Wed, 12 Dec 2001 12:00:05 +0600, you wrote:

{Quote hidden}

--
http://www.piclist.com hint: To leave the PICList
spamBeGonepiclist-unsubscribe-requestTakeThisOuTspammitvma.mit.edu


<098f1ukosshbsnqgu5vsdl7ptfm6lepfp7@4ax.com> quoted-printable

In reply to: <57464.63.85.34.2.1008180005.squirrel@www.intertex.net>
See also: www.piclist.com/techref/microchip/devices.htm?key=pic
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) 12C509A Questions

month overview.

new search...