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.

Problem with code for interfacing ADE7754 with 89c51

Status
Not open for further replies.

lats

Full Member level 4
Full Member level 4
Joined
Oct 27, 2005
Messages
216
Helped
13
Reputation
26
Reaction score
6
Trophy points
1,298
Visit site
Activity points
2,945
Hi,
last night i was trying to interface ADE7754 with 89c51. I just gave 220 v AC voltage at Phase A input (via 1Mohm/1K resistor network) and read the value of AVrms register which is showing a huge value which changes with change in voltage. But the value is too large than maximum possible.

I doubt in one part of my code. Should the code be written as :-

Code:
CLR  C
SETB SCLK
CLR  SCLK		;SERIAL CLOCK TO ADE7754

MOV C, DOUT  		;DOUT IS DATA OUT OF ADE7754
RLC A

or should this be as below????

Code:
CLR  C
SETB SCLK

MOV C, DOUT  		
RLC A

CLR  SCLK		;CLR SCLK SHOULD BE DONE AFTER RLC?????

Thanks
 

Re: Code problem

ADE7754 has a built-in SPI interface.
Data is shifted out of the ADE7754 at the DOUT logic output on a rising edge of SCLK.
Until the next rising edge the DOUT output level is constant.
Usual the data is read by microcontroller on falling edge of SCLK.

For compatibility with 8051 series with 1 or 4 cks / machine cycle :

Code:
CLR  C 
SETB SCLK
NOP 
CLR  SCLK      ;SERIAL CLOCK TO ADE7754 

MOV C, DOUT        ;DOUT IS DATA OUT OF ADE7754 
RLC A

though and this is correct

Code:
CLR  C 
SETB SCLK 
NOP

MOV C, DOUT         
RLC A 

CLR  SCLK      ;CLR SCLK SHOULD BE DONE AFTER RLC?????
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top