-
analog and digital
Hi all
Is it possible to write a program using a pin in both analog and digital one at a time.
Meaning: I would like to implement two loop, one loop uses a porta.0 analog mode and another loop using the same pin in digital mode.
I would switch between the two using and switch, so I only one of the two.
Example:
if PortB.0 = high then
ADCON1 = %10000010
'use PortA.0 in analog mode
endif
if PortB.0 = Low then
ADCON1 = %10000000
'use PortA.0 in digital mode
endif
K
-
sure
Of course you can. Better than loop, you may want to use interrupts to detect switch activity. Such external interrupt (INTF) or RB port onchange interrupt (RBIF). Don't forget TRIS & PORT settings.