142 of 307
ZBasic System Library 132 ZX Microcontroller Family InputCapture Type Subroutine Invocation InputCapture(data, count, flags) InputCapture(data, count, flags, timeout) Parameter Method Type Description data ByRef array of UnsignedInteger The array in which pulse width information will be stored. count ByVal int16 The number of pulse widths to store. This should be no larger than the number of entries in the passed array. flags ByVal Byte A value of zero requests that a falling edge begin the capture process while a value of 1 indicates a rising edge. All other values are reserved. timeout ByVal Integral If non-zero, this parameter specifies a timeout value that, if exceeded, will terminate the input capture process. Discussion Invoking this routine is equivalent to the call InputCaptureEx(pin, data, count, flags) or InputCaptureEx(pin, data, count, flags, timeout) where pin is the default input capture pin for the device as shown in the table below. See the description of InputCaptureEx() for more detailed information. Default Input Capture Pin ZX Models Pin ZX-24, ZX-24a, ZX-24p, ZX-24n 12, D.6 ZX-40, ZX-40a, ZX-40p, ZX-40n 20, D.6 ZX-44, ZX-44a, ZX-44p, ZX-44n 15, D.6 ZX-24e, ZX-24ae, ZX-24pe, ZX-24ne 14, D.6 ZX-328n, ZX-328l 14, B.0 ZX-32n, ZX-32l 12, B.0 ZX-1281, ZX-1281n 29, D.4 ZX-1280, ZX-1280n 47, D.4 ZX-128e, ZX-128ne, ZX-1281e, ZX-1281ne 8, D.4 ZX-328nu 11, B.0 Example Dim pd(1 to 5) as UnsignedInteger Call PutPin(12, zxInputTriState) Call InputCapture(pd, UBound(pd), 1) Compatibility The BasicX compiler erroneously allows any variable for the first parameter. This implementation requires the data type to be UnsignedInteger or Integer although it needn’t be an array. For practical purposes, an array will almost always be used. In BasicX compatibility mode, the use of the optional fourth parameter is not supported. Also, because the processor runs at twice the speed of the BX-24 processor, the default time unit is one half of that provided for by BasicX. See the description of InputCaptureEx() for a discussion of which ISRs are required.