Hello All,
I placed the following setup for reading Ac Current / Voltage using ADE7758 with PIC18F4520 Setup as follow.
This is the placement for ADE7758, I had setup the following Codes for PIC 18F4520
The Wave Form that I am getting is clean and up to the mark from PIC18F4520 (CRYSTAL @10Mhz) But there is no Data from DOUT of ADE 7758(10Mhz), its Showing some minor ripples of about 100mVpp.
Crystal of ADE7758 Shows sine-wave signals so that confirms that ADE7758 is running correctly(Hopefully)
But what can be the reason of No Data out from the ADE7758?
I placed the following setup for reading Ac Current / Voltage using ADE7758 with PIC18F4520 Setup as follow.
This is the placement for ADE7758, I had setup the following Codes for PIC 18F4520
Code:
unsigned char SPI_Read(unsigned char REG_ADDR)
{
unsigned char recv_data=0;
ADE_CS_EN=0;
ADE_CS = 0;//CS ENABLE
Delay1TCY(1); //SOME DELAY TO STABALIZE CHIP SELECT
WriteSPI(REG_ADDR);
_delay(100);
WriteSPI(0x00);
recv_data=SSPBUF;
Delay1TCY(1); //SOME DELAY TO STABALIZE CHIP SELECT
ADE_CS = 1;//CS_DISABLE
return ( recv_data ); // RETURN READ DATA
}
Code:
void main(void)
{
init();//INITIALIZE THE SYSTEM
unsigned char a=0;
//******************************WRITE CODE HERE********************************
while(1)
{
a=SPI_Read(OPMODE);
Nop();
}
}
Code:
INTI_SPI()
{
CloseSPI(); //TURN OFF SPI MODULE IF IT WAS OPEN
OpenSPI(SPI_FOSC_4,MODE_10,SMPMID);
TRISCbits.TRISC5 = 0; // /SDO - Output (Serial Data Out)
TRISCbits.TRISC4 = 1; // /SDI - Input (Serial Data In)
TRISCbits.TRISC3 = 0; // /SCK - Output (Clock)
}
Crystal of ADE7758 Shows sine-wave signals so that confirms that ADE7758 is running correctly(Hopefully)
But what can be the reason of No Data out from the ADE7758?