コード例 #1
0
//! The main function
int main(int argc, char *argv[])
{
	int i;
	char iir_vect_result[SIZE][15];

	/**
	 * \note the call to sysclk_init() will disable all non-vital
	 * peripheral clocks, except for the peripheral clocks explicitly
	 * enabled in conf_clock.h.
	 */
	sysclk_init();

	// Initialize the DSP debug USART module when running in external board
#if BOARD != AVR_SIMULATOR_UC3
	dsp_debug_initialization(FOSC0);
#endif

	// Number of recursions - Reduced to 5 decrease the time in Simulator
	for (i = 0; i < 5; i++) {
		// Perform a IIR filter
		dsp32_filt_iir(&y[DEN_SIZE], &x[NUM_SIZE - 1], SIZE, num, NUM_SIZE,
				den, DEN_SIZE, NUM_PREDIV, DEN_PREDIV);
		// Update the output signal
		memmove(y, &y[SIZE], (DEN_SIZE)*sizeof(dsp32_t));
	}
	// Print the  output signal
	for (i = 0; i < SIZE; i++) {
		dsp32_debug_sprintf(iir_vect_result[i],"%f", y[i]);
	}
	/*
	 * Place a breakpoint here and check the ASCII output in iir_vect_result
	 * in Memory Window.
	 * Note: Find the variable address in Watch Window and enter it in
	 * Memory Window
	 */

	while (1) {
		// Intentionally left blank.
	}
}
コード例 #2
0
ファイル: iir_example.c プロジェクト: InSoonPark/asf
//! The main function
int main(int argc, char *argv[])
{
  int i;

  // Switch to external Oscillator 0.
  pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP);

  // Initialize the DSP debug module
  dsp_debug_initialization(FOSC0);

  // Number of recursions
  for(i=0; i<100000; i++)
  {
    // Perform a IIR filter
    dsp32_filt_iir(&y[DEN_SIZE], &x[NUM_SIZE-1], SIZE, num, NUM_SIZE, den, DEN_SIZE, NUM_PREDIV, DEN_PREDIV);
    // Update the output signal
    memmove(y, &y[SIZE], (DEN_SIZE)*sizeof(dsp32_t));

  }
  // Print the  output signal
  dsp32_debug_print_vect(&y[DEN_SIZE], SIZE);

  while(1);
}