beautypg.com

AMETEK SLD Series User Manual

Page 87

background image

Sorensen SLD-Series DC Load

Appendix B

M540075-01 Rev C

B-9

C Example Program


/* Link this program with pd_rs232.obj */

#include
#include
#include
#include

main()
{
int com;
int io_err= 0;
char rdbuf[1024];
clrscr();
printf("Input COM1/COM2 port is : ");
scanf("%d", &com);
if((io_err = pd_init(com)) == 0)

/* Initial RS-232 interface */

{
setstr(rdbuf,'');
pd_wrt("chan

1",6);

delay(200);
pd_wrt("name?",5);

if ((io_err = pd_rd(a,10)) == 0)

{

do

{

/* Set the channel 1, preset off, current sink 1.0 amps and load on commands to the load. */
pd_wrt("chan

1",6);

delay(200);
pd_wrt("pres

off",8);

delay(200);
pd_wrt("curr:low

0.0",12);

delay(200);

pd_wrt("curr high 1.0",13;

delay(200);
pd_wrt("load

on",7);

delay(200);
pd_wrt("meas:curr

?",11);

/* Get the load actially sink current from the load */
delay(200);
pd_rd(rdbuf,20);

io_err = 1;

}while (io_err == 0);

}
else