ADC and the BSII
I am using a MAX186 ADC with my BSII BOE and i am having troubles:· I only get a reading of 4.095 or 0.000 volts no matter what my input/test voltage is.· I have checked the net for code examples and have found this: http://geocities.com/SiliconValley/Orchard/6633/max186.html
I have tried my own code and the code from this site and get the same results.
Channel var nib
Chsel var byte
ADCin var word
X var nib
cs con 1
serDin con 2
serDo con 3
serclk con 4
high cs
main:
low cs
channel =0
lookup channel, [noparse][[/noparse]142, 206,158,222,174,238,190,254],chsel
shiftout serDo, serclk, msbfirst,[noparse][[/noparse]chsel]
shiftin serDin, serclk, msbpost ,[noparse][[/noparse]ADCin\12]
high cs
debug dec ADCin, cr
pause 2000
goto main
I have tried an op amp for filtering purposes and impedance matching,· I believe my power supply is "clean". I have kept the leads as neat and short as possible. I have grounded the unused channels.
If anybody has any questions/suggestions I would love to hear them.
Thanx for your time,
Matthew
I have tried my own code and the code from this site and get the same results.
Channel var nib
Chsel var byte
ADCin var word
X var nib
cs con 1
serDin con 2
serDo con 3
serclk con 4
high cs
main:
low cs
channel =0
lookup channel, [noparse][[/noparse]142, 206,158,222,174,238,190,254],chsel
shiftout serDo, serclk, msbfirst,[noparse][[/noparse]chsel]
shiftin serDin, serclk, msbpost ,[noparse][[/noparse]ADCin\12]
high cs
debug dec ADCin, cr
pause 2000
goto main
I have tried an op amp for filtering purposes and impedance matching,· I believe my power supply is "clean". I have kept the leads as neat and short as possible. I have grounded the unused channels.
If anybody has any questions/suggestions I would love to hear them.
Thanx for your time,
Matthew
Comments
http://www.hth.com/filelibrary/BS1-IC/
I realize you're using a BS-2 but these may provide some guidance.
Hope this helps, Duncan
With both your code and mine causing the same result I would have to say it
would be a hardware problem.
Is the stamp communicating with the MAX186? Like when you say 0 or 4.095V
does the ADCin variable have 0 or 4095 in it? When you connect the input to
Gnd is that when you get a output of 0 and when you connect the input to 5V
is that when you get a output of 4.095?
The two things that I can suggest is check over your connections carfully
and try changing the channel value to 1-7 and check if you get the same
result at each channel.
Shaun
>
>I am using a MAX186 ADC with my BSII BOE and i am having troubles: I only
>get a reading of 4.095 or 0.000 volts no matter what my input/test voltage
>is. I have checked the net for code examples and have found this:
>http://geocities.com/SiliconValley/Orchard/6633/max186.html
>I have tried my own code and the code from this site and get the same
>results.
>
>Channel var nib
>Chsel var byte
>ADCin var word
>X var nib
>cs con 1
>serDin con 2
>serDo con 3
>serclk con 4
>high cs
>main:
>low cs
>channel =0
>lookup channel, [noparse][[/noparse]142, 206,158,222,174,238,190,254],chsel
>shiftout serDo, serclk, msbfirst,[noparse][[/noparse]chsel]
>shiftin serDin, serclk, msbpost ,[noparse][[/noparse]ADCin\12]
>high cs
>debug dec ADCin, cr
>pause 2000
>goto main
>
>I have tried an op amp for filtering purposes and impedance matching, I
>believe my power supply is "clean". I have kept the leads as neat and short
>as possible. I have grounded the unused channels.
>
>If anybody has any questions/suggestions I would love to hear them.
>
>Thanx for your time,
>Matthew
>
>
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
Thanx for the e-mail. I have tried putting the input high and low without a
predictable change in ADCin's value it only shows 0 or 4095 and displays
them randomly. I have tried different channels with the same result.
I will keep plugging away, if I or someone else comes up with a solution I
will be sure to let you know.
Matthew
From: "Shaun Wilson" <shaunwilson@h...>
To: <basicstamps@egroups.com>
Sent: Saturday, July 29, 2000 9:45 AM
Subject: Re: [noparse][[/noparse]basicstamps] ADC and the BSII
> Matthew
>
> With both your code and mine causing the same result I would have to say
it
> would be a hardware problem.
>
> Is the stamp communicating with the MAX186? Like when you say 0 or 4.095V
> does the ADCin variable have 0 or 4095 in it? When you connect the input
to
> Gnd is that when you get a output of 0 and when you connect the input to
5V
> is that when you get a output of 4.095?
>
> The two things that I can suggest is check over your connections carfully
> and try changing the channel value to 1-7 and check if you get the same
> result at each channel.
>
> Shaun
>
>
>
> >
> >I am using a MAX186 ADC with my BSII BOE and i am having troubles: I
only
> >get a reading of 4.095 or 0.000 volts no matter what my input/test
voltage
> >is. I have checked the net for code examples and have found this:
> >http://geocities.com/SiliconValley/Orchard/6633/max186.html
> >I have tried my own code and the code from this site and get the same
> >results.
> >
> >Channel var nib
> >Chsel var byte
> >ADCin var word
> >X var nib
> >cs con 1
> >serDin con 2
> >serDo con 3
> >serclk con 4
> >high cs
> >main:
> >low cs
> >channel =0
> >lookup channel, [noparse][[/noparse]142, 206,158,222,174,238,190,254],chsel
> >shiftout serDo, serclk, msbfirst,[noparse][[/noparse]chsel]
> >shiftin serDin, serclk, msbpost ,[noparse][[/noparse]ADCin\12]
> >high cs
> >debug dec ADCin, cr
> >pause 2000
> >goto main
> >
> >I have tried an op amp for filtering purposes and impedance matching, I
> >believe my power supply is "clean". I have kept the leads as neat and
short
> >as possible. I have grounded the unused channels.
> >
> >If anybody has any questions/suggestions I would love to hear them.
> >
> >Thanx for your time,
> >Matthew
> >
> >
>
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
>
>
>
>
>
In single-ended mode there's a quirk in the channel addressing scheme with
the MAX186. I used this part a couple years ago. This may not be your
problem, but if you are using the part in single-ended mode, you need to
translate the channel number you send to the part. This is detailed in the
data sheet. My summary:
You want to read from On MAX186 pin# Then send the following
Channel number: channel# to the MAX186:
0 1 0
1 2 4
2 3 1
3 4 5
4 5 2
5 6 6
6 7 3
7 8 7
Again, this may not be your problem, but be sure you are applying your test
voltages to the actual channel you think you are reading. Once I resolved
this channel-addressing question, I found the part easy to use with a
Stamp-1. Good luck.
Steve
Steve Roberts: sroberts@s...
was querying the ADC too quickly placing a 2ms pause between shiftin &
shiftout was enough for it to settle down and capture a reading. I am very
happy with the accuracy of this ADC, it is within 2 mv of my multimeter.
Happy Stamping,
Matthew
Original Message
From: Matthew Lewis
To: basicstamps@egroups.com
Sent: Friday, July 28, 2000 11:38 PM
Subject: [noparse][[/noparse]basicstamps] ADC and the BSII
I am using a MAX186 ADC with my BSII BOE and i am having troubles: I only
get a reading of 4.095 or 0.000 volts no matter what my input/test voltage
is. I have checked the net for code examples and have found this:
http://geocities.com/SiliconValley/Orchard/6633/max186.html
I have tried my own code and the code from this site and get the same
results.
Channel var nib
Chsel var byte
ADCin var word
cs con 1
serDin con 2
serDo con 3
serclk con 4
high cs
main:
low cs
channel =0
lookup channel, [noparse][[/noparse]142, 206,158,222,174,238,190,254],chsel
shiftout serDo, serclk, msbfirst,[noparse][[/noparse]chsel]
shiftin serDin, serclk, msbpost ,[noparse][[/noparse]ADCin\12]
high cs
debug dec ADCin, cr
pause 2000
goto main
I have tried an op amp for filtering purposes and impedance matching, I
believe my power supply is "clean". I have kept the leads as neat and short
as possible. I have grounded the unused channels.
If anybody has any questions/suggestions I would love to hear them.
Thanx for your time,
Matthew