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.
Dependencies: HIDScope MODSERIAL TextLCD mbed-dsp mbed
Fork of EMGmeten by
Revision 2:5d64e4c95f5c, committed 2014-10-28
- Comitter:
- lauradeheus
- Date:
- Tue Oct 28 16:37:27 2014 +0000
- Parent:
- 1:b7a9fcf50776
- Child:
- 3:c82170d8b6c8
- Commit message:
- bandpass, notch en absoluut goed werkend
Changed in this revision
| EMGmeten.cpp | Show annotated file Show diff for this revision Revisions of this file |
| MODSERIAL.lib | Show annotated file Show diff for this revision Revisions of this file |
--- a/EMGmeten.cpp Tue Oct 28 14:37:59 2014 +0000
+++ b/EMGmeten.cpp Tue Oct 28 16:37:27 2014 +0000
@@ -1,20 +1,24 @@
#include "mbed.h"
#include "HIDScope.h"
+#include "arm_math.h"
+#include "MODSERIAL.h"
-#include "arm_math.h"
-
+//MODSERIAL pc(USBTX,USBRX);
AnalogIn emg(PTB1); //Analog input
HIDScope scope(2);
arm_biquad_casd_df1_inst_f32 lowpass_1; //99Hz
arm_biquad_casd_df1_inst_f32 lowpass_2; //3Hz
arm_biquad_casd_df1_inst_f32 highpass; //20Hz
+arm_biquad_casd_df1_inst_f32 notch; //50Hz
float lowpass_1_const[] = {0.978030479206560 , 1.956060958413119 , 0.978030479206560 , -1.955578240315036 , -0.956543676511203};
float lowpass_1_states[4];
float lowpass_2_const[] = {0.002080567135492 , 0.004161134270985 , 0.002080567135492 , 1.866892279711715 , 0.875214548253684};
float lowpass_2_states[4];
float highpass_const[] = {0.638945525159022 , -1.277891050318045 , 0.638945525159022 , 1.142980502539901 , -0.412801598096189};
float highpass_states[4];
+float notch_const[] = {0.978048948305681 , 0.000000000000000 , 0.978048948305681 , 0.000000000000000 , -0.956097896611362};
+float notch_states[4];
void looper()
{
@@ -26,8 +30,10 @@
arm_biquad_cascade_df1_f32(&highpass, &emg_value_f32, &filtered_emg, 1 );
arm_biquad_cascade_df1_f32(&lowpass_1, &filtered_emg, &filtered_emg, 1 );
+ arm_biquad_cascade_df1_f32(¬ch, &filtered_emg, &filtered_emg, 1);
filtered_emg = fabs(filtered_emg);
- //arm_biquad_cascade_df1_f32(&lowpass_2, &filtered_emg, &filtered_emg, 1 );
+ //emg_value_f32 = fabs(emg_value_f32);
+ //arm_biquad_cascade_df1_f32(&lowpass_2, &emg_value_f32, &filtered_emg, 1 );
scope.set(0,emg_value); //uint value
scope.set(1,filtered_emg); //processed float
@@ -40,6 +46,7 @@
arm_biquad_cascade_df1_init_f32(&lowpass_1,1 , lowpass_1_const, lowpass_1_states);
arm_biquad_cascade_df1_init_f32(&highpass,1 , highpass_const, highpass_states);
+ arm_biquad_cascade_df1_init_f32(¬ch,1 , notch_const, notch_states);
//arm_biquad_cascade_df1_init_f32(&lowpass_2,1 , lowpass_2_const, lowpass_2_states);
log_timer.attach(looper, 0.005);
@@ -48,6 +55,8 @@
{
/*Empty!*/
/*Everything is handled by the interrupt routine now!*/
+ //pc.baud(9600);
+ //pc.printf("filtered_emg=%f\n\r",filtered_emg);
}
}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MODSERIAL.lib Tue Oct 28 16:37:27 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/Sissors/code/MODSERIAL/#b04ce87dc424
