CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Multiple Channel Analog In

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
pklee2954



Joined: 06 Nov 2006
Posts: 5

View user's profile Send private message

Multiple Channel Analog In
PostPosted: Tue Jan 08, 2008 11:20 pm     Reply with quote

Looking for opinion on multiple ADCin on single MCU.

The MCU we are using is 18F4620 4Mhz. Five nos IC RCV420 are used to converts the field sensors 4-20mA to 0-5Volt for the MCU AI pins to read.

When only one RCV is plugged into the target board to pump voltage into MCU, the reading will be accurate ie. 20mA input gives 5.0V and data read in MCU is 3FF

When more than one RCV is plugged into the target board, and that one RCV only is hooked up to field sensor while the rest of RCV is not hooked up(float), reading that loaded ADCin value gives inaccurate results (randomly lower range of values) like 3AF etc. Loading or timing problem?

We have read and followed the recommended "ADC setup timing, pause while waiting for conversion, pause before doing the next Code" and made sure voltage VDD is 5.00V. No help so far.

I dont have codes to post cos' as firmware is done by outsourcing.

Any clue or suggestions? Just want to know if it is firmware or hardware related. I am sorry if it seems like a hardware question. We have ran out of ideas on which end to approach.
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Wed Jan 09, 2008 12:09 pm     Reply with quote

"For the A/D converter to meet its specified accuracy, the charge holding capacitor (CHOLD)
must be allowed to fully charge to the input channel voltage level."


The resultant offset voltage in the analog AD input is dependable of the source impedance,
hence its accuracy.
For sure it is a hardware problem that can be smoothed by software. To fight against this,
I would adapt the output source impedance and would make some tests varying
(incrementing) the aquisition time.


Humberto
pklee2954



Joined: 06 Nov 2006
Posts: 5

View user's profile Send private message

PostPosted: Wed Jan 09, 2008 6:18 pm     Reply with quote

Hi Humerto,
When one RCV420(still accurate reading) is plugged in versus five RCV plugged into thetarget board changes the source impedance? Or affects the internal MCU charging ?

The original souce code does scan all five inputs regardless of how many RCV is plugged in though.

Below is (not actual) the example code i intend to use as experiment. I will try to scan only one channel irregardless of the number of RCV. What other TIMINGS could i play with?

Code:
void main() {

   int i, value, min, max;

   printf("Sampling:");

   setup_port_a( ALL_ANALOG );
   setup_adc( ADC_CLOCK_INTERNAL );
   set_adc_channel( 0 );

   do {
      min=255;
      max=0;
      for(i=0; i<=30; ++i) {
         delay_ms(100);           // Tune this delay prior to acquisition time
         value = Read_ADC();
         if(value<min)
            min=value;
         if(value>max)
            max=value;
      }
      printf("\n\rMin: %2X  Max: %2X\n\r",min,max);

   } while (TRUE);
}
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Wed Jan 09, 2008 7:26 pm     Reply with quote

Quote:

When one RCV420(still accurate reading) is plugged in versus five RCV plugged into thetarget board changes the source impedance? Or affects the internal MCU charging ?

Sorry, I do not understand what do you mean.

Quote:

When more than one RCV is plugged into the target board, and that one RCV only is hooked up to field sensor while the rest of RCV is not hooked up(float), reading that loaded ADCin value gives inaccurate results (randomly lower range of values) like 3AF etc. Loading or timing problem?

If the field sensors are not hooked, does your 4-20mA current loop tolerate a cable
break condition? (floating inputs) If so -as I guess- what is the equivalent output DC value
of the RCV420 in such condition?
To sense that, normally it is adjusted in 0-20mA/0-5V in such way that a real dead 0mA/0V
means a faulty/alarm condition.

Before discuss any coding I would like to know your hardware. It is difficult to understand
your problem without any schematic or a detailed description.


Humberto
pklee2954



Joined: 06 Nov 2006
Posts: 5

View user's profile Send private message

PostPosted: Thu Jan 10, 2008 8:14 am     Reply with quote

The target board has five nos of RCV socket. When only one socket is populated, it works find. When five sockets are populated MCU wont get the right reading.

I haven't thot about broken cable situation. Will try to measure it. This is a good pointer.

As the schematic is proprietary, i will deal offline if this is ok and not anti-forum spirit.
Ttelmah
Guest







PostPosted: Thu Jan 10, 2008 9:37 am     Reply with quote

Are you sure your 4-20mA sources, are floating designs?. If not, then the odds are that your problem is that the connections to the multiple sensers, are resulting in ground loops. I have several systems using the RCV420, with up to six channels in use at once, without problems, but these all either have the ISO122 added to each channel at the receive end, or use isolated transmitters. With 4-20mA, you need either one end (or both ends) of the loop to provide isolation.

Best Wishes
pklee2954



Joined: 06 Nov 2006
Posts: 5

View user's profile Send private message

PostPosted: Sun Jan 13, 2008 2:15 am     Reply with quote

Quote:
Are you sure your 4-20mA sources, are floating designs?.

No I am not sure if it is floating design. But for sure it will happen in real life when the sensors are disconnected by broken cables. I will study the ISO122 implication tho.
Never thot of isolation nor floating issue before cos i have connected 1 channel without isolation nor float issue so far. Maybe it's different with multi channel altho the channel are 'isolated' from each other.


Quote:
I have several systems using the RCV420, with up to six channels in use at once, without problems

If possible, it wud be good to see how you connect them and how you code them to get the positive results.

Quote:
For sure it is a hardware problem that can be smoothed by software.

Anyway, I am still stuck with not knowing what the exact hardware cause is thus tinkering with the souce code to 'smoothed' the problem is very much a random way at the moment.

Thanks for all input.
Ttelmah
Guest







PostPosted: Sun Jan 13, 2008 5:01 am     Reply with quote

The 'point' about 4-20mA, is that it comprises a 'loop'. At some point in this loop, there is a voltage source, somewhere else, a current regulator, that adjusts the current flowing in the loop, and somewhere else, a current detector, that senses the current flowing. It only works properly, if there is only a ground at _one_ point in the entire loop (or even none). Otherwise current can flow to the grounds, rather than 'round' the loop.
So, if the voltage source is grounded, then both the current regulator, and the detector, _must_ be capable of operating 'floating' relative to the ground. Similarly, if the current regulator is grounded, then both the voltage source, and the detector must be able to float, while if the detector is grounded, both the current regulator, and the voltage source, must be floating.
Now, there are a lot of different ways of doing this, so you will find 4-20mA sources, that are isolated, and others that are not. Sometimes, the voltage source needs to be provided at the 'receive' end, while other times the source is included in the sensor. Again this may be isolated or not. Then at the receiving end, if either the voltage source, or current regulator is grounded, _you_ will need to provide isolation.
The application note for the RCV chips, shows how to provide isolation at either end of the loop.
In some cases, isolation is provided at both ends, with commonly only a single 'protective' ground to some point on the intermediate wiring. This is how most of the kit I work with is wired. Also, the receiver often provides the loop power, with the transmitter, being 'self powered' from the loop (Texas have a couple of application notes about doing this). The loop power is then sometimes fed through a fuse, and double cascaded zener diodes, limiting the loop current to perhaps 25mA into a short circuit, and the voltage to perhaps 12v,with any single component being able to fail, and these limits will still be maintained. This is the type of approach needed for the higher category 'intrinsically safe' operation.
Siemens, also have an application note using the IL300 optocoupler (Appnote 54), to provide loop isolation, and this very nicely shows the three possible loop configurations regarding isolation. These circuits are only really good for about 8bit accuracies, but within this limitation, are cheap, and perform well.
Remember also, that once you have your voltage, ready to feed into your ADC, you again need to be very careful about how the ground paths run in beween the converter and the ADC, if induced voltages on the ground rail, are not going to affect the readings. Good analog design, when you start to push accuracies, is quite demanding....

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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