急急急,ADE7753读IRMS

寄存器的值已经能读写了,只想读取电流参数

,但是把两个电流口短路时测的值很乱,只给电流上电时值也是。已经设置了MODE中的13、14位和终端使能的第3位。

...

write_operation(0,MODE,0x4088);
write_operation(0,IRQEN,0x44);

while(1){
for(j=1;j<10;j++){
//lval=read_operation(ch,j);

//lval=read_operation(ch,CH1OS);
//SBUF = lval;
//while(TI==0); 
//TI=0;
//delay_us(200000);
ulval=read_operation(ch,IRMS);
if((ulval & 0x800000) != 0 )
ulval = (~IRMS) && 0x7FFFFF ;
ulval = ulval/56;//ScaleOfIRMS 56
TempIRMS = (TempIRMS*7+ulval) >>3;
SBUF = ulval;
while(TI==0); 
TI=0;
delay_us(200000000);