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.

[SOLVED] Help for 5460A interfacing with avr8515

Status
Not open for further replies.

dhruv_electro

Advanced Member level 4
Full Member level 1
Joined
Dec 17, 2010
Messages
118
Helped
9
Reputation
18
Reaction score
8
Trophy points
1,298
Location
India
Activity points
2,378
hi there,

I am newbie to this site. I am using PT100 Class A to mesure Tempreature of a medical environment. I want precision in mesurement up to 20 bits. So I have selected this IC. But as this is first time for me I am facing some probs. As I am calibrating the IC with some voltage on V+ and V- pin(125mV). but it always show 0x000000 in its calibrating resistor(both AC and DC). And when i am using gain calibration and I am giving 245mv to voltage chanal than also it shows 0x400000. In both the cases it gives me a default values only. So is there any special sequence for calibration??. Please note down that I am giving 0xD9, 0xDD, 0xDA and 0xE8 commands for DC calibration, AC calibration, Gain calibration and Start conversion respectivly.

Again I am Facing another problem also, when I use default setting for 5460A and not calibrating it and giving 0v in both voltage and current channal than also it gives me some reading in Vrms and Irms resistors and it is 0x0CDC5D in voltage channal and 0x038AB8 and it is continuously changing the value, as I am continuously reading and displaying it on my 16x2 LCD.

Thanks..
 
Last edited:

at first set resolution for lower bits
then step by step
go on for bigger resolution
That will be right way
in that case u will be able to find correct cal//s settings
(+++ check noise hum factor etc)
PEACE :)
 

Dear Rajat,

I follow the datasheet given for calibration also herewith I am giving you my code.

/*
------------------------------------------------------------------
This program is made for Testing the LCD and 5460 routins
------------------------------------------------------------------
*/
#include<avr/io.h>

#ifndef F_CPU
#define F_CPU 8000000UL
#endif

#include<util/delay.h>
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include<avr/interrupt.h>

#include "LCD_dhruv.h"
#include "keypad_dhruv.h"

#define DDR_SPI DDRB
#define DD_MOSI DDB5
#define DD_SCK DDB7

#define CS_DDR DDRB

#define CS_PORT PORTB
#define CS_IC0 PB0
#define CS_IC1 PB1
#define CS_IC2 PB2
#define CS_IC3 PB3
#define CS_IC4 PB4

#define EN_CS0() (CS_PORT&=(~(1<<CS_IC0)))
#define EN_CS1() (CS_PORT&=(~(1<<CS_IC1)))
#define EN_CS2() (CS_PORT&=(~(1<<CS_IC2)))
#define EN_CS3() (CS_PORT&=(~(1<<CS_IC3)))
#define EN_CS4() (CS_PORT&=(~(1<<CS_IC4)))

#define DS_CS0() (CS_PORT|=(1<<CS_IC0))
#define DS_CS1() (CS_PORT|=(1<<CS_IC1))
#define DS_CS2() (CS_PORT|=(1<<CS_IC2))
#define DS_CS3() (CS_PORT|=(1<<CS_IC3))
#define DS_CS4() (CS_PORT|=(1<<CS_IC4))


void SPI_MasterInit(void);
void SPI_MasterTransmit(unsigned char cData);
unsigned char SPI_MasterReceive(void);
void spi_reinitilise(void);
unsigned long int SPI_Read_data(char cData);
void spi_data_write(char command,unsigned long int x);

int main(void)
{
unsigned long int x;

InitLCD(LS_BLINK|LS_ULINE);

SPI_MasterInit();

EN_CS2();
x=0x000081;
spi_data_write(0x00,x);
DS_CS2();

spi_reinitilise();

_delay_ms(500);

LCDClear();
LCDWriteString("Set 0 for DCOFF",0,0);
LCDWriteString("& then press F1",0,1);

while (Key_scan()!=F1);

LCDClear();
LCDWriteString("Please Wait...",0,0);

EN_CS2();
SPI_MasterTransmit(0xD9);
DS_CS2();

_delay_ms(500);

EN_CS2();
x=SPI_Read_data(0x06);
spi_data_write(0x06,x);
DS_CS2();

EN_CS2();
x=SPI_Read_data(0x02);
spi_data_write(0x02,x);
DS_CS2();

LCDClear();
EN_CS2();
x=SPI_Read_data(0x06);
DS_CS2();
LCDGotoXY(0,0);
//LCDWriteInt(x>>8,5);
LCDWritelong_Intdec(x,10,0);

EN_CS2();
x=SPI_Read_data(0x02);
DS_CS2();
LCDGotoXY(0,1);
//LCDWriteInt(x>>8,5);
LCDWritelong_Intdec(x,10,0);

_delay_ms(5000);

LCDClear();
LCDWriteString("Set 0 for ACOFF",0,0);
LCDWriteString("& then press F1",0,1);

while (Key_scan()!=F1);

LCDClear();
LCDWriteString("Please Wait...",0,0);

EN_CS2();
SPI_MasterTransmit(0xDD);
DS_CS2();

_delay_ms(500);

EN_CS2();
x=SPI_Read_data(0x22);
spi_data_write(0x22,x);
DS_CS2();

EN_CS2();
x=SPI_Read_data(0x20);
spi_data_write(0x20,x);
DS_CS2();

LCDClear();
EN_CS2();
x=SPI_Read_data(0x22);
DS_CS2();
LCDGotoXY(0,0);
//LCDWriteInt(x>>8,5);
LCDWritelong_Intdec(x,10,0);

EN_CS2();
x=SPI_Read_data(0x20);
DS_CS2();
LCDGotoXY(0,1);
//LCDWriteInt(x>>8,5);
LCDWritelong_Intdec(x,10,0);

_delay_ms(5000);

LCDClear();
LCDWriteString("Set MAX for GAIN",0,0);
LCDWriteString("& then press F1",0,1);

while (Key_scan()!=F1);

LCDClear();
LCDWriteString("Please Wait...",0,0);

EN_CS2();
SPI_MasterTransmit(0xDA);
DS_CS2();

_delay_ms(500);

EN_CS2();
x=SPI_Read_data(0x08;);
spi_data_write(0x08,x);
DS_CS2();

EN_CS2();
x=SPI_Read_data(0x04);
spi_data_write(0x04,x);
DS_CS2();

LCDClear();
EN_CS2();
x=SPI_Read_data(0x08;);
DS_CS2();
LCDGotoXY(0,0);
//LCDWriteInt(x>>8,5);
LCDWritelong_Intdec(x,10,0);

EN_CS2();
x=SPI_Read_data(0x04);
DS_CS2();
LCDGotoXY(0,1);
//LCDWriteInt(x>>8,5);
LCDWritelong_Intdec(x,10,0);

_delay_ms(5000);

EN_CS2();
SPI_MasterTransmit(0xE8;);
DS_CS2();

_delay_ms(500);

LCDClear();


for(;;)
{
EN_CS2();
x=SPI_Read_data(0x18;);
DS_CS2();
LCDGotoXY(0,0);
//LCDWriteInt(x>>8,5);
LCDWritelong_Intdec(x,10,0);


/*EN_CS2();
x=SPI_Read_data(0x06);
DS_CS2();
LCDGotoXY(6,0);
LCDWriteInt(x>>8,5);
//LCDWritelong_Intdec(x,10,0);
*/

EN_CS2();
x=SPI_Read_data(0x16);
DS_CS2();
LCDGotoXY(0,1);
//LCDWriteInt(x>>8,5);
LCDWritelong_Intdec(x,10,0);


/*EN_CS2();
x=SPI_Read_data(0x02);
DS_CS2();
LCDGotoXY(6,1);
LCDWriteInt(x>>8,5);
//LCDWritelong_Intdec(x,10,0);
*/
}

} //MAIN OVER


void SPI_MasterInit(void)
{
/* Set MOSI and SCK output, all others input */
DDR_SPI = (1<<DD_MOSI)|(1<<DD_SCK);
/* Enable SPI, Master, set clock rate fck/16 */
SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR1)|(1<<SPR0);

CS_DDR|=(1<<CS_IC0 | 1<<CS_IC1 | 1<<CS_IC2 | 1<<CS_IC3 | 1<<CS_IC4);
CS_PORT|=(1<<CS_IC0 | 1<<CS_IC1 | 1<<CS_IC2 | 1<<CS_IC3 | 1<<CS_IC4);
}

void SPI_MasterTransmit(unsigned char cData)
{
char dummy;
/* Start transmission */
SPDR = cData;
/* Wait for transmission complete */
while(!(SPSR & (1<<SPIF)));
dummy=SPDR;
}

unsigned char SPI_MasterReceive(void)
{
/* Wait for reception complete */
while(!(SPSR & (1<<SPIF)));
/* Return data register */
return SPDR;
}

void spi_reinitilise(void)
{
char dummy;
SPDR =0XFF;
while(!(SPSR & (1<<SPIF)))
dummy=SPDR;
SPDR =0XFF;
while(!(SPSR & (1<<SPIF)))
dummy=SPDR;
SPDR =0XFF;
while(!(SPSR & (1<<SPIF)))
dummy=SPDR;
SPDR =0XFE;
while(!(SPSR & (1<<SPIF)))
dummy=SPDR;
}

unsigned long int SPI_Read_data(char cData)
{
char spi_data1=0,spi_data2=0,spi_data3=0;
/* Start transmission */
spi_reinitilise();
SPDR = cData;
/* Wait for transmission complete */
while(!(SPSR & (1<<SPIF)))
spi_data3=SPDR;
SPDR = 0xff;
while(!(SPSR & (1<<SPIF)))
spi_data3=SPDR;
SPDR = 0xff;
while(!(SPSR & (1<<SPIF)))
spi_data2=SPDR;
SPDR = 0xff;
while(!(SPSR & (1<<SPIF)))
spi_data1=SPDR;
//__ser_rx_buffer[3]=spi_data2;
//__ser_rx_buffer[4]=spi_data1;
return (0x00FFFFFF & (((spi_data3*65536) & 0x00FF0000)|((spi_data2<<8;) & 0x0000FF00)|(spi_data1& 0x000000FF)));
}

void spi_data_write(char command,unsigned long int x)
{
char dummy2,data_byte3,data_byte2,data_byte1;
data_byte3=x>>16;
data_byte2=x>>8;
data_byte1=x;
spi_reinitilise();
SPDR=command | 0x40;
while(!(SPSR & (1<<SPIF)))
dummy2=SPDR;
SPDR=data_byte3;
while(!(SPSR & (1<<SPIF)))
dummy2=SPDR;
SPDR=data_byte2;
while(!(SPSR & (1<<SPIF)))
dummy2=SPDR;
SPDR=data_byte1;
while(!(SPSR & (1<<SPIF)))
dummy2=SPDR;
}


/*for (;;)
{
temp = Key_scan();
_delay_ms(20);
temp1 = Key_scan();
if (temp == temp1 && temp != temp2)
{
display_hex(temp,13,0);
temp2 = temp;
} //if loop

} //for loop
*/
 
Last edited:

First u can get nice results with onchip adc module type mcu
1 cheap
2 simple
3 better
4 I DONT THINK THIS ARRANGEMENT IS GOING TO GIFT UUUUU 20 BIT ACCURACY
ITNA NHI BAN PAYEGA BHAI
STEP BY STEP CHALNAY PAR BHI DEBUG KRTEY --2
I M NOT SURE U GET RESULT
READ PAGE NO 28
 

Attachments

  • datasheet.pdf
    956.2 KB · Views: 161

no dear I am not able to get you. What are you trying to say..??
 

Hay I have solved this problem.
As I have read datasheet of CS5460, It says that 5460 takes some time to calibrate, and than I have tried some combination of delay and one delay combination works perfectly for me. Try this out : 1. Do DC calibration and wait for 5 sec
2. Do AC calibration and wait for 12sec
3. Do Gain calibration and wait for 8sec.
After following this step I found 5460 result to the idea.
Thanks
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top