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

What are the Important Considerations when Assessing Cobot Safety?

April 16, 2024
A review of the requirements of ISO/TS 15066 and how they fit in with ISO 10218-1 and 10218-2 a consideration the complexities of collaboration.

Wire & Cable Cutting Digi-Spool® Service

April 16, 2024
Explore DigiKey’s Digi-Spool® professional cutting service for efficient and precise wire and cable management. Custom-cut to your exact specifications for a variety of cable ...

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.

Comments

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