/* These four arrays, store the low, high, and current values for each
of the 16 channels. There are more elegant ways to code this but this
is the ultimate in simplicity.
*/
unsigned current_val[16];
unsigned high_val[16];
unsigned low_val[16];
char flag[16];
/* Various global variables used to keep track of the current channel
and the floating point values used in calculating voltages.
*/
unsigned channel_number;
float full_scale = 5.00;
float offset_val = 0.00;
unsigned full_count = 65520;
int max_channel = 16;
int interrupt_mode = 1;
long interrupt_count = 0;
int mode = 0;
/* Program entry point */
void main()
{
unsigned char lsb,msb;
char c;
unsigned low,high,current;
int channel;
channel_number = 0;
/* To start we, will install our interrupt handler, saving the old handler
for when we exit.
*/
disable();
old_isr = getvect(IRQ_VECTOR);
setvect(IRQ_VECTOR,ad_isr);
enable();
/* This is the restart point whenever we change modes. I usually go to
extreme efforts to avoid using "goto" in C, but in this case it is
only used for a special occasion and it's not to hard to follow
*/
restart:
/* Clear the screen and display the the headers */
clrscr();
/* Clear the screen */
window(1,1,80,25 );
printf("Channel RAW HIGH LOW DATA CURRENT MAX MIN
VOLTAGE \n");
printf("Number DATA DATA DATA DEV. VOLTAGE VOLTAGE VOLTAGE
DEVIATION\n");
printf
("-----------------------------------------------------------------------------