beautypg.com

AMETEK SLM-4 User Manual

Page 64

background image

Appendix B

Sorensen SLM-4 Chassis

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 */

}

B-4

M540069-01 Rev B