EmbeddedRelated.com
Forums
Memfault Beyond the Launch

using ad7730 whith micro avr

Started by mrsaeed_2002 February 7, 2007
i can not using ad7730 whith avr32 (spi)
please help me.
i have a schematicand a sample code to connecting to ad7730.
--- In a..., "mrsaeed_2002"
wrote:
>
> i can not using ad7730 whith avr32 (spi)
> please help me.
> i have a schematicand a sample code to connecting to ad7730.
>
i think i can help you .i implemented a project using ad7715 (similar
to ad7730) at first you should use a cristal for your avr " don't use
internal oscillator "
2-use very good refrance voltage
3-you should calibrate ad7715 then you can read from it
4-this function i have written can help you :(for ad7715)

.........................at first

#define ADC_RESET PORTB.1
#define ADC_CS PORTB.3
#define ADC_DRDY PINB.0
#define high 1
#define low 0

.....................in avr initialzation
// SPI initialization
// SPI Type: Master
// SPI Clock Rate: 1000.000 kHz
// SPI Clock Phase: Cycle Start
// SPI Clock Polarity: High
// SPI Data Order: MSB First
SPCR=0x5D;
SPSR=0x00;
................
////////SPI initializing
void adc_init(void)
{
lcd_clear();
lcd_gotoxy(2,0);
lcd_putsf("Please wait");
ADC_RESET=low;

ADC_CS=low; //Set low to AD7715 chip select low pin
ADC_RESET=high; //Set high to AD7715 reset low pin
ADC_CS=high;
delay_ms(1800);
ADC_CS=low;
spi( 0x10 );
ADC_CS=high;
ADC_CS=low; //Communications Register
spi( 0x74); //250Hz update rate
ADC_CS=high; //Setup Register info here
lcd_gotoxy(2,1);
lcd_putsf("Calibrated");
delay_ms(150);
lcd_clear();

}
///////////////////// read_spi() function
unsigned int read_spi()

{
unsigned result;
while ( ADC_DRDY);
while (! ADC_DRDY );
while ( ADC_DRDY );
ADC_CS=low;
spi(0x38);
ADC_CS=high;
ADC_CS=low;
result=(unsigned) spi(0)<<8;
ADC_CS=low;
result|=spi(0);
result=(unsigned) ((unsigned long) result);
return result;
}

if you have any question may i can help you
mehdi zamani
i reading your code and chenging its for ad7730
but never ready pin not active and i can not reading data from data
reagister.
my ref volt: 2.7
and using 4mh crystal fro ad7730 and 11.0592 crystal from mega32 micro.
--- In a..., "mrsaeed_2002"
wrote:
>
> i reading your code and chenging its for ad7730
> but never ready pin not active and i can not reading data from data
> reagister.
> my ref volt: 2.7
> and using 4mh crystal fro ad7730 and 11.0592 crystal from mega32
micro.
>
I change my code maybe it can work on ad7730 .pay attention read the
datasheet first i will send you example
i can not working whit ad7730.
please helpe me.
you have to reset ad7730 before each instruction; its is a bug for ad7730
hardware.

On 2/12/07, mrsaeed_2002 wrote:
>
> i can not working whit ad7730.
> please helpe me.
>
--- In a..., "A. R. Khorasani"
wrote:
>
> you have to reset ad7730 before each instruction; its is a bug for
ad7730
> hardware.
>
> you have a sample code about drive ad7730.
when i config cominucation reg in ad7730 and waiting to readypin low .
but never thisevent.
and data register is 0.
I only have code for ad7711.

On 2/13/07, mrsaeed_2002 wrote:
>
> --- In a... , "A. R.
> Khorasani"
> wrote:
> >
> > you have to reset ad7730 before each instruction; its is a bug for
> ad7730
> > hardware.
> >
> > you have a sample code about drive ad7730.
> when i config cominucation reg in ad7730 and waiting to readypin low .
> but never thisevent.
> and data register is 0.
>
may you send this code ?

"A. R. Khorasani" wrote:
I only have code for ad7711.

On 2/13/07, mrsaeed_2002 wrote:
>
> --- In a... , "A. R.
> Khorasani"
> wrote:
> >
> > you have to reset ad7730 before each instruction; its is a bug for
> ad7730
> > hardware.
> >
> > you have a sample code about drive ad7730.
> when i config cominucation reg in ad7730 and waiting to readypin low .
> but never thisevent.
> and data register is 0.
>



---------------------------------
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives. Check it out.

Memfault Beyond the Launch