|
|||||||||||
Technical Support On-Line Manuals µVision User's Guide About µVision User Interface Creating Applications Utilities Debugging Debug Commands Debug Functions Simulation Digital Input Push Button Interrupt Signal Impulse Patterns Analog Input Square Wave Signal Saw Tooth Signal Sine Wave Noise Signal Signal Combination UART Communication CAN Communication Dialog Pages Virtual Simulation Registers (VTREG) Simulate Incoming Messages Process Outgoing Messages Send Periodic Messages I²C Communication I²C Concepts I²C Simulation Virtual Simulation Registers (VTREG) Simulating an I²C Device Application Examples SPI Simulation XPAGE VTREG PPAGE VTREG Flash Programming Dialogs Example Programs Command Line Appendix |
Signal CombinationSignal functions or signal inputs can be combined easily. The following signal function shows how to invoke several signals so that they are processed at the same time. Redirect the previous functions to the VTREG AIN0. /*---------------------------------------------------------------------- Combine signals. Output is sent to AD Channel 0 ----------------------------------------------------------------------*/ SIGNAL void Combine_Signals (void) { swatch (0.1); // wait 0.1 seconds AIN0_Square (); swatch (0.006); // wait 0.06 seconds AIN1_Saw (); swatch (0.003); // wait 0.03 seconds AIN2_Sine (); swatch (0.0001); } DEFINE BUTTON "AutoComb", "Combine_Signals()" Start debugging in simulation mode and drag the port into the Logic Analyzer. Open the Toolbox and click the button AutoComb to view the signal output:
It is even possible to mix two sine wave signals: /*---------------------------------------------------------------------- Generate a Sine Wave Input ----------------------------------------------------------------------*/ SIGNAL void Mix_Sine (float freq1, float freq2) { float sig1; float sig2; int z; z = 0; while (z < 10000) { // generate 100 mSec sine wave pulse // Generate 1. Sine Wave input signal sig1 = __sin (((states * freq1) / CLOCK) * 3.1415926 * 2); // Generate 2. Sine Wave input signal sig2 = __sin (((states * freq2) / CLOCK) * 3.1415926 * 2); // Input: 1. Sine Wave with 0.5V, 2. Sine Wave with 0.2V, offset 2.5V AIN0 = (sig1 * 0.5) + (sig2 * 0.2) + 2.5; swatch (0.00001); z++; } } DEFINE BUTTON "Mix Sine", "Mix_Sine(300,2000)" The signal function combines two signals and adds an offset of 2.5V. The first signal has a frequency of 300Hz and an amplitude of 0.5V; the second signal has a frequency of 2000Hz and an amplitude of 0.2V.
| ||||||||||
|
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.