PDA

View Full Version : AD7391 digital to analog converter



srob
- 11th November 2005, 09:25
Am trying to interface a 16F84 to the AD7391 DAC, but with limited success. I have wired the DAC for unipolar output mode, with a 2.5V reference voltage and I am getting irratic output voltage. Can anyone see where I'm going wrong? Thanks

' AD7391 10-bit DAC evaluation programme

TRISB=0 'portb outputs

DEFINE SHIFT_PAUSEUS 100

'AD7390 pins
sdi var portb.0 ' data pin
clk var portb.1 ' clock pin
ld var portb.2 ' load strobe
clr var portb.3 ' clear

led var portb.4 'indicator led

volt var word ' required voltage
v1 var volt.highbyte
v2 var volt.lowbyte

low clr
pause 1
high clk
pause 1
high ld

pause 1000
high clr

main: volt=0 'set voltage to zero
gosub AD7390
volt=205 'set voltage to 0.5V
gosub AD7390
volt=410 'set voltage to 1.0V
gosub AD7390
volt=615 'set voltage to 1.5V
gosub AD7390
volt=820 'set voltage to 2.0V
gosub AD7390

goto main

AD7390: freqout led,500,1000
high ld
pause 10
shiftout sdi,clk,5,[volt] 'msb first, clk idles high
pause 10
low ld
pause 5000
return

mister_e
- 11th November 2005, 15:57
i can't really check the datasheet here but, if the DAC is a 10 bit, what aboout using


shiftout sdi,clk,5,[volt\10] 'msb first, clk idles high

srob
- 11th November 2005, 21:29
If only it were that simple Steve. Have tried sending the 10 bit data and still the same results. The data sheet does say that if 16 bits are sent, the first 6 bits are ignore, but thanks for the reply.

arniepj
- 12th November 2005, 02:16
Unfortunately the Dac doesn't allow you to shiftin data to test whether the shiftin/out commands work with the ic.I have found the commands work with eeproms but not always with other ic's.Therefore you must write your own.Attached is an example for a Max 1270 A/D.

arniepj
- 12th November 2005, 02:21
Heres that attachment.

arniepj
- 12th November 2005, 02:33
One more time .I just put VB6 on my pc and it hijacked my extensions.

srob
- 12th November 2005, 12:07
Thanks arniepj. Will give it a try and let you now how I get on