AMETEK SLM Series Rev B User Manual
Page 80

SLM-Series AC/DC Electronic Load
Appendix B
B-4
M540072-01 Rev B
queue[0] = '\0';
if (timeout == 1)
{
return(TIME_OUT);
}
return(SUCCESS);
}
int read_buf()
{
char ch,ch1;
int temp_index;
unsigned long ticks;
float sec1,sec2;
rd_result = 0;
ticks = biostime(0,0);
sec1 = ticks/18.2;
do
{
ticks = biostime(0,0);
sec2 = ticks/18.2;
if((sec2 - sec1) >= 20.0)
/* delay about 1 Sec */
{
timeout = 1;
}
ch = inportb(ACE_INT_IDENT_REG);
ch &= 0x06;
switch(ch)
{
case 6:
inportb(ACE_DATA_REG);
/* read the data register to empty it */
break;
case 0:
break;
case 2:
break;
case 4:
/* read character from data register */
ch1 = inportb(ACE_DATA_REG);
temp_index = input_index + 1;
/* increment index of input buffer*/
if (ch1 != '\n')
/* check terminate bit */
{
queue[input_index] = ch1;
/* store character to input buffer*/
input_index = temp_index;
}
else
{
queue[input_index] = ch1;
input_index = temp_index;
input_index = 0;
/* if terminate bit was detected */
temp_index = 0;
rd_result = 1;
/* clear index and set return value */
}