Searching \ for '16C73: Is AN4 useable with SPI on?' 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/microchip/ios.htm?key=spi
Search entire site for: 'Is AN4 useable with SPI on?'.

Truncated match.
PICList Thread
'16C73: Is AN4 useable with SPI on?'
1998\12\10@162823 by Brian Aase

flavicon
face
Okay, I'm just a bit confused by the manual on this one.
The section on the A/D converter say that if ADCON1 is
set to zeroes, then all five of the ANx inputs are useable
(which is what I need).

But I also need to use SPI (master mode, output only)
to run a display driver such as a MAX7219.  Now, in the
SPI section, it says (I'm paraphrasing here) that RA5
can be used as a general purpose *output* if not
needed for SPI operation.

So, here's the question: Can RA5/AN4 work as an A/D
input even when the SPI is being used as described above?
Any insight will be greatly appreciated!

Brian Aase
independent geek

1998\12\11@143526 by Dwayne Reid

flavicon
face
>Okay, I'm just a bit confused by the manual on this one.
>The section on the A/D converter say that if ADCON1 is
>set to zeroes, then all five of the ANx inputs are useable
>(which is what I need).
>
>But I also need to use SPI (master mode, output only)
>to run a display driver such as a MAX7219.  Now, in the
>SPI section, it says (I'm paraphrasing here) that RA5
>can be used as a general purpose *output* if not
>needed for SPI operation.
>
>So, here's the question: Can RA5/AN4 work as an A/D
>input even when the SPI is being used as described above?
>Any insight will be greatly appreciated!

Yes and no!

The pin will function perfectly as an output so long as you write the whole
port at once.  Any read-modify-write type instructions (bsf, bcf, any
instruction with port RA as the destination) may fail.

The problem is that since that pin is configured as analog input, the
DIGITAL input has been disabled.  That means that any instruction that
attempts to read that pin will always show that pin as '0'.  Any instruction
that reads that port, modifies some or all of the bits within that port,
then writes the new value back to that port will write '0' in those bit
positions.

If you want to bit-diddle only THAT pin on the post, bcf/bsf WILL work.
However, if you diddle any other bit within that port, RA5 will 'magically'
go back to being a zero.

dwayne


Dwayne Reid   <spam_OUTdwaynerTakeThisOuTspamplanet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(403) 489-3199 voice     (403) 487-6397 fax

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