Analog Multiplexor

manutdfan2004

New Member
Following on from my previous thread concerning wireless communications I need a little bit of help again, I have connected up this analog multiplexor to a PIC but cannot get any data from it all that I end up getting is 0's constantly.

I have attached a file showing the way in which I have connected it up to an 18X chip, with pins 11,12 and 13 used to select which set of data to use from multiplexor and pin 17 being the analogue input pin.

Can anyone notice anything stupid I have done and why this would not work? I have triple checked this and cannot see anything, I have even tested the multiplexor by connecting it in another circuit with the enable set so all data is transmitted through.


Here is the datasheet on the multiplexor:
http://pdf1.alldatasheet.com/datasheet-pdf/view/73418/MAXIM/MAX4617CPE.html

Code snippet:
Code:
multi1:
	low 7			' Multiplexor Logic A
	low 6			' Multiplexor Logic B
	low 5			' Multiplexor Logic C
	readadc 0,b0		' Input X0
	high 7
	readadc 0,b1		' Input X1
	low 7
	high 6
	readadc 0,b2		' Input X2
	high 7
	readadc 0,b3		' Input X3
	low 7
	low 6
	high 5
	readadc 0,b4		' Input X4
	high 7
	readadc 0,b5		' Input X5
	low 7
	high 6
	readadc 0,b6		' Input X6
	high 7
	readadc 0,b7		' Input X7
	goto send
 

Attachments

BeanieBots

Moderator
Doesn't 'enable' need to be high?
You've got it (pin6) pulled low.

EDIT:
You are correct.
"Digital Enable Input. Normally connect to GND. Can be driven
to logic high to set all switches off."
I'd have expected to see that written as ENABLE with a bar on top for active LOW.

Everything else looks OK. Sorry, nothing obvious.
 
Last edited:

manutdfan2004

New Member
Cheers for looking just wanted to make sure I wasn't doing something stupid will have a mess around with it and see what can do.
 

BeanieBots

Moderator
Just noticed your resistor values.
If those really are 150R pull-ups, the PICAXE probably can't pull the line low enough for a TTL compatible input.
Try 10k.

Similarly, why the very low 300R value on the ADC line?
 

manutdfan2004

New Member
In the datasheet it stated that between the output pin off multiplexor and input of pic it needs a 300R to ground and a 35pF capacitor to ground (which I couldn't find so used 22pF) and the 150R should be 50R and think I just copied how the enable was setup from the pic output, will swap these round and give it a try.

Thanks again

Edit:

Got rid of the resistors completely and it seems to be working now, any danger of blowing the multiplexor as the inputs are now not grounded? should I stick pull down 10k's between the pic output and multiplex input?
 
Last edited:

eclectic

Moderator
Last edited:

BeanieBots

Moderator
A few points.
50R would not work at all. Don't know where you got that value from.
That value is low enough to damage the PICAXE. DON'T DO IT.

A pull-down is not REQUIRED on the digital lines but 10k would avoid any floating issues that could arise during the 76mS it takes for the PICAXE to set the lines as outputs after a reset.

The 300R/35pF looks like you've copied the TEST circuit from the datasheet.
Those values are designed to test the chip to it's limits.
(and that's exactly what you will be doing if you use them).

No need for the 300R at all. All it will do is load your ADC line and cause unpredictable ADC reading.
If you are concerned about ever having a floating ADC input or simply want to return a value of zero if the selected input is floating, then use 100k which will present minimal load to your ADC source.

Only fit a cap if you have noise issues.
22pF will have no effect at all. A typical chip input will be 10pF and strip-board track will add another 10pF. That's why that sort of value is used in the TEST circuit. To mimick a 'typical' real life senario.

For noise suppression something in the order of 100nF but really depends on what your source impedance is.
 

hippy

Ex-Staff (retired)
One point to note; it's 'traditional' ( though not required ) that when wiring up address lines and so forth that most significant bits map to most significant bits so ideally Pin7=C, pin6=B, pin5=A. That can save having to do a lot of mental contortions.

Here's an optimised scan of all channels which uses Gray encoding to minimise the number of changes. It reads channels out of order but should still give the same result, assuming the address mapping hasn't completely frazzled my brain :)

Code:
multi1:
	low 7			' Multiplexor Logic A
	low 6			' Multiplexor Logic B
	low 5			' Multiplexor Logic C
	readadc 0,b0		' 000 Input X0
        high 7 
	readadc 0,b1		' 100 Input X1
        high 6
	readadc 0,b3		' 110 Input X3
        low  7
	readadc 0,b2		' 010 Input X2
        high 5
	readadc 0,b6		' 011 Input X6
        high 7
	readadc 0,b7		' 111 Input X7
        low  6
	readadc 0,b5		' 101 Input X5
        low  7
	readadc 0,b4		' 001 Input X4
	goto send
 

BeanieBots

Moderator
I agree Hippy, the use of Gray code also avoids undesired glitching and improves settling time. The way I avoid 'brain frazzles' when using Gray is to rename the analogue inputs to my own convention.
 

manutdfan2004

New Member
@eclectic

Am just working on sorting out all the minor bugs and problems to produce a decent circuit diagram, I expect I should have something by the weekend avaliable to post. Am thinking about sticking it in a seperate project thread will let you know when its complete.

@BeanieBots

Thanks again for your excellent information, circuit is working well now and the advice was brilliant.

@Hippy

I had honestly never heard of Gray coding, considering am studying computer science that is pretty poor, so thanks for enlightening me.
 

MFB

Senior Member
Some general tips

I find Hippy’s grey code approach very useful when a constant mux address set-up time is required. However, because my configuration included a rather slow instrumentation amplifier between the mux output and PICAXE analog input, it was still necessary to add a few mS Pause between issuing each new address and an ADC read. Another tip about using analog multiplexers is that they are not all equal. Although things have progressed a long way from the days when they needed +/-15 volts, most of the current versions still find it difficult to remain linear when powered from a single 5 volt supply. Therefore, as always, read the specifications very carefully when selecting a device. I have had excellent 10-bit compatible performance from the latest Maxim and Analog Devices single-rail offerings, even when operating at 3.3 volts.
 
Top