Code: Select all
#include <techlib.h>
#define TEMPLATES 5
#define TIMEOUT 2
void main()
{
typedef struct {
uchar pp_a;
uchar pp_b;
uchar pp_r0;
uchar pp_r1;
uchar pp_r2;
uchar pp_r3;
uchar pp_r4;
uchar pp_r5;
}PARAMETERPASS;
PARAMETERPASS results;
uchar index=1;
uchar error;
uchar error1;
_Init232();
_SetBaudRate(BAUD9600);
_InitCollection();
_PutTmpltListBase(TEMPLATES);
_Send232D8(_GetTmpltListBase());
_Send232D8(01);
while(1)
{
_SysBeep(200);
error = _MakeTmpltSd(TIMEOUT,2,1);
_Send232D8(error);
if(error==0x00)
{
p0out = 0b00000011;
_PutTmplt(index);
_Send232D8(02);
break;
}
}
index++;
while(1)
{
_SysBeep(50);
error1 = _MakeTmpltSd(TIMEOUT,2,1);
if(error1==ERR_OK)
{
p0out = 0b00000001;
_PutTmplt(index);
_Send232D8(03);
break;
}
}
_Send232D8(04);
_Crlf232(); // Echo Carriage Return/Line Feed
_Idle232(); // Turn off RS232
_SleepIO(0,0,0); // Low power sleep
}
thank you very much.