2Chx3dof Magnetrometer supported M-Series Random Sequence Generator Servo Control
Sampling Frequency
Sampling Frequency in main.cpp
#define SampleFreq 200 // [Hz]
Auto Stop Setting
Auto-stop Timer 15sec after
// auto-stop when 15sec after if(smpl_cnt>3000){stop_dump();}
The number of 3000 means Sample Count. The number is given by SampleFreq[Hz] * Auto-Stop Time [sec].
M-Series Random Sequence
M-series Random Update Term in main.cpp
// M-series update flag #define M_TERM 200;
Unit is sample count.
cf.) 200 equals to 200 [samples] which equals to 1 [second] where SampleFreq = 200 [Hz}.
See above.
M-Series Random Servo Control
Diff: M-Series.h
- Branch:
- MPU-9250-MagSensServo
- Revision:
- 8:07c3cb01a5b6
- Parent:
- 2:3470f2c07582
- Child:
- 9:b32312aacbba
diff -r a711da20a262 -r 07c3cb01a5b6 M-Series.h --- a/M-Series.h Tue Feb 02 15:44:38 2021 +0000 +++ b/M-Series.h Tue Feb 02 17:12:57 2021 +0000 @@ -6,7 +6,12 @@ // m-sequence // https://okasho-engineer.com/m-sequence/ - +// +// Maximum-Length Tap Position and Number of taps +// http://wista.jp/M-Seq.htm +// +// 既約多項式 +// https://www.nagoya-bunri.ac.jp//~t-ymzm/rand/rand_mseq4.html #ifndef __M_SERIES_H__ #define __M_SERIES_H__ @@ -23,6 +28,11 @@ public: Mseries() { + init(); + } + + void init(void) + { // the following initial values are not validated M[0] = 0; M[1] = 0; @@ -41,23 +51,50 @@ M[14] = 0; M[15] = 1; - // the following initial values are not validated - H[0] = 1; + // Maximum-Length Tap Position and Number of taps + // http://www5b.biglobe.ne.jp/~pisan/radio-Msequence.htm + // + H[0] = 1; H[1] = 0; - H[2] = 0; - H[3] = 1; - H[4] = 1; + H[2] = 1; + H[3] = 0; + + H[4] = 0; H[5] = 0; H[6] = 0; - H[7] = 1; - H[8] = 1; - H[9] = 0; + H[7] = 0; + + H[8] = 0; + H[9] = 0; H[10] = 0; H[11] = 1; - H[12] = 1; + + H[12] = 0; H[13] = 0; H[14] = 0; H[15] = 1; + // +// +// // 0806(HEX) = [latest] 0001 1111 0101 0000 (2) [oldest] +// H[0] = 0; // 0000 (oldest) +// H[1] = 0; +// H[2] = 0; +// H[3] = 0; +// +// H[4] = 1; // 0101 +// H[5] = 0; +// H[6] = 1; +// H[7] = 0; +// +// H[8] = 1; // 1111 +// H[9] = 1; +// H[10] = 1; +// H[11] = 1; +// +// H[12] = 1; // 0001 +// H[13] = 0; +// H[14] = 0; +// H[15] = 0; } uint8_t update(void)