PDA

View Full Version : Active low input?



CosMecc
- 10th November 2006, 16:14
Hi I'm trying to work about the AD7731 24 bit sigma-deltaAD converter, but I 've some problems:
What mean "Active low input"?
Does any one has a scheme about this ADC?

Thanks

mister_e
- 10th November 2006, 16:34
Active Low: This input will be active on a logic level 0,or 0V

You may find some timing diagram in your datasheet. Look how it goes.

CosMecc
- 11th November 2006, 09:21
Thanks
I've find the problem, I didn't connect the STANDBY pin of the AD7731, now it works fine.
The problem now is with 24bit numbers with PBP! (I'm work around)

P.S.: in some codes on the net, I've seen that the Proton PicBasic works with decimal numbers, it is right?

CosMecc
- 11th November 2006, 11:47
I've write a code that read the Data OUT of the AD7731, but i note that the most significant bit continuosly change??
I've setted the part to unipolar mode.

mister_e
- 11th November 2006, 19:29
Is it possible to send your schematic and code here?

CosMecc
- 12th November 2006, 11:01
Here is my code, for the schematic I'm drawing it...



'************************************************* ***************
'* Name : 7731_SigmA2D.BAS *
'* Author : Giandomenico Di Massa *
'* Notice : Copyright (c) 2006 *
'* : All Rights Reserved *
'* Date : 01/11/2006 *
'* Version : 1.0 *
'* Notes : *
'* : *
'************************************************* ***************
define OSC 10
define SHIFT_PAUSEUS 20

'LCD setup
Define LCD_DREG PORTB 'Set the LCD port
Define LCD_DBIT 4 'set the fist bit for the LCD
Define LCD_RSREG PORTB 'Set the bit Register Select port
Define LCD_RSBIT 1 'set Register Select pin
Define LCD_EREG PORTB 'Set bit Enable port
Define LCD_EBIT 2 'Set the Enable pin
Define LCD_BITS 4
Define LCD_LINES 4

'Serial Peripheral Interface setup
symbol SCK=PORTC.6 'Clock pin
symbol SI=PORTC.5 'AD7731 Data in pin
symbol SO=PORTC.4 'AD7731 Data out pin
symbol CS=PORTC.7 'AD7731 Chip select pin
symbol RDY=PORTC.2 'AD7731 Ready pin

'Variables declaration
C1 Var byte
Send Var byte 'Byte sent to the 8 bits Communication register of the AD7731
Command var byte 'Byte sent as command to a register setted by Send in Communcation register
Command2 var word 'Word sent to 16 bit register as Mode or Filter register of the AD7731
Rec VAR byte 'Byte received from AD7731:only for communication register 8 bit
AD var word 'AD converter value 16 bits data word
mVolt var word
dmVolt var word

pause 500
LCDOUT $FE,1
input rdy
LCDOUT "Initiating..."
gosub waitbutton
lcdout $FE, $C0, "OK"
pause 1000

Test_communication_interface: 'Active and deactive the D0 digital line to test the AD7731 - Communication
Send=$2 'Send command $2 hex to the communication register:next operation is a write on Mode register
Command2=$0B74 'Send command $0B74 hex to the Mode Register: Active Digital line, put hi the D0 output
gosub lcdupdate
gosub ad_write2 'Send command
gosub waitbutton
Send=$2 'Send command $2 hex to the communication register:next operation is a write on Mode register
Command2=$0974 'Send command $0974 hex to the Mode Register: Active Digital line, put low the D0 output
gosub lcdupdate
gosub ad_write2 'Send command
gosub waitbutton
Setup_Configuration:
Send=$3 'Send command $3 hex to the communication register:next operation is a write on Filter register
Command2=$8002 'Send command $8002 hex to the Filter register: 122Hz output rate in nonCHOP mode
gosub lcdupdate
gosub ad_write2 'Send command
gosub waitbutton

'AD7731 Self Calibration
Send=$2 'Send command $2 hex to the communication register:next operation is a write on Mode register
Command2=$91F4 'Send command $0974 hex to the Mode Register: Internal zero scale calibration
gosub lcdupdate
gosub ad_write2 'Send command
gosub waitrdy
Send=$2 'Send command $2 hex to the communication register:next operation is a write on Mode register
Command2=$B1F4 'Send command $B1F4 hex to the Mode Register: Internal full scale calibration
gosub lcdupdate
gosub ad_write2 'Send command
gosub waitrdy
Send=$2 'Send command $2 hex to the communication register:next operation is a write on Mode register
Command2=$D1F4 'Send command $D1F4 hex to the Mode Register: System zero scale calibration
gosub lcdupdate
gosub ad_write2 'Send command
gosub waitrdy
Send=$2 'Send command $2 hex to the communication register:next operation is a write on Mode register
Command2=$F1F4 'Send command $F1F4 hex to the Mode Register: System full scale calibration
gosub lcdupdate
gosub ad_write2 'Send command
gosub waitrdy
lcdout $FE,$1
Loop:
Send=$2 'Send command $2 hex to the communication register:next operation is a write on Mode register
command2=$50F4 'Send command $50F4 hex to the Mode Register: Single conversion,Range 0-1.28V, Data length 16 bit, AIN1-AIN2 Full Differential
gosub ad_write2 'Send command
gosub waitrdy
gosub ad_read 'Read the Data Registaer
lcdout $FE, $80,"Rec:",hex ad," "
lcdout $FE,$80+10," AD:",dec ad," "
lcdout $FE,$C0,"Ad:",bin16 ad
mvolt = ad*195 'Scale the 16 bit value to milliVolt
mvolt=div32 10000
dmvolt=R2/100
lcdout $FE,$94,"Volt:",dec mvolt,",",dec2 dmvolt, " mV "
pause 300
goto loop
END

AD_Write2:
'AD7731 write routine into a 16 bit register as Mode register
'first byte is sent to the Communication register for the register selection
'second word od 16 bit is value to be sent
'this routine is valid only for writin in 16 bits registers

low cs 'Enable Device
shiftout so,sck,1,[send\8] 'Send the command to the communication register: write enable command
shiftout so,sck,1,[command2\16] 'Send the command to the 16 bit register
high cs 'disable the device
return

AD_Read:
low cs
shiftout so,sck,1,[$11\8]
shiftin si,sck,0,[AD\16]
high cs
return

WaitButton:
button PORTC.3,255,0,0,C1,1,GoOut
goto waitbutton
GoOut:
return

LCDupdate:
LCDOUT $FE,1
lcdout "Comm. register: ", hex send,$FE, $C0,BIN8 send
lcdout $FE, $94,"Command: ",hex command2 , $FE, $D4,bin16 command2
return

WaitRDY:
while rdy=1
wend
return

CosMecc
- 13th November 2006, 22:53
Here is the scheme...
thanks

CosMecc
- 13th November 2006, 22:58
does any one has experience with this ADC?

mister_e
- 13th November 2006, 23:30
If i refer to the datasheet, they suggest 33pF capacitor wit a 4.9152MHz crystal.
Try increasing the capacitor value first.

CosMecc
- 13th November 2006, 23:44
Do you think that the cap difference could be the cause of the ADC instability?

mister_e
- 14th November 2006, 03:08
could be... i've never use this converter, i'm not on your bench, i don't see how you place it on your board (prototype or not) and unfortunately my scope probe are not long enough to reach you :D

could also be the supply line, wind direction or alien invasion... who knows ?

CosMecc
- 14th November 2006, 20:11
I'm trying with 33pF cap, but nothing new

CosMecc
- 14th November 2006, 22:20
Uhau!
I've found the problem! It isn't the AD7731, but the PIC, I've used the MSBPRE mode to read the data, changing to MSBPOST, it works very fine!!

Thanks

mister_e
- 15th November 2006, 04:12
DOH! i should see it before :(

Even a superhero may fail :D

Congratulation!

sparkysignal116
- 8th August 2010, 20:31
Hi everybody,

I have this module at home and i would like to experiment to get the same result but with a PIC16F628A. Will it work?.

I've seen the schematics and all seems to be fit into the processor i am trying to use.
I dont have any idea if the original creator of this thread is still active, but this project seems very exciting to me.