Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Problems with AD7730 resolution in a weighing system design

Status
Not open for further replies.
Re: AD7730 problems

Hi All

I'm trying to run AD7730 with Atmega16 but there is some problem with the SPI Interface. I'm trying to write and read the DAC register to check if communication is proper.

Please verify the attached schematic and code.
Thanks in advance.

Regards
Apoorva Gag

AD7730.JPGAD7730.JPG

Code:
#include <avr/io.h> 	
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <math.h>
#include <inttypes.h>
#include <util/delay.h>
#include <string.h>
#include <stdlib.h>
#include <avr/signal.h>
#include "SPI_routines.h"
#include "UART_routines.h"

#define ADE_ASSERT() PORTB |= 0x10;
#define ADE_DEASSERT() PORTB &= 0xEF;

#define STATUS 0
#define DATA 1
#define MODE 2
#define FILTER 3
#define DAC 4
#define OFFSET 5
#define GAIN 6
#define TEST 7

char Print_Data[10];
unsigned int count;


int main(void){

	unsigned int read_data,count;
	unsigned int a,i;

	DDRA = 255;
	DDRB = 255;
	PORTB = 0x00;		// ADE7753 Reset pin set low

	// Initializations
	uart0_init();
	spi_init();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
	// ADE7753 Reset and CS ON
	ADE_ASSERT()
	PORTB = 0x08;		// ADE7753 Reset pin pulled high
	_delay_ms(100);
	ADE_DEASSERT()		// ADE7753 CS pin pulled low
	_delay_ms(100);

while(1)
	{
	PORTA = 0x00;
	_delay_ms(200);
	_delay_us(200);

	PORTA = 0x80;		//Check LED at PORTA
	_delay_ms(200);
	_delay_ms(200);


	SPI_transmit(0x04);	//Send DAC Write Command - Write to the communication Register
	_delay_us(1);
	SPI_transmit(0x10);	//Write 16 to the DAC Register
	_delay_us(1);

	SPI_transmit(0x14);	//Send DAC Read Command - Write to the communication Register
	_delay_us(1);
	count = SPI_receive();	//Read DAC Register

	itoa(count,Print_Data,10);//Print Count value, if 16 then SPI working properly
	transmitString(Print_Data);
	transmitString("\t");
	transmitString("CBC \r\n");

	}
}
 
Last edited:

Re: AD7730 problems

Hi,

I had also problems with avr and spi. The problem is that: if I am using the spi built-in from avr it happened that some time didn't worked because ad7730 requires clock both when sending and reading data. Therefore I made by my self the spi routines and I had no such problem.
 
Re: AD7730 problems

Paurelian

Thanks for the reply. I tried that also, bit-bang SPI using GPIO. Still no clue :(
I check the crystal - it's oscillating, replaced the chip too.

Can any one tell me what would be the easiest way to check if SPI is working ? Or do we need some sort of configuration before it works.

Thanks
 

Re: ad7730

hi,

can you help me how to interface ADS1232 (24bit- ADC) with any microcontroller
 

Re: ad7730

Hi guys
I've been working a couple weeks on AD7730 and , until now I could get a number about 32768 . but .... but some times between this numbers I have 65535 !!!:sad:
I don't know what happen!! I always check RDY to be sure that convert is done completely and then read data register.
I put my code and schematic here. I hope some one could solve my problem.
 

Attachments

  • Internal Zero & Full Scale_3.rar
    107.7 KB · Views: 118
  • 1.jpg
    1.jpg
    156.4 KB · Views: 184
Last edited:

Re: ad7730

Hi guys
I've been working a couple weeks on AD7730 and , until now I could get a number about 32768 . but .... but some times between this numbers I have 65535 !!!:sad:
I don't know what happen!! I always check RDY to be sure that convert is done completely and then read data register.
I put my code and schematic here. I hope some one could solve my problem.

Hi, I had some similar problem with AD7730. AD7730 is connected to Silabs 8051F930 and HW SPI on the uP is used. SPI lines is connected via logic gates. Between output logic gate for CLK and AD7730 is resistor 1k Ohm (I know, that this is too large value, but this value was important for fix the problem), others SPI signals are connected via logic gates too. When I have connected logic analyser (www.saleae.com) directly on the AD7730 (behind the resistor), communication was incorrect sometimes (4 from 16). uP reads bad data from AD7730 (0xFFFFFF or 0xFFFFFE,....) and uP writes bad data sometimes (!). After change a connection of logic analyser directly to output of logic gate - incorrect data disappears. I think, that logic analyser was capacitance load and AD7730 is SENSITIVE to CLK shape.

Martin
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top