// freqresp.h #define START_TASK 1 #define STOP_TASK 2 struct my_msg_struct { int command; int resolution; // sample number for one period sinusoidal signal double sampling_period; // sampling period [sec] int recording_samples; // recording number int canceling_samples; // sampling number skipping without recording int spk_num; // D/A pin number for speakers: 0:SPK2; 2:SPK1 float amp; // amplitude of sinosoidal signal [V] }; #define BUF_LEN 4 #define SAMPLING_PERIOD 200e-6 // sampling period [sec] #define LENGTH_MAX 2500 // = maximum total time [sec] / sampling period; (maximum total time is specified firstly as you like) #define PERIOD_MAX 500 // = 1 / minimum test frequency / sampling period; ex. 1 / 10[Hz] / 200e-6 [sec] becomes 500. #define F10_LOW 1. // common logarithm of the lowest test frequency [Hz]; ex. if the lowest frequency is 10 [Hz], then specify 1 here. #define F10_HIGH 3.3 // common logarithm of the highest test frequency [Hz]; ex. if the highest frequency is 2 [kHz], then specify 3.3 here because 10^3.3 is 2000. #define AMP_CH0 0.5 // amplitude of sinusoidal signal for SPK2 (secondary speaker) #define AMP_CH1 2.0 // amplitude of sinusoidal signal for SPK1 (primary speaker) #define F10_STEP 0.01 // varying step for common logarithm of frequency #define LOOP 1 // cycles of execution from the lowest frequency to the highest frequency #define WAITING_TIME 0.2 // waiting time in which sampling data is not recorded // #define DEBUG // if defined, the lowest frequency is only tested and the time response is printed to standard out.