Analog output

Updated: April 19, 2023

For analog output, the function pcl711_write_analog() is used:

void
pcl711_write_analog (pcl711_t *pcl, int value)
{
  out8 (pcl -> port + PCL711_ANALOG_LOW, value & 0xff);
  out8 (pcl -> port + PCL711_ANALOG_HIGH, (value & 0xf00) >> 8);
}

This function simply writes the low byte of the value to the register PCL711_ANALOG_LOW and then writes the high byte (actually, bits 8 through 11) of the value to PCL711_ANALOG_HIGH.

Note: Order is important here! The PCL-711 is an 8-bit ISA card, which means that the I/O ports are only eight bits, so they must be written individually. The D/A conversion is triggered after the HIGH portion of the value is written, so if we wrote the data in the opposite order, we'd be triggering a conversion with the correct HIGH value, but the previous LOW value.

Just something to watch out for.