
clrscr();
}
/* This function polls the AD chip awaiting the completion of the conversion
in progress.
*/
void wait_complete()
{
int stat;
while(1)
{
stat = inportb(AD_BASE); /* Read status */
if((stat & 0x03) == 3)
break;
if(kbhit()) /* We allow a keystroke to also get us out */
break;
}
}
/* This is the interrupt service routine. It reads the current channel,
compares it against maximum deviation values and stores the results
in the arrays for display by the foreground routine.
*/
void interrupt ad_isr()
{
int temp;
unsigned char lsb,msb;
unsigned current;
++interrupt_count;
temp = channel_number;
lsb = inportb(1);
msb = inportb(2);
++channel_number;
if(channel_number > (max_channel-1))
channel_number = 0;
outportb(1,channel_number);
/* start next channel converting
*/
current = (msb << 8) | lsb;
current_val[temp] = current;
/* Store the current reading */
if(!flag[temp])
{
high_val[temp] = current;
low_val[temp] = current;
flag[temp]++;
}
if(mode & 1)
/* If a signed mode, do the comparisons correctly */
{
if((current ^ 0x8000) < (low_val[temp] ^ 0x8000))
low_val[temp] = current;
Содержание PCM-A/D-12
Страница 22: ...4 APPENDIX A PCM A D Parts Placement Guide...
Страница 23: ...5 APPENDIX B PCM A D Parts List...
Страница 26: ...6 APPENDIX C BURR BROWN ADS7806 ADS7807 Datasheet Reprint...
Страница 64: ...7 APPENDIX D PCM A D Demo Software Source Listing...
Страница 73: ...8 APPENDIX E PCM A D Schematic Diagrams...