Austin Brown
/
2171_MicroLab_3
Make 2171 Great Again
Revision 1:f1d2d02d724d, committed 2019-12-04
- Comitter:
- austinbrown124
- Date:
- Wed Dec 04 02:36:34 2019 +0000
- Parent:
- 0:d229bc2fa375
- Commit message:
- Commit 2
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Dec 02 23:29:32 2019 +0000 +++ b/main.cpp Wed Dec 04 02:36:34 2019 +0000 @@ -33,8 +33,8 @@ DAC->DHR12R1 = (ADC1->DR); // set ADC value to DAC //set reference - if (Lcount == 250) { U_ref = 1.0f; ref_trig = 1;} - if (Lcount == 500) {Lcount = 0, U_ref = 0.5f; ref_trig = 0;} + if (Lcount == 250) { U_ref = 0.050f; ref_trig = 1;} //50 mA + if (Lcount == 500) {Lcount = 0, U_ref = 0.025f; ref_trig = 0;} //25 mA Lcount++; @@ -51,8 +51,8 @@ // Bang-bang controller is written below. Replace this with your PI controller. - if (U > 4096*0.5f) { Y = 0.1f*1440.0f; } // ADC readings scaled correctly - if (U < 4096*0.2f) { Y = 0.9f*1440.0f; } + if (U > 4096*0.4f) { Y = 0.3f*1440.0f; } // ADC readings scaled correctly + if (U < 4096*0.2f) { Y = 0.7f*1440.0f; } // end controller