|
|
View previous topic :: View next topic |
Author |
Message |
ivanperino
Joined: 08 Jun 2006 Posts: 14
|
Rx & A/D_input in the same PIN |
Posted: Wed Jun 13, 2007 6:46 am |
|
|
We have a little problem here.
PIC16F88
I need to use pin_a4 as Rx input when the PIC is comunicating to the PC but, I need this pin to be an A/D input when the PIC is not comunicating to the PC. This circuit comunicates to the PC when an interrupt performs an int_function(); Although I am not trying to use them at the same time, I am unable to alternate the function of this pin.
#use rs232(baud=38400,xmit=pin_a2,rcv=pin_a4)
then, inside the main() I use.
setup_adc_ports(sAN4|VSS_VDD);
setup_adc(ADC_CLOCK_DIV_16);
set_adc_channel(4);
of course, wen computer comunicaction starts because interrupt excecutes int_function(), it does not work. What do you think should I write/do inside int_function() to change the behavior from AD channel to Rx input
Could any body?
Thankyou very much
Ivan Perino |
|
|
Ttelmah Guest
|
|
Posted: Wed Jun 13, 2007 7:22 am |
|
|
You will need to add:
setup_adc_ports(NO_ANALOGS);
Before trying to use the pin for digital input, and then set the port for analog I/O again when finished.
If you look at the block diagram in the data sheet, for the I/O pin, you will see that the input TTL buffer is disabled, when analog moe is selected.
Obviously, you are going to need to be careful with the external connections, to ensure that only one signal at a time is connected...
Best Wishes |
|
|
ivanperino
Joined: 08 Jun 2006 Posts: 14
|
|
Posted: Wed Jun 13, 2007 4:28 pm |
|
|
It worked ok.
Thank you a lot. It has been very useful to me.
it is easy to design with people like you. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|