3.3.12
D/A Data Output
(write):wBase+0xf0
Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
D7 D6 D5 D4 D3 D2 D1 D0
(write):wBase+0xf4
Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
A1 A0 D13 D12 D11 D10 D9 D8
Note: Refer to Sec.3.3.10 For more information regarding A1 and A2
Each D/A converter have four analog output channels. When writing data to the
D/A converter, the
relevant
channel to be used is indicated by A1 and A0.
D/A programming sequence:
1. Send data to the D/A converter. (This data will be buffered)
2. Select the D/A converter. (Start the conversion)
outportb(wBase+0xf0,wDaValue);
/* output low byte of D/A data */
outportb(wBase+0xf4,(wDaValue>>8)|0x02);
/* output high byte of D/A data and */
/* select channel 2 on this converter */
outportb(wBase+0xe0,0);
/* select DA_0 */
/* after this procedure wDaValue will */
/* be sent to channel_2 */
pio_da16_da(2,wDaValue);
/* send wDaValue to channel_2 */
void pio_da16_da(char cChannel_no,int iVal)
{
iVal=iVal+(cChannel_no%4)*0x4000;
/* cChannel_no: 0 - 15 */
outportb(wBase+0xf0,iVal);
/* iVal: 0x0000 - 0x3fff */
outportb(wBase+0xf4,(iVal>>8));
outportb(wBase+0xe0+4*(cChannel_no/4),0xff);
}
Refer to the DEMO6.C, DEMO7.C, DEMO8.C and DEMO9.C files
for more information.
PIO-DA/PISO-DA Series User Manual (Ver.2.9, Feb. 2011, PMH-009-29 )
54