The last post is a good representation of how it works. the analog output is just the reverse.
It depends on the PLC on how the value is received or sent to/from the PLC (code-wise). for example, Siemens use Peripheral words (PW) so the card converts it into a value i.e. 0-2048 and then in your code you load the PW and scale it to what you want. Mitsubishi uses FROM/TO instructions to retrieve the raw data and store it in a memory word, from there you can scale it as required. Many PLC platforms have either functions to retrieve & scale the data or the card can be configured via the programming utility to process the data into meaningful values. You really need to read the datasheet on each particular platform to understand the ways to read/send values from/to cards.