5.9 DEMO9
/* ----------------------------------------------------------------- */
/* DEMO9 : D/A Output with calibration */
/* step1 : Run DEMO9.EXE under DOS */
/* ---------------------------------------------------------------- */
#include "PIO.H"
void pio_da16_da(int cChannel_no,int iVal);
WORD wBase,wIrq;
WORD wN10V[16],wP10V[16],w00mA[16],w20mA[16],EEP;
float fDeltaV[16],fDeltaI[16];
int main()
{
int i,j,k;
WORD wBoards,wRetVal,t1,t2,t3,t4,t5,t6;
WORD wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice;
clrscr();
/* Step 1: find address-mapping of PIO/PISO cards */
.
.
/* Step 2: enable all D/I/O port */
outportb(wBase,0x11);
/* /RESET -> 1 */
outportb(wBase+2,0x1c);
/* AUX 4/3/2 are D/O, othes D/I */
outportb(wBase+3,0);
/* all D/O are Low */
printf("\n\n(2) A/D Output with calibration test");
for (i=0; i<64;i++)
{
if (i<16)
{
EEP_READ(i,&j,&k);
wN10V[i]=(j<<8)+k;
}
if ((i>=16)&&(i<32))
{
EEP_READ(i,&j,&k);
wP10V[i-16]=(j<<8)+k;
}
if ((i>=32)&&(i<48))
{
EEP_READ(i,&j,&k);
w00mA[i-32]=(j<<8)+k;
}
if (i>=48)
{
EEP_READ(i,&j,&k);
w20mA[i-48]=(j<<8)+k;
}
}
for (i=0; i<16; i++)
{
fDeltaV[i]=20.0/(wP10V[i]-wN10V[i]);
fDeltaI[i]=20.0/(w20mA[i]-w00mA[i]);
}
PIO-DA/PISO-DA Series User Manual (Ver.2.9, Feb. 2011, PMH-009-29 )
69