81 of 307
ZBasic System Library 71 ZX Microcontroller Family DefineBus Type Subroutine Invocation DefineBus(port, alePin, rdPin, wrPin) Parameter Method Type Description port ByVal integral The port to use for address and data. PortA=0, PortB=1, etc. alePin ByVal integral The pin to use for the address latch strobe. rdPin ByVal integral The pin to use for the read data strobe. wrPin ByVal integral The pin to use for the write data strobe. Discussion This subroutine is used to define the parameters to use for subsequent BusRead() and BusWrite() operations. The port specified by the port parameter is used both for outputting the address from which to read/write and for reading/writing the data. The port is specified by giving a port index – PortA = 0, PortB = 1, etc. You may use the built-in constants Port.A, Port.B, etc. to specify the port index. If all the parameters are valid, the pin specified by the alePin parameter is set to output low while the pins specified by the rdPin and wrPin parameters are set to output high. If any of the provided parameters is invalid, the bus will not be properly configured and subsequent calls to BusRead() or BusWrite() will return immediately with no effect. The pin numbers specified for the alePin, rdPin and wrPin parameters must all be different and none of them should be in the port specified by the port parameter. If these conditions are violated, the result is undefined. Example Call DefineBus(Port.A, C.0, C.1, C.2) Compatibility This subroutine is not available on ZX models that are based on the ATmega32 processor (e.g. the ZX- 24). Moreover, it is not available in BasicX compatibility mode. See Also BusRead, BusWrite