View previous topic :: View next topic |
Author |
Message |
cxiong
Joined: 09 Sep 2003 Posts: 52
|
Multiple ADC - - - NEED HELP |
Posted: Wed Aug 06, 2003 11:31 am |
|
|
I am using PIC16F877 to do PID control. I have to use 2 ADC on channel 0 and channel 1. Channel 0 is for the Proportional manipulate variable, I use channel 1 as a setpoint.
How do you do ADC in multiple channel samutaneously?
Please Help!!
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516720 |
|
|
qm Guest
|
Re: Multiple ADC - - - NEED HELP |
Posted: Wed Aug 06, 2003 11:48 am |
|
|
:=I am using PIC16F877 to do PID control. I have to use 2 ADC on channel 0 and channel 1. Channel 0 is for the Proportional manipulate variable, I use channel 1 as a setpoint.
:=
:=How do you do ADC in multiple channel samutaneously?
:=
:=Please Help!!
You can use set_adc_channel(0) and set_adc_channel(1)
But remember to wait ~10us after each channel change.
(See the CCSC help on SET_ADC_CHANNEL)
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516721 |
|
|
Sherpa Doug Guest
|
Re: Multiple ADC - - - NEED HELP |
Posted: Wed Aug 06, 2003 12:47 pm |
|
|
:=I am using PIC16F877 to do PID control. I have to use 2 ADC on channel 0 and channel 1. Channel 0 is for the Proportional manipulate variable, I use channel 1 as a setpoint.
:=
:=How do you do ADC in multiple channel samutaneously?
:=
:=Please Help!!
With only one ADC you can only take one measurement at a time. The PIC16F877 only has one ADC and a multiplexer to switch the inputs. If your signal is slow enough you can interleave the two channels and treat them as if they were simultanious. Or you can interpolate one signal to see what it probably was when the other signal was converted. Or you can use a Sample & Hold circuit to store one signal untill you have time to convert it. Or you can buy two chips.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516722 |
|
|
Sherpa Doug Guest
|
Re: Multiple ADC - - - NEED HELP |
Posted: Wed Aug 06, 2003 12:48 pm |
|
|
:=I am using PIC16F877 to do PID control. I have to use 2 ADC on channel 0 and channel 1. Channel 0 is for the Proportional manipulate variable, I use channel 1 as a setpoint.
:=
:=How do you do ADC in multiple channel samutaneously?
:=
:=Please Help!!
With only one ADC you can only take one measurement at a time. The PIC16F877 only has one ADC and a multiplexer to switch the inputs. If your signal is slow enough you can interleave the two channels and treat them as if they were simultanious. Or you can interpolate one signal to see what it probably was when the other signal was converted. Or you can use a Sample & Hold circuit to store one signal untill you have time to convert it. Or you can buy two chips.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516723 |
|
|
cxiong
Joined: 09 Sep 2003 Posts: 52
|
Re: Multiple ADC - - - NEED HELP |
Posted: Thu Aug 07, 2003 6:14 am |
|
|
:=:=I am using PIC16F877 to do PID control. I have to use 2 ADC on channel 0 and channel 1. Channel 0 is for the Proportional manipulate variable, I use channel 1 as a setpoint.
:=:=
:=:=How do you do ADC in multiple channel samutaneously?
:=:=
:=:=Please Help!!
:=
:=With only one ADC you can only take one measurement at a time. The PIC16F877 only has one ADC and a multiplexer to switch the inputs. If your signal is slow enough you can interleave the two channels and treat them as if they were simultanious. Or you can interpolate one signal to see what it probably was when the other signal was converted. Or you can use a Sample & Hold circuit to store one signal untill you have time to convert it. Or you can buy two chips.
:=
When I use the code read_adc();
How do I know the result that this is result for channel0 and that is result for channel1.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516765 |
|
|
cxiong
Joined: 09 Sep 2003 Posts: 52
|
Re: Multiple ADC - - - NEED HELP |
Posted: Thu Aug 07, 2003 6:15 am |
|
|
:=:=I am using PIC16F877 to do PID control. I have to use 2 ADC on channel 0 and channel 1. Channel 0 is for the Proportional manipulate variable, I use channel 1 as a setpoint.
:=:=
:=:=How do you do ADC in multiple channel samutaneously?
:=:=
:=:=Please Help!!
:=
:=You can use set_adc_channel(0) and set_adc_channel(1)
:=But remember to wait ~10us after each channel change.
:=(See the CCSC help on SET_ADC_CHANNEL)
When I use the code read_adc();
How do I know the result that this is result for channel0 and that is result for channel1.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516769 |
|
|
qm Guest
|
Re: Multiple ADC - - - NEED HELP |
Posted: Thu Aug 07, 2003 11:42 am |
|
|
:=:=:=I am using PIC16F877 to do PID control. I have to use 2 ADC on channel 0 and channel 1. Channel 0 is for the Proportional manipulate variable, I use channel 1 as a setpoint.
:=:=:=
:=:=:=How do you do ADC in multiple channel samutaneously?
:=:=:=
:=:=:=Please Help!!
:=:=
:=:=You can use set_adc_channel(0) and set_adc_channel(1)
:=:=But remember to wait ~10us after each channel change.
:=:=(See the CCSC help on SET_ADC_CHANNEL)
:=
:=
:=When I use the code read_adc();
:=How do I know the result that this is result for channel0 and that is result for channel1.
You could use code like this:
long channelzero, channelone;
set_adc_channel(0);
delay_us(10);
channelzero = read_adc();
set_adc_channel(1);
delay_us(10);
channelone = read_adc();
You could also use a function like this:
long readchannel(int channel) {
set_adc_channel(channel);
delay_us(10);
return read_adc();
}
depending on how often you switch channels, the delay_us(10) may not be necessary.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516787 |
|
|
|