For Newzed - ADC12034
Archiver
Posts: 46,084
Hi Newzed,
Get http://www.national.com/an/AN/AN-929.pdf
Rightclick and use Save As...
This document describes all pins and how to connect
the ADC12034 o any microcontroller. Also some
program samples.
Hope this helps for the hardware issue.
Maybe someone else got some code.
Greetings peter
Get http://www.national.com/an/AN/AN-929.pdf
Rightclick and use Save As...
This document describes all pins and how to connect
the ADC12034 o any microcontroller. Also some
program samples.
Hope this helps for the hardware issue.
Maybe someone else got some code.
Greetings peter
Comments
Thank you, Peter.
I have already download and printed out your reference. I presume the Din
and Dout lines would be tied together as they are with the LTC1298.
Now if some one can just supply me with the proper code I might even light a
sparkler tonight.
Thanks again
Sid
I looked the pdf over and DI and DO can be tied together.
To use DI however, DO must be dusabled by \CS, resulting in 3 stamp I/O
pins: SCLK, DI/DO, \CS
Personallly I would use the 8051 connections which also require 3 stamp I/O
pins: SCLK, DI, DO and have \CS tied to GND.
Greetings peter
It's risky to propose code for these chips without actually having
used one, but I'll go out on a limb with the following. KISS a
single ended 12 bit conversion on channel #0. Note that I am using 4
pins to connect to the stamp. I would _not_ recommend tying DO and
DI together, because spurious commands could put the chip into weird
modes. It might work okay, but don't take chances at first! Also, I
use the CS\ pin, because otherwise it is hard to synchronize the
data. Note that the chip needs a separate, external high frequency
(5mhz nominal) conversion clock--it will not work without it. This
is a much harder chip to use than the LTC1298.
' Stamp connections to ADC12034
' P0-->CS\ active low
' P1-->DI data to ADC
' P2<--DO data from ADC
' P3-->serial clock to ADC
' CONV\ tied low on ADC
' PD tied low on ADC
' CCLK tied to 5 mhz clock source (conversion clock)
' analog input to channel 0
x var word
loop:
low 0 ' chip select
shiftout 1,3,lsbfirst,[noparse][[/noparse]%00100001] ' set mode 13 bit lsb1st, channel 0
high 0 ' start conversion
pause 5 ' wait
low 0 ' chip select outs lsb
shiftin 2,3,lsbpre,[noparse][[/noparse]x\12] ' get unsigned data
high 0
debug ? x
goto loop
Maybe someone who has actually implemented this chip will have some
_tested_ code for you, so you can light that sparkler tonight!
-- regards,
Tracy Allen
electronically monitored ecosystems
mailto:tracy@e...
http://www.emesystems.com
At 10:17 AM -0400 7/4/01, Newzed@a... wrote:
>For the ADC'ers
>
>I have Parallax 12-bit ADC AppKit which comes with the source code to read
>Channels 0 and 1 of the LTC1298. That is all very good.
>
>I have a National Semi chip, ADC12034, which is a 4-channel chip with mux1
>and mux2 pins. Input channels are 0,1,2,3.
>
>If you are not familiar with the LTC1298 code, readout is controlled by a
>config command in binary where in the third bit specifies the channel read.
>Since the bit options are 0 and 1, obviously it will control only 2 channels.
>
>I need a source code that will let me read 4 or more channels and some
>guidance as to how to connect Stamp to the ADC, i.e., do I tie Din and Dout
>together as with the LTC1298 or do I use one of the mux lines to input data
>to the Stamp.
>
>Please, do not refer me to a book that I would have to read or to a site that
>I will have to hunt down. I just want a code so I can operate this thing.
>I'm 79 years old and have a couple of other things I would like to learn.
>
>If I have left out any information essential to you helping me, my apologies.
>
>If you choose to respond please make "For Newzed" the first line of your
>response. Sometimes there are so many comments on the list about a subject
>you don't know who is writing to who.
>
>Thanks
>Sid - W4EKQ
>Newzed@a...
At 4:53 PM +0200 7/4/01, Peter Verkaik wrote:
>Hi Newzed,
>
>Get http://www.national.com/an/AN/AN-929.pdf
>Rightclick and use Save As...
>This document describes all pins and how to connect
>the ADC12034 o any microcontroller. Also some
>program samples.
>
>Hope this helps for the hardware issue.
>Maybe someone else got some code.
Newzed@a... wrote:
>Thank you, Peter.
>
>I have already download and printed out your reference. I presume the Din
>and Dout lines would be tied together as they are with the LTC1298.
>
>Now if some one can just supply me with the proper code I might even light a
>sparkler tonight.
>
>Thanks again
>
>Sid
>
>To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
>from the same email address that you subscribed. Text in the
>Subject and Body of the message will be ignored.
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Thank you very much. I understand most of what you wrote.
Question:
CONV\ tied low - PD tied low. Just ground them?
CCLK - don't have an ext. 5mHz generator. Could I use another Stamp pin and
"freqout" to generate 5Mhz?
In the loop:
shiftout 1, 3, lsbfirst, [noparse][[/noparse]%00100001]
Does the "3" refer to pin 3 which supplies the serial clock pulse?
%00100001 - Does the first bit say "Channel 0?"
If I wrote 3 more loops using %01000001, %10100001, and %11100001 would that
read Channels 1,2 and 3, giving me 4-channel readout
Do I tie Va+, VD+ and Vref all to the Stamp's 5volt supply, ussing bypass
caps at each of these three pins, .01, .1 and 10 uf respectively?
Do I ignore the mux1, mux2, EOC, DOR\, Com, ADin1 and ADin2 pins?
I have modified the program for the LTC1298 so it reads Channels 0 and 1
three times at specified intervals, giving a total of six readings. Each of
the six "x/12" data inputs to the Stamp are stored in different locations
which can be debugged to the screen at any time as long as the Stamp has not
been turned off. I can, for instance, read the temperature in the house and
outside at 30 minute intervals and see on the screen how much the inside
temperature varies as the outside temperature rises.
My sparkler is laying on the kitchen table just in case.
Thanks again, Tracy. If I can ever help you, I do PC board layouts, write
control - but not data acquisition - programs and assemble PC boards, as long
as you aren't in a big hurry.
Sid
I'll try to respond to your questions in line...
>For Tracy Allen
>
>Thank you very much. I understand most of what you wrote.
>
>Question:
>
>CONV\ tied low - PD tied low. Just ground them?
Right. Otherwise, if PD is high, the chip powers down (this function
is also available via software commands). If CONV\ is high, the chip
is read-only.
>CCLK - don't have an ext. 5mHz generator. Could I use another Stamp pin and
>"freqout" to generate 5Mhz?
The CCLK conversion clock would usually be tapped off from the
high-frequency master clock of the microprocessor, or it would be a
separate oscillator. In either case it would be operating during the
whole conversion process. I don't know exactly what role the 5mhz
plays inside the chip. It might have to be there all the time, even
during the command and data readout sequence. Maybe once you get it
working you can try to "trick" it, but when first trying it out,
you're better off going "by the book".
The stamp freqout command cannot generate frequencies that high (the
maximum is 111 kilohertz when the duty cycle is 50%), and the output
is only generated during the interval that the freqout command is
executing.
Modern ADCs are a lot more friendly in this respect. They have an
internally generated conversion clock, or, like the LTC1298, the
serial clock also serves as the conversion clock.
>
>In the loop:
>shiftout 1, 3, lsbfirst, [noparse][[/noparse]%00100001]
>Does the "3" refer to pin 3 which supplies the serial clock pulse?
>%00100001 - Does the first bit say "Channel 0?"
>
>If I wrote 3 more loops using %01000001, %10100001, and %11100001 would that
>read Channels 1,2 and 3, giving me 4-channel readout
This comes from careful reading of tables IV and VI in the
application note. The lsb=1 specifies single ended conversion. the
commands for channels 0,1,2,3 would be:
%00100001 channel 0
%00100011 channel 1
%00100101 channel 2
%00100111 channel 3
^--single ended conversion
^^---channel selected
^--bit not used
^^^^--mode=12 bit lsb first
Tables tables IV and VI also lay out a lot of other modes, like the
differential inputs vs single ended, the number of bits, and whether
the data comes out lsbfirst or msbfirst, as well as power down,
conversion speed, and calibration modes.
>
>Do I tie Va+, VD+ and Vref all to the Stamp's 5volt supply, ussing bypass
>caps at each of these three pins, .01, .1 and 10 uf respectively?
For testing purposes, you can tie together those three pins, and also
tie together AGND, DGND and Vref-, and bypass the +'s to the -'s.
There are precautions to take later with these pins and circuit
layout in a final product for the best possible results. But for
go-no-go testing, just tie them together.
>
>Do I ignore the mux1, mux2, EOC, DOR\, Com, ADin1 and ADin2 pins?
Ignore (leave unconnected) the EOC and DOR\ pins.
Connect mux1 to ADin1, and mux2 to ADin2. On this chip, the
multiplexer is a separate unit from the ADC. The signals from
channel inputs (CH0 to CH4) are the inputs to the multiplexer, and
then the mux outputs feed the ADC inputs. Having the mux separate
from the ADC allows the designer to insert additional signal
conditioning (amplifier, filter etc) into the signal path between the
multiplexer and the ADC inputs.
>
>I have modified the program for the LTC1298 so it reads Channels 0 and 1
>three times at specified intervals, giving a total of six readings. Each of
>the six "x/12" data inputs to the Stamp are stored in different locations
>which can be debugged to the screen at any time as long as the Stamp has not
>been turned off. I can, for instance, read the temperature in the house and
>outside at 30 minute intervals and see on the screen how much the inside
>temperature varies as the outside temperature rises.
Yesterday our temperatures here went from 92 to 65 within two hours
as the fog rolled in!
Since you have the LTC1298 working, one option you might consider
would be to keep it and add your own multiplexer chip. The CD4052
is a CMOS dual 4:1 analog multiplexer. It would take two more pins
on your stamp to step through the 4 channels. Mux outputs go to your
existing ADC inputs. Then you would have up to 8 single ended inputs
or 4 differential inputs.
I use the Texas Instruments TLC2543 ADC. 12 bits, with 11
single-ended inputs and quite easy to use. About $7.
>My sparkler is laying on the kitchen table just in case.
I hope you did the sparkler in any case. I was pretty busy in charge
of the BBQ yesterday, and we took a 5 year old niece to see her first
real fireworks show.
>
>Thanks again, Tracy. If I can ever help you, I do PC board layouts, write
>control - but not data acquisition - programs and assemble PC boards, as long
>as you aren't in a big hurry.
>
>Sid
You're very welcome. What, me hurry, i mean, worry?!
-- regards,
Tracy Allen
electronically monitored ecosystems
mailto:tracy@e...
http://www.emesystems.com
Thank you very much, Tracy. You really answered all the questions posted.
As far as I can see, the BS2E has no CLK pin available where I could jumper
the CLK frequency to the ADC, so it looks like I will have to get an external
oscillator. Will check with Parallax to see what they might have.
Re the TLC2543 - I looked in Digikey and they have a CN and IN version. The
CN is 7.78, the IN is 8.35. What's the difference?
Does the 2543 require an external CCLK?
What would I do to the %00100001 config command to read 8 channels on the
2543, whihc is the most I would probably ever use?
Looked at the chip on the TI site. Found all kinds of block diagrams but no
actual pinouts. If I buy a 2543 could I get an 8-chnnel copy of the code you
use?
If I ever get to the point where I can really handle an ADC, I was thinking
of incorporating one into my URIO Jr. control board. That would give me
sensor monitoring and/or control of external device environments and
operating parameters.
Thanks again for your help, Tracy
Sid
>Re the TLC2543 - I looked in Digikey and they have a CN and IN version. The
>CN is 7.78, the IN is 8.35. What's the difference?
CN means commercial temperature range (0 to 70 C), IN for industrial
(-40 to +85 C)
>Does the 2543 require an external CCLK?
No, its conversion clock is built in. The chip uses TI's switched
capacitor technology.
>What would I do to the %00100001 config command to read 8 channels on the
>2543, whihc is the most I would probably ever use?
The 4 bit channel number is the most significant nibble of a 12 bit
command word sent to the chip.
ADch var nib ' channel number, 0 to 10:
shiftout sdo,sclk,msbfirst,[noparse][[/noparse]ADch<<8\12] ' command left justify ADch
%000000000000 for channel 0
%000100000000 for ch1
%001000000000 for ch2
%001100000000 for ch3 etc
>
>Looked at the chip on the TI site. Found all kinds of block diagrams but no
>actual pinouts. If I buy a 2543 could I get an 8-chnnel copy of the code you
>use?
Sure, it is on my web site at:
http://www.emesystems.com/OWL2face.htm#TLC2543
-- regards,
Tracy Allen
electronically monitored ecosystems
mailto:tracy@e...
http://www.emesystems.com
Thanks a million, Tracy.
Have to revise a couple of forms for the hospital then I'm going to get into
the 2543. Think I understand everything but might have a question about the
12-bit config code. Let me see what happens.
The sample was here when I got home from the hospital so I have everything I
need.
Later
Sid