Datasheet

Figure 25. C Language Program to Log Data from MAX121 Conversions (continued)
while( !quit )
{
if(kbhit( ))
{
switch ( gletch ( ))
case ‘m’ : /* Clear Max/Min Storage Variables */
max = -32768
min = 32767;
break;
case ‘q’: /* Quit Program */
case 0x1B:
quit = 1;
break;
}
}
for (x=o; x<30000; x++)
{
/* Gather samples as fast as possible and update Max/Min */
/* Only output every 30,000th sample. The 30,000 has no */
/* specific origin other than the display updated at a */
/* comfortable rate. */
value = inpw ( 0x0240+0x0808 ); /* EVM Data Port */
value >>= 2; /* Shift from 16-bit back to 14-bit */
/* Update Max/Min */
If( value > max )
max = value;
else if( value < min)
main = value;
}
/* Output the latest sample in decimal and hex along with Max/Min */
printf(” %06d %04Xh min:%06d \r”, value, value, min, max);
}
/* Exit */
Printf( ‘\n\n” );
return;
}
MAX121 308ksps ADC with DSP Interface and 78dB SINAD
www.maximintegrated.com
Maxim Integrated
22