beautypg.com

AMETEK SLM Series Rev B User Manual

Page 78

background image

SLM-Series AC/DC Electronic Load

Appendix B

B-2

M540072-01 Rev B

#define PE 4

/* parity error */

#define FE 8

/* frame error */

#define BI 0x10

/* break interrupt */

#define THRE 0x20 /* transmit holding reg. empty */

/* SLM series elec. load command sets */
int pd_wrt(char *wrtbuf,int count)
{
static char *combuf[COMPTR] = {"CHAN", "CURR:HIGH", "CURR:LOW",
"RES:HIGH", "RES:LOW", "VOLT:HIGH",
"VOLT:LOW", "PERD:HIGH", "PERD:LOW",
"FALL", "RISE", "GLOB:LOAD",
"GLOB:LEV", "GLOB:PRES", "GLOB:SHOR",
"GLOB:DYN", "GLOB:RANG", "GLOB:MODE",
"CLER", "CHAN?", "MEAS:VOLT?",
"MEAS:CURR?","CURR:HIGH?", "CURR:LOW?",
"ERR?", "RES:HIGH?", "RES:LOW?",
"VOLT:HIGH?","VOLT:LOW?", "NAME?",
"PERD:HIGH?","PERD:LOW?", "FALL?",
"RISE?", "LOAD?", "LEV?",
"PRES?", "SHOR?", "DYN?",
"RANG?", "MODE?", "PROT?",
"REMOTE", "LOCAL" };
int cnt,result,t;
int comerr,err;
char ch;
char tempbuf[QUELEN];
char intbuf[QUELEN];
/* for (cnt = 0;cnt < 1024;cnt++)
{

intbuf[cnt] = '';

tempbuf[cnt]='';
} */
strset(intbuf,'');
strset(tempbuf,'');
for (cnt = 0;cnt < count+1;cnt++,wrtbuf++)
{
intbuf[cnt] = *wrtbuf;
}
cnt = cnt--;
intbuf[cnt] = '\r';
cnt = cnt++;
count = count++;
intbuf[cnt] = '\n';
t = strcspn(intbuf," ");
if (t >count)
t = count-1;
for (cnt = 0;cnt < t;cnt++)
{
tempbuf[cnt] = intbuf[cnt];
}