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.

energy meter with ade7753 and pic 18f2525

Status
Not open for further replies.

tcndenis

Newbie level 2
Joined
Jul 16, 2010
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
aguascalientes mexico
Activity points
1,316
hi i am an student from mexico, I'm trying to gauge a ade7753 enrgía but I need to do:
1-the driver in c ccs.
2-ccs program to read spi communication through real power, apparent and reactive, and display it in a 2X16 LCD.
someone can help me.
thanks.
 

I am sure if you show us what you have done, we can help you get where you want to be.
 

this is the driver for ade7753:
#ifndef ADE7753_CS
#define ADE7753_CS RC0
#endif

//The following memory locations come from the ADE7758 datasheet

//Name Address No. Bits
#define _WAVEFORM 0x01 //24
#define _AENERGY 0x02 //24
#define _RAENERGY 0x03 //24
#define _LAENERGY 0x04 //24
#define _VAENERGY 0x05 //24
#define _RVAENERGY 0x06 //24
#define _LVAENRGY 0x07 //24
#define _LVARENERGY 0x08 //16
#define _MODE 0x09 //16
#define _IRQEN 0x0A //16
#define _STATUS 0x0B //16
#define _RSTSTATUS 0x0C //16
#define _CH1OS 0x0D //8
#define _CH2OS 0x0E //8
#define _GAIN 0x0F //8
#define _PHCAL 0x10 //6
#define _APOS 0x11 //16
#define _WGAIN 0x12 //12
#define _WDIV 0x13 //8
#define _CFNUM 0x14 //12
#define _CFDEN 0x15 //12
#define _IRMS 0x16 //24
#define _VRMS 0x17 //24
#define _IRMSOS 0x18 //12
#define _VRMSOS 0x19 //12
#define _VAGAIN 0x1A //12
#define _VADIV 0x1B //8
#define _LINECYC 0x1C //16
#define _ZXTOUT 0x1D //12
#define _SAGCYC 0x1E //8
#define _SAGLVL 0x1F //8
#define _IPKLVL 0x20 //8
#define _VPKLVL 0x21 //8
#define _IPEAK 0x22 //24
#define _RSTIPEAK 0x23 //24
#define _VPEAK 0x24 //24
#define _RSTVPEAK 0x25 //24
#define _TEMP 0x26 //8
#define _PERIOD 0x27 //16
#define _TMODE 0x3D //8
#define _CHKSUM 0x3E //6
#define _DIEREV 0x3F //8

#byte POSTINC0= getenv("SFR:pOSTINC0")
#word FSR0= getenv("SFR:FSR0L")

void read_ADE7753(int16 *val,int8 addres,int8 len){
ADE7753_CS=0;
spi_write(0x80&addres);
FSR0=val;
do{
Delay_us(4);
POSTINC0=spi_read();
}while(--len);
ADE7753_CS=1;
}

void write_ADE7753(int32 val,int8 addres,int8 len){
ADE7753_CS=0;
spi_write(0x80&addres);
do{
Delay_us(4);
spi_write(*val++);
}while(--len);
ADE7753_CS=1;
}
and this is the code to read the ade7753:
#include <18f4550.h> //pic a utilizar
#DEVICE ADC=10
#include <Puertos.c>
#fuses XT,NOMCLR,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL1,CPUDIV1,NOVREGEN,NOPBADEN // fuse con cristal 48Mhz
#use delay (clock=48M) //Fosc=48Mhz

#define LCD_DATA4 PIN_B0
#define LCD_DATA5 PIN_B1
#define LCD_DATA6 PIN_B2
#define LCD_DATA7 PIN_B3
#define LCD_ENABLE_PIN PIN_B4
#define LCD_RS_PIN PIN_B5
#define LCD_RW_PIN PIN_B6

#include <lcd.c> //libreria manejo lcd

#include "ADE7753_Driver.c"

int32 Vrms;

void main(){
TRISA=0;
setup_spi(SPI_MASTER | SPI_H_TO_L | SPI_CLK_DIV_16 );
lcd_init(); //Iniciamos el LCD
lcd_putc("Vrms="); //Escribimos Vrms en el LCD
while(1){
read_ADE7753(&Vrms,_VRMS,3); //Leemos el Vrms del ADE7753
printf(lcd_putc,"%Lu",Vrms); //Lo imprimimos en la pantalla
lcd_gotoxy(6,1); //Enviamos el Cursor a la posicion 6,1
}
}

Added after 3 minutes:

actually i have an error in word in line of the driver:

#word FSR0= getenv("SFR:FSR0L")


thanks!
 

first of all, you want to comment extensively (to the point of almost excessively) your code so you and others know what you are doing.

2ndly, you do not want to include a .c file. you want to include the related header file.

lastly, which part of the code doesn't work - why and how? so others can help you.
 

hi, your knowledge can be helpful in my project. am implementing a project on measuring three different single phase electricity usage meter, am planning to use three pic's one as a master. does any one a better way of doing this
 

... measuring three different single phase electricity usage meter, am planning to use three pic's one as a master. does any one a better way of doing this

1) You can use three phase energy measurement IC, like ADE7754 + one microcontroller.
2) You can use three single phase energy measurement IC, like ADE7753 + three galvanic isolation circuits + one microcontroller.

If you want to use ADE7753, you can download sample circuit and source code **broken link removed**.
 

1) You can use three phase energy measurement IC, like ADE7754 + one microcontroller.
2) You can use three single phase energy measurement IC, like ADE7753 + three galvanic isolation circuits + one microcontroller.

If you want to use ADE7753, you can download sample circuit and source code **broken link removed**.

I have the same fixed idea :)
ad 1) It is not the way, even with the ADE7758 will not receive information on the consumption on the phase. If involved other than L1, L2, L3, for example L1, L1, L3.
ad 2) If use for a current measuring current transformer is not necessary to insolate themselves from the ADE7753 individually, it is sufficient to isolate the MCU or bus.
When the current measurement shunt, it is necessary that the ground was on the ADE7753 + shunt and ADE7753 for each make their own power and to isolate it from any other ADE and MCU.

Then I could think of nothing better.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top