|
|||||||||||
Technical Support On-Line Manuals µVision User's Guide ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Saw Tooth SignalThe following signal function generates a saw tooth signal. The input signal is provided to the VTREG AIN1. The variables volts, frequency, offset, and duration are used to adjust the signal. /*---------------------------------------------------*/ /* Generate Sawtooth Signal on AD Channel 1 */ /*---------------------------------------------------*/ // SIGNAL void AIN1_Saw (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, steps; volts = 2.0; offset = 0.2; frequency = 1400; duration = 0.2; printf ("Sawtooth Signal on AD Channel 1.\n"); steps = (100000 * (1/frequency)); end = (duration * 100000); for (i = 0 ; i < end; i++) { val = (i % steps) / ((float) steps); AIN1 = (val * volts) + offset; swatch (0.00001); // in 10 uSec increments } } DEFINE BUTTON "AIN1 Saw","AIN1_Saw()" Start debugging in simulation mode and drag the port into the Logic Analyzer. Open the Toolbox and click the button AIN1 Saw to view the signal output:
| ||||||||||
|
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.