Keil Logo

Noise Signal

The following signal function generates a noise signal pattern. The input signal is provided to the VTREG AIN3. The variables volts, frequency, offset, and duration are used to adjust the signal.

  Generate Noise Signal on AD Channel 3
SIGNAL void AIN3_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, limited;

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

  printf ("Noise Signal on AD Channel 3.\n");

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

DEFINE BUTTON "AIN3 Noise","AIN3_Noise()"

Start debugging in simulation mode and drag the port into the Logic Analyzer. Open the Toolbox and click the button AIN3 Noise to view the signal output:

Noise Input Signal Displayed on Logic Analyzer Window

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.