About the Vrms Register Reading Problem in ADE7763 using SPI

Status
Not open for further replies.

Deepak Rathore

Member level 2
Joined
Apr 25, 2012
Messages
46
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Visit site
Activity points
1,659
Hello Friends,

As I am using ADE7763 as analog IC to measure Vrms through SPI. But When i m not Giving Analog inputs on it's Anlog input pins(V2P,V2N), and then i m reading it's Vrms Register(0x17),it is giving some value on it.
my analog hardware Portion is complete working as i vary it's analog input in the hardware it is varying on it's analog input pins(V2P,V2N).


ideally when i did not give any input on it's inputs, it's readings will be zero. but it's not working as per my expectation.
so what suppose i need to do to correct my readings.

Please help me.

Deepak
 

View attachment SCHEMATIC1 _ ADE7763.pdf


Code:
void main()
{
   while (1U)
    {
	Vrms = Read_Vrms();
	SendLWord(Vrms,8,10);SendChar(0x0A);SendChar(0x0D);
	Delay_ms(100);
    }
}
    /* End user code. Do not edit comment generated here */
}

/* Start user code for adding. Do not edit comment generated here */
void Init_ADE7763()
{
	SPIWrite1Byte_ADE7763(0x0F|0x80,0x00);
	NOP();NOP();NOP();NOP();NOP();
	NOP();NOP();NOP();NOP();NOP();

	SPIWrite2Byte_ADE7763(0x09|0x80,0x000C);
	NOP();NOP();NOP();NOP();NOP();
	NOP();NOP();NOP();NOP();NOP();

	SPIWrite2Byte_ADE7763(0x0A|0x80,0x0010);
	NOP();NOP();NOP();NOP();NOP();	
	NOP();NOP();NOP();NOP();NOP();	
}

//=======================================================================================
unsigned long int Read_Vrms()
{
	unsigned char i,j;
	unsigned long int Vrms_temp,Vrms_Cal;
	unsigned long int Sum_Vrms,Avg_Total,Temp_Vrms,Vrms_Final[6];
	unsigned int Rstatus;

	Sum_Vrms = 0;

	for(j=0;j<5;j++)
	{
		for(i=0;i<100;i++)
		{
			 do
			{	
				Rstatus = SPIRead2Byte_ADE7763(0x0C);
				Rstatus	= (Rstatus & 0x001F);
			}while(Rstatus == 0x0010);
					
			Temp_Vrms = SPIRead3Byte_ADE7763(0x17);
			NOP();NOP();NOP();NOP();
			Sum_Vrms = Sum_Vrms + Temp_Vrms;
		}
		Avg_Total = (Sum_Vrms/100);
		Vrms_Final[j] = Avg_Total;
		Sum_Vrms = 0;
	}
	Vrms_temp = Vrms_Final[3];

	Rstatus = SPIRead2Byte_ADE7763(0x0C);

	return Vrms_temp;
}


hello friend ,

i have attached the code and schematic of Project.
i hve used renesas MCU(RL78/G13) and cubesuite compiler.

Please see it and tell me that i m doing something wrong in it.

Deepak
 

function SPIRead2Byte_ADE7763(); is it reliable ?


datasheet says

"Data Output for the Serial Interface. Data is shifted out at this pin upon the rising edge of SCLK.

DIN Data Input for the Serial Interface. Data is shifted in at this pin upon the falling edge of SCLK."
 



i have already check all my SPI Functions by reading the default values of the registers. it is giving me correct default value.so all the functions are perfect.

and in that code, after writing all initial values, i read their written values in that register.it is giving me right value.
so SPIRead2Byte_ADE7763 is right function.

Deepak
 

what about ref voltage input circuit

hi...

ADE7763 has inbuilt ref. voltage is that 2.4V.
but in my case it is 2.386V measured by MM.


Deepak

- - - Updated - - -

hi justin,

in the previous post i have already posted the code and Schmeatic.

first is there any mistake in the Schematic of ADE7763.

nd second in the code in the Init_ADE7763 function all the configuration is ok or not.

nd also my method of reading Vrms is correct or not.

is there any mistake in the reading of Vrms then pleae tell me to how to read the Vrms register.


Please reply ASAP.


Deepak
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…