59 of 307
ZBasic System Library 49 ZX Microcontroller Family Com1toDAC Type Subroutine Invocation Com1toDAC(pin) Parameter Method Type Description pin ByVal Byte The pin number on which the analog voltage will be re-created. Discussion Calling this subroutine prepares Com1 to receive a continuous stream of 8-bit values from an external source. The baud rate is automatically set 115,200. When each value is received, the value is output as an analog voltage on the specified pin. The resulting analog voltage will range from near 0 volts corresponding to the received value of 0 to near the processor voltage (usually +5 volts) corresponding to the received value of 255. The method used to create the analog voltage is similar to that used for PutDAC() and the signal will require some filtering. See the description of PutDAC() for more details. The output pin is updated at a fixed rate of 11,000 times per second. This routine returns immediately after setting up the conversion process. The conversion process will be terminated if Com1toDAC() is called again with a parameter of zero. Also, if data is not received for approximately 200 cycles, the conversion process will be automatically terminated. Note that the subroutine ADCtoCom1() is designed to produce the data stream to be received by this subroutine. Resource Usage This subroutine uses Com1 and the I/O Timer. No other use of these resources should be attempted while the reception is active. For native code devices, the following ISRs are automatically loaded. ISRs Required Underlying CPU ISR Name mega644P, mega328P, mega128 Timer1_CompA mega1281 Timer4_CompA mega1280 Timer4_CompA See Also ADCtoCom1