TLC542 A/D converter: newbie question
Archiver
Posts: 46,084
Here's a starting place. Maximizes throughput by doing input
and output on each clock cycle. Should be close to working
right.
Steve
clock CON 0 ' or whatever pin connected to
chip_select CON 1 ' "
address_out VAR OUT2 ' "
ADC_in VAR IN3 ' "
self_test CON %1011
channel VAR NIB
analog_data VAR BYTE
HIGH chip_select ' start with CS* high
LOW clock ' and clock low
OUTPUT address_out
channel = self_test
sampleLoop:
GOSUB getADC
DEBUG CR, DEC analog_data ' should be 126-128
PAUSE 1000
GOTO sampleLoop
getADC:
LOW chip_select
analog_data = ADC_IN * 128 'MSB
address_out = channel / 8
PULSOUT clock,1
analog_data = ADC_IN * 64 + analog_data
address_out = channel / 4
PULSOUT clock,1
analog_data = ADC_IN * 32 + analog_data
address_out = channel / 2
PULSOUT clock,1
analog_data = ADC_IN * 16 + analog_data
address_out = channel
PULSOUT clock,1
analog_data = ADC_IN * 8 + analog_data
PULSOUT clock,1
analog_data = ADC_IN * 4 + analog_data
PULSOUT clock,1
analog_data = ADC_IN * 2 + analog_data
PULSOUT clock,1
analog_data = ADC_IN + analog_data 'LSB
PULSOUT clock,1
HIGH chip_select
RETURN
On 25 Apr 01 at 12:56, mbarron.geo@y... wrote:
> hello :-), I just received my BS2 in the post and I happen to have a
> TLC542 analog to Digital converter chip left over from a parallel
> port project...
and output on each clock cycle. Should be close to working
right.
Steve
clock CON 0 ' or whatever pin connected to
chip_select CON 1 ' "
address_out VAR OUT2 ' "
ADC_in VAR IN3 ' "
self_test CON %1011
channel VAR NIB
analog_data VAR BYTE
HIGH chip_select ' start with CS* high
LOW clock ' and clock low
OUTPUT address_out
channel = self_test
sampleLoop:
GOSUB getADC
DEBUG CR, DEC analog_data ' should be 126-128
PAUSE 1000
GOTO sampleLoop
getADC:
LOW chip_select
analog_data = ADC_IN * 128 'MSB
address_out = channel / 8
PULSOUT clock,1
analog_data = ADC_IN * 64 + analog_data
address_out = channel / 4
PULSOUT clock,1
analog_data = ADC_IN * 32 + analog_data
address_out = channel / 2
PULSOUT clock,1
analog_data = ADC_IN * 16 + analog_data
address_out = channel
PULSOUT clock,1
analog_data = ADC_IN * 8 + analog_data
PULSOUT clock,1
analog_data = ADC_IN * 4 + analog_data
PULSOUT clock,1
analog_data = ADC_IN * 2 + analog_data
PULSOUT clock,1
analog_data = ADC_IN + analog_data 'LSB
PULSOUT clock,1
HIGH chip_select
RETURN
On 25 Apr 01 at 12:56, mbarron.geo@y... wrote:
> hello :-), I just received my BS2 in the post and I happen to have a
> TLC542 analog to Digital converter chip left over from a parallel
> port project...
Comments
TLC542 analog to Digital converter chip left over from a parallel
port project.
A data sheet on the chip is available at:
http://www-s.ti.com/sc/psheets/slas075b/slas075b.pdf
It is a 11 channel serial 8 bit analog to digital converter, with the
12 channel being a self test.
Now heres the question, how in the world do you make them talk to
each other. I tried mucking about with the Shiftin/Out commands. But
I only seem to get random numbers in the debug window.
And I am using the chips internal test channel(12) so I would get
consistent results if it was working.
Could someone point me in the right direction??
>TLC542 analog to Digital converter chip left over from a parallel
>port project.
>
>A data sheet on the chip is available at:
>http://www-s.ti.com/sc/psheets/slas075b/slas075b.pdf
>It is a 11 channel serial 8 bit analog to digital converter, with the
>12 channel being a self test.
>
>Now heres the question, how in the world do you make them talk to
>each other. I tried mucking about with the Shiftin/Out commands. But
>I only seem to get random numbers in the debug window.
>And I am using the chips internal test channel(12) so I would get
>consistent results if it was working.
I use the TLC2543, which is also 11 channel but 12 bit. I do not
know for sure, but the code might be similar. Take a look at:
http://www.emesystems.com/OWL2face.htm#TLC2543
-- Tracy