beautypg.com

KEPCO BIT 232F User Manual

Page 62

background image

E-2

BIT 232 022800

/********************************************************************

* RS232 command loop program for BIT232

* use ROM BIOS INT 14 function calls

********************************************************************/

#include

#include

#include

#define TRUE 1

#define FALSE 0

#define PORT 2 /* serial port */

/* function prototypes */

void open_port(int n);

void put_serc(int n, int c);

int get_serc(int n);

int in_ready(int n);

int SendWecho(int n,int c);

void SendCommand(char *send_cmmd);

void SendCmmdWready(char *send_cmmd);

void main(void)

{

char string[80], stringm[80], wstr[80];

char volt[4], *curr = “;curr 0.5”;

char *test = “*tst?”;

char *reset = “*rst”;

char *msvolt = “meas:volt?;curr?”;

char *sterror = “syst:err?”;

char *id = “*idn?”;

int j,k,c,vl;

int on_line;

double max;

clrscr();

printf(“ ** BIT232 Command Loop Program - Press ALT + Q to exit \n”);

/* open the serial port */

open_port(PORT);

/* get power supply id */

strcpy(string, id);

SendCommand(string);

on_line = FALSE;

for (k=0; k < 10000; k++)

{

if (in_ready(PORT)) {

/* get character from serial port*/

c = get_serc(PORT);

/* display it if one was available */

if (c != EOF)

{

putch(c);

on_line = TRUE;

}

}

}

if (on_line == FALSE)

exit(0);

/* change the first \r in end of string */

for (j = 0; j < strlen(string); j++)

This manual is related to the following products: