I write a code for a pic which has 3 inout to convert from analog to digital .
For every channel a write the function for use the converter as show bwllow.I don't know how to call all this fucntions in main because i want to call the first channell,then disable the first channel and call the second ,disable the first and second channel and call the third channel and then go on to the first.My code is shown bellow and if anyone know the solution please tell me.
You have the belief that every A/D channel has its own A/D converter.
That's not true. There is only one A/D converter in the PIC. There is a
channel selector circuit inside the PIC. It just connects the desired pin
to the A/D converter. You have to read each channel one at a time.
First you have to setup the A/D parameters. Then to read a channel,
you have to do this:
1. Set the channel.
2. Wait for a short delay.
3. Read the A/D result.
Then you can do the same procedure (items 1, 2, 3) for the next channel.
You may not need the ADFM bit code, and the setup parameters may
be different for your version of the compiler and the PIC, but the basic
method of reading two or more channels is shown in that post.
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