179 of 318
ZBasic System Library 169 ZX Microcontroller Family The analog value output by the DAC will be approximately equal to the 12-bit digital value set for each channel (see the DAC() subroutine) divided by 4095 and multiplied by the reference voltage. The choice of four reference voltages available is made by the least significant two bits of the mode parameter value. For the PortA and PortB Aref Reference, the table below indicates the pin to which the desired reference voltage should be applied. DAC Reference Voltage Pin ZX Device Aref A Aref B ZX-24x 20, A.0 7, B.0 ZX-32a4 40, A.0 4. B.0 ZX-128a1 95, A.0 5, B.0 The status parameter, if supplied, receives a value to indicate success or failure of the call. Example Call OpenDAC(1, &H01) ' prepare for DAC output using AVcc reference Call DAC(1, 300) ' set the DAC level to 300/4095*AVcc Compatibility This subroutine is not available in BasicX compatibility mode nor is it available on ATmega-based ZX devices. See Also CloseDAC, DAC