Go to Triangle Digital Support Home Page TDS2020F TECHNICAL MANUAL
Hardware support
Digital to analog
Live website search
Enter key words




( n channel - )

Put digital value n (0-250) to channel (0-2)


At power-up bits 2 3 & 4 of Port 9 are configured as general-purpose I/O ports. To use them as 3 channels of 8-bit D to A call the word D-A provided. This sets up the necessary registers to make these bits into D to A outputs and starts the Pulse Width Modulated output at 19.6608kHz.

For example 40 2 D-A will produce a repetitive asymmetrical wave at this frequency with a mark:space ratio of 40:210 (ratio of time at +5V to time at 0V). An external filter is added to get the analog level, in the example the analog output would be 5.00 x 40/250 = 0.80V.

D to A output buffer & filter suggestion

D to A output buffer & filter suggestion
Click the diagram for more detail, or to save a copy:
1. in Internet Explorer right click on the picture and select "Save Target as..."
2. in Netscape double-click the picture to open the file, then under "File" select the "Save As" option.

The filter can be as simple as an RC network (10k and 10 recommended) or the filtering may form part of subsequent signal conditioning (the output impedance of the pins is typically 140 ohms). The circuit shows a typical second order filter that gives a response time of about 2ms to step inputs.

The word D-A takes a channel number 0 to 2 to be in line with Forth (where all counts start from 0) but for consistency with Hitachi documentation the pin names are PW1 to PW3. In the example the PWM output will appear on pin PW3 since channel 2 was selected.

By accessing internal registers of the PWM system the frequency can be changed to any of the following, see the Hardware Manual Section 12 for details:


19.6608kHz (default)









Apart from its D to A use, these outputs can be useful as a source of real-time clock waveforms.

Go to Triangle Digital Support Home Page Go to top   Next page