Is it possible to control an led (+5V output) using a pin that is set to analog? The ADCON1 options don't allow me the desired A/D pin combination's I require.
I am using a 16F716 & 16C711.
Thanks
Is it possible to control an led (+5V output) using a pin that is set to analog? The ADCON1 options don't allow me the desired A/D pin combination's I require.
I am using a 16F716 & 16C711.
Thanks
James
Yes, it's possible. But the technique required depends on how you are using the other Pins on PORTA.Is it possible to control an led (+5V output) using a pin that is set to analog?
Pins in analog mode can be put into output mode, and they will work just fine as long as no other Pins on that port are used for Digital input.
If another pin is using Digital OUTPUT, then a holding register can be used to eliminate the Read part of Read-Modify-Write.
If RA4 is an input to T0CKI, then that isn't considered a Digital input as far as R-M-W goes.
And yes, you can re-configure the analog ports "on-the fly", but that won't take care of the R-M-W problem if any of the pins are Digital INPUT.
What are the other pins on PORTA used for, and what is your current ADCON1 setting?
<br>
DT
I had thought about continually flipping the ADCON1 register, but wasn't sure about the effect on everything, my continuous ADC, flickering led, etc.
No other pins on that Port are used as digital input. All PORTA pins are analog, (2) are used as ADC input. (RA4 is an input to T0CKI)
ADCON1 =0
Thanks for the input.
James
Ok, so there are 4 analog pins, they are all in analog mode.
You are using 2 of them for analog input and want to use 1 for digital output.
That leaves 1 analog pin unaccounted for.
Is that one an OUTPUT too?
It makes a big difference.
If not, and it's just not being used, then you can use HIGH and LOW like normal on the pin with the LED.
If that other pin is also an output, you'll need to use a variable as a Latch (holding reg) to fix the R-M-W issue.
<br>
DT
Bookmarks