REMOTE PROGRAMMING
4-19
printf ("bin01234567QDR Fail\n");
printf (" ");
for (i=0; i<10; i++) printf("%d ", bin[i]);
printf("\n");
}
}
/* ************************************************************************ */
void InitGpib (void) /* initialize the CEC GPIB card as controller */
{
int my_address, system_controller,seg;
/* Find the CEC card address */
for (seg=0x4000;seg<0xF000;seg+=0x400)
{ if ((peek(seg,50) == 'C') && (peek(seg,51) == 'E') && (peek(seg,52) == 'C'))break; }
if (pc488_seg(seg))
{ printf("No Gpib Card found.\n"); exit(0); }
my_address = 21;
system_controller = 0;
initialize (&system_controller, &my_address); /* init controller (CEC) function */
transmit (&status, "IFC UNT UNL DCL REN"); /* device clear and remote enable */
}
/* ********************************************************************* */
void TxGpib (int address, char *command) /* transmit command to address */
{
char t_string[100];
int result;
result = sprintf (t_string, "UNT UNL MTA LISTEN %d DATA '%s' 10", address, command);
transmit (&status, t_string); /* can also use the send () function in the CEC
library */
}
/* ********************************************************************** */
void GetGpib (int address) /* get an answer from device at address */
{
char r_string[40], temp[80];
sprintf (r_string, "UNT UNL MLA TALK %d", address);
transmit (&status, r_string); /* make device a talker */
strcpy (temp, " "); /* init answer string to null */
receive (&status, &length, temp); /* receive answer */
if (status==8) { printf("Timeout error.\n"); exit(0); }
strcpy (recv, temp); /* copy receive string to global strinb recv[] */
}
/* ********************************************************************* */
void Clear (void) /* Clear the screen (requires ansi.sys in config.sys
file)*/
{
putch(27); printf ("[2J");
}
/* ********************************************************************* */
void GetSpace (void) /* Wait for space key */
{
int ch;
Printxy (25,30,30,"<Space> to continue ");