Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of DEBUG_10K by
Revision 2:d93488b7eec5, committed 2018-03-22
- Comitter:
- junhaozhang
- Date:
- Thu Mar 22 20:17:06 2018 +0000
- Parent:
- 1:2967e2507d52
- Commit message:
- ZHANG XU
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Mar 08 15:58:06 2018 +0000 +++ b/main.cpp Thu Mar 22 20:17:06 2018 +0000 @@ -7,11 +7,16 @@ int main() { double Vin10k=3.3; - double Rs=2.7e03;//ohm + double Rs=300;//ohm int typeSP=1;//type 1-series or 2-parallel - double Ro=33;//ohm + double Ro=15;//ohm double f=10000;//Hz - + + if (typeSP==1) printf("in series\n\r"); + else if (typeSP==2) printf("in parallel\n\r"); + else printf("wrong type series/paralle?\n\r"); + + double pulse0=0;//measured quantity double angle=0;//measured quantity double Vo=0,Vo2=0,Vo3=0; @@ -22,16 +27,9 @@ double Rx=0,Cx=0; VAddr(10); - //RAddr(2); wait (0.5); pulse0=countPulse0(); Vo=peakDetector(); - - - /*wait (2); - printf("wait\n\r"); - pulse0=countPulse0Debug(); - Vo=peakDetectorDebug ();*/ angle=pwToAngle(pulse0); z= cal_z(Vin10k,Vo,Rs); @@ -51,17 +49,11 @@ printf("Rx_measured=%0.3lf ohm\n\r",Rx); - printf("wait\n\r"); + printf("wait 2s\n\r"); wait (2); pulse0=countPulse0(); Vo=peakDetector(); - - /*wait (2); - printf("wait\n\r"); - pulse0=countPulse0Debug(); - Vo=peakDetectorDebug ();*/ - angle=pwToAngle(pulse0); z= cal_z(Vin10k,Vo,Rs); printf("ave Vo=%0.3f\n\r",Vo); @@ -72,9 +64,7 @@ cal_Zx (z,angle,f,typeSP,Ro,&Zx,&Cx,&Rx); printf("|Zx|measured=%0.3lf ohm\n\r",Zx); - if (typeSP==1) printf("in series\n\r"); - else if (typeSP==2) printf("in parallel\n\r"); - else printf("wrong type series/paralle?\n\r"); + printf("Cx_measured=%0.6lf nF\n\r",Cx*1e9); printf("Rx_measured=%0.3lf ohm\n\r",Rx);