PWM freq, ch1, ch2
Generate a pulse width modulated (PWM) output for driving analogue circuits.
‘freq’ is the output frequency (between 20 Hz and 1 MHz) . The frequency can be changed at any time by issuing a new PWM command.
The output will run continuously in the background while the program is running and can be stopped using the PWM STOP command.
‘ch1’ and ‘ch2’ are the output duty cycles for channel 1 and 2 as a percentage. If the percentage is close to zero the output will be a narrow positive pulse, if 50 a square wave will be generated and if close to 100 it will be a very wide positive pulse. Both are optional and if not specified will default to the previously used duty cycle for that channel.
The PWM output is generated on the PWM/sound connector and that assumes that the connector has been wired for PWM output. The frequency of the output is locked to the PIC32 crystal and is very accurate and for frequencies below 100 KHz the duty cycle will be accurate to 0.1%.
The original monochrome Maximite has only one PWM/sound output so only ‘ch1’ can be set on that model.
Stop PWM output.