====== freqOut ======
''void freqOut (u8 pwmChannel, u32 freqVal)''
|pwmChannel : PWM channel |
|freqValue: Approximate frequency |
Creates a pulse on PWM channel pwmChannel of frequency freqValue.
freqOut can only be used on one channel in a group at a time. The High-Speed Counter Module has 2 PWM
groups, so 2 waveforms with different frequencies can be created.
{{ :moacon:freqout:pwmout.png?nolink |}}
FreqOut (0, 440); // Creates a waveform of approximately 440Hz
// on PWM channel 0. pwm functions cannot be
// used on channels 1, 2, or 3.
FreqOut (5, 30000); // Creates a waveform of approximately 30kHz.
// pwm functions cannot be used on channels 4,6, or 7.
freqOut is just a specialized form of the pwm function, so to turn off the pulse, use the pwmOff function.
freqOut(0,435); // Create a 435Hz pulse on PWM channel 0
delay(1000); // Run the pulse for 1 second
pwmoff(0); // Turn off the pulse
[[MOACON:index#System_Library:|go MOACON home]]