![]() ZBasic System Library
215
ZBasic Microcontrollers
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
shown.
Output Capture Modulation Carrier Timer and Output Pin
Target Device
Serial Timer
Compare Output
Output
Pin
ZX-1281, ZX-1281n
OC0A
17, B.7
ZX-1280, ZX-1280n
OC0A
26, B.7
ZX-128e, ZX-128ne
OC2
21, B.7
ZX-1281e, ZX-1281ne
OC0A
21, B.7
mega640, mega1280, mega2560
OC0A
26, B.7
mega64, mega64A, mega128, mega128A
OC2
17, B.7
mega1281, mega2561, AT90CAN32, AT90CAN64, AT90CAN128,
AT90USB646, AT90USB647, AT90USB1286, AT90USB1287
OC0A
17, B.7
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
capture modulation.
Resource Usage
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
required timing.
Compatibility
This routine is not available in BasicX compatibility mode.
|