C Program Generates Gated Sine Waves Digitally

June 22, 1998
The C program presented will generate gated-digital sine waves at a 10-Hz frequency (see the listing). Three parameters are user-defined at the head of the program—the output frequency (FO), the sampling rate...

The C program presented will generate gated-digital sine waves at a 10-Hz frequency (see the listing). Three parameters are user-defined at the head of the program—the output frequency (FO), the sampling rate (FS), and the number of samples to be saved to disk file “xxx”.

The sine function is synthesized by an undamped-biquad IIR digital filter. The sine waves are initiated by an impulse signal of a sampling period width (1/FS), whose impulse amplitude equals the sine-wave amplitude response of the filter (see the figure).

The sineOn( ) and sineOff( ) macros control the initiation of the gated sine waves. These are implemented as inline code in the for( ) loop in the program. A multitude of non-overlapping gated sine waves can be generated. Two such sine waves are shown in the figure. A multiple of sine frequencies (FO) can be generated with a suitable data structure.

Sponsored Recommendations

Near- and Far-Field Measurements

April 16, 2024
In this comprehensive application note, we delve into the methods of measuring the transmission (or reception) pattern, a key determinant of antenna gain, using a vector network...

DigiKey Factory Tomorrow Season 3: Sustainable Manufacturing

April 16, 2024
Industry 4.0 is helping manufacturers develop and integrate technologies such as AI, edge computing and connectivity for the factories of tomorrow. Learn more at DigiKey today...

Connectivity – The Backbone of Sustainable Automation

April 16, 2024
Advanced interfaces for signals, data, and electrical power are essential. They help save resources and costs when networking production equipment.

Empowered by Cutting-Edge Automation Technology: The Sustainable Journey

April 16, 2024
Advanced automation is key to efficient production and is a powerful tool for optimizing infrastructure and processes in terms of sustainability.

Comments

To join the conversation, and become an exclusive member of Electronic Design, create an account today!