ZBasic System Library
the pin is toggled in software by directly setting the corresponding PORTx bit. During periods of high
interrupt load the hardware toggling will be more accurate.
Some ZBasic target devices support ability to use the output capture waveform to modulate a carrier
waveform produced by the Serial Timer; such devices are listed in the table below and also in the
Resource Usage sub-section Output Capture Timers where a second output capture pin for Timer1 is
Output Capture Modulation Carrier Timer and Output Pin
mega640, mega1280, mega2560
mega64, mega64A, mega128, mega128A
mega1281, mega2561, AT90CAN32, AT90CAN64, AT90CAN128,
AT90USB646, AT90USB647, AT90USB1286, AT90USB1287
To implement Output Capture modulation, the Serial Timer must be set up to generate the desired carrier
frequency and duty cycle prior to calling OutputCaptureEx. Note, however, that the actual output from the
serial timer should not be enabled this will be done automatically when OutputCaptureEx is called.
Further, the TimerBusy flag for the Serial Timer must be set to indicate that it is active. Finally, when
calling OutputCaptureEx, the value &H02 should be added to the flags parameter to request output
See the Resource Usage sub-section Output Capture Timers for information about the timers, output pins
and (for native mode devices) the ISRs that will be included in the application. If the timer is already in
use the routine will return immediately without performing the waveform generation. Note that when
performing an output capture on a general I/O pin, any available 16-bit timer may be used to generate the
This routine is not available in BasicX compatibility mode.