Keil™, An ARM® Company

µVision® User's Guide

Noise Signal

The following Signal Function template may be used to noise signal pattern. The input signal is provided to the VTREG ADC0. The variables volts, frequency, offset, and duration allow to adjust the noise signal.

//
// Generate Noise Signal on AD Channel 0
//
signal void ADC0_Noise (void)  {
  float volts;        // peak-to-peak volatage
  float frequency;    // output frequency in Hz
  float offset;       // volatge offset
  float duration;     // duration in Seconds
  float val;
  long  i, end;

  volts     = 1.4;
  offset    = 1.6;
  duration  = 0.1;

  printf ("Sine Wave Signal on AD Channel 0.\n");

  end = (duration * 100000);
  for (i = 0 ; i < end; i++)  {
    val =  ((float) rand (0)) / 32767.0;
    ADC0 = (val * volts) + offset;
    swatch (0.00001);                // in 10 uSec steps
  }
}

The above setting generates the following signal on the ADC0 input.

Noise Input Signal Displayed on Logic Analyzer Window