Author Topic: Analog switches  (Read 12745 times)

cdenk

  • Full Member
  • Posts: 161
  • newbie
    • View Profile
Analog switches
« on: March 16, 2006, 05:38:24 AM »
With T100MD888+ and EXP4040, I may need a few more ADC inputs, and was thinking of an Analog switch chip. Are they suitable to control with outputs to select which sensor to connect to, the programming would take care of scaling, etc.?

Is there something in specifications to watch out for?

The applications examples show them before the Op-Amp, could the be used going int the PLC ADC in?
:)

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Analog switches
« Reply #1 on: March 19, 2006, 03:15:11 AM »
An analog switch chip may require a TTL/CMOS signal to perform the mulitplexing so you have to convert a digital output into 5V TTL/CMOS signal to control the analog chip. We haven't attempted that before.

A quick way of multiplexing may be to use small signal relays with 24V coil controlled by the PLC digital outputs. The relay contacts are used to multiplex the analog inputs.

Small signal relays can handle very small ADC signal current. Power relay type won't work properly because the oxide film on the power relay need higher current to "break through" the film to conduct.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

cdenk

  • Full Member
  • Posts: 161
  • newbie
    • View Profile
Re:Analog switches
« Reply #2 on: March 19, 2006, 05:10:34 AM »
Outputs # 41-56 of the MD-EXP4040 are TTL level, shouldn't that work? Also since the PLC power supply is running of 12 VDC, if I used relays, they also should be 12 VDC. I like the idea of the relays, and they are fairly small size and can be socket mounted to make maintenance easier. :)

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Analog switches
« Reply #3 on: March 19, 2006, 06:35:29 AM »
Oh yes, since you are using the EXP4040 there are 16 digital outputs that are 5V CMOS logic level so you can use it to trigger analog switches.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

cdenk

  • Full Member
  • Posts: 161
  • newbie
    • View Profile
Re:Analog switches
« Reply #4 on: August 09, 2006, 11:18:38 AM »
As a semi-newbie, and considerable effort, here's what some of the issues I have encountered. The multiplexed analog switch is a DG508.

1: Unused inputs tied to ground.
2: The V- supply is tied to ground.
3: The PLC operates on 12 VDC, and that's where V+ is tied.
4: MD-EXP4040 TTL ouputs 41- 44 are used to drive enable and address lines. At one time had 10K resistors to pull the addresses up, but they have  been removed and it still works. The IO's are latched or use SETIO/CLRIO in custfun to setup addresses.
5: The DG508 requires some settling time after addresses are set. An empty For/next loop counting to 100 between setting addresses and before reading the ADC is necessary.
6: Some ADC converters need a couple of dummy reads to clear out garbage in the buffers, apparently the ones on the T100MD+r49 require this, which is done as follows:
X= ADC(1)
X=ADC(1)
A=ADC(1)

Discard the "X"'s and use the "A".

I do not recommend anyone go this method unless they are well experienced in analog stuff and have access to an o-scope.

evanh

  • Jr. Member
  • Posts: 59
  • y=A+B*(1-cos(2*Pi*x))
    • View Profile
Re:Analog switches
« Reply #5 on: August 10, 2006, 04:48:07 AM »
Good writeup there cdenk.

One little tidbit - The usual way to code the instructions for efficient execution of a settling delay is to set the next address immediately after having used it so that the next time you come back to take the reading it has already settled.  In syncronous hardware designs both the access and the next address are applied on the same clock.

Of course, this may not be a fast enough sample rate so your method would need to be used but be aware that it ties up the CPU for the entire period of sampling.


Evan

cdenk

  • Full Member
  • Posts: 161
  • newbie
    • View Profile
Re:Analog switches
« Reply #6 on: August 10, 2006, 06:54:36 AM »
Good thought on setting addresses after using. As pointed out, in a PLC (this one anyhow), everything happens at the end of the ladder, and since one ADC channel (there are 8) is being used to get 4 (with this chip could be up to 8) different readings and store them in a variable, it must be one reading for each cycle. I do this by using a counter that is incremented at the end if the Basic function and then an if/endif for each read, watching the counter value which is incremented at the end of the function. As an alternative, the incrementing can occur in a basic function on another ladder rung, executed on say a 1 second clock (this thing is just watching batteries, utility and generator voltages on a standby generator) or substitute the clock for an input contact to a keypad key for troubleshooting I can increment on my command.

I tend to be conservative and like setting the addresses when I am there, but will think about and probably try setting them early.

Good thoughts. :)