| Electronic Components Datasheet Search |
|
MX844 Datasheet(PDF) 14 Page - IXYS Corporation |
|
|
|||||||||||||||||||||||||||||
MX844 Datasheet(HTML) 14 Page - IXYS Corporation |
|
14 / 21 page ![]() MX844 14 08/25/06 Drawing No. 084423 www.claremicronix.com MX844 IXYS /* separate voltage and current, report data */ for(i=0;i<np;i++) { ad[i] = (0x3f & d[4*i])+(64*(0x3f & d[4*i+1])); ad2[i] = (0x3f & d[4*i+2])+(64*(0x3f & d[4*i+3])); n[i] = ((0xc0 & d[4*i])>>6)+((0xc0 & d[4*i+1])>>4); n2[i] = ((0xc0 & d[4*i+2])>>6)+((0xc0 & d[4*i+3])>>4); } /* report voltage readings */ fprintf(inf,"Raw data: (n2,n1,n0) <ADC counts>\n"); fprintf(inf,"Voltage:\n"); for(i=0;i<np;i++) { fprintf(inf,"(%1d)%4d ",n[i],ad[i]); if(i%8 == 7) fprintf(inf,"\n"); } fprintf(inf,"\n"); /* report current readings */ fprintf(inf,"Current:\n"); for(i=0;i<np;i++) { fprintf(inf,"(%1d)%4d ",n2[i],ad2[i]); if(i%8 == 7) fprintf(inf,"\n"); } /* calculate Vrms */ sum = 0; ss = 0; for(i=0;i<np;i++) { sum += ad[i]; ss += (double)ad[i] * (double)ad[i]; } vrms = sqrt(ss/np - (sum/np)*(sum/np)); fprintf(inf,"\n%8.1f Volts rms\n",vrms * vscale); printf("\n%8.1f Volts rms\n",vrms * vscale); /* calculate Irms */ sumi = 0; ssi = 0; for(i=0;i<np;i++) { sumi += ad2[i]; ssi += (double)ad2[i] * (double)ad2[i]; } irms = sqrt(ssi/np - (sumi/np)*(sumi/np)); fprintf(inf,"%8.2f Amps rms\n",irms * iscale); printf("%8.2f Amps rms\n",irms * iscale); /* calculate apparent power (VA) */ aw = vrms * vscale * irms * iscale; printf("%8.1f VA\n",aw); fprintf(inf,"%8.1f VA\n",aw); fprintf(inf,"%5.1f calculated average V counts\n",sum/np); fprintf(inf,"%5.1f calculated average I counts\n",sumi/np); av = sum/np; /* fill the FFT data arrays */ for(i=1;i<=np;i++) /* fft data [1..np] instead of [0..np-1] */ { xd[i] = ad[i-1]; yd[i] = 0; } xd[0] = 0; yd[0] = 0; xd[np+1] = 0; yd[np+1] = 0; /* perform the windowing */ k = 2 * pi / (np - 1); /* i*k==0 if i=0, ==2*pi if i=127 */ for(i=0;i<np;i++) { /* remember [1..np] */ xd[i+1] *= 1-1.8533*cos(i*k)+0.7046*cos(2*i*k); } |
|
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |