2635A
Users Manual
4-62
/*
* HYDRALOG.C Hydra Program to scan VDC, VAC, OHMS, FREQ or TEMP
* - initializes RS-232 Communications between PC and Hydra
* - configures a number of Hydra channels for one type
* of measurement (e.g., VDC, VAC, temperature, etc.)
* - scan channels 3 times, and display and record measurement
* data on the screen and in file "testdata.prn"
*
* This program uses routines from the GreenLeaf Communications Library
* (asiopen(), asiputs(), and asigets_timed()) for sending and receiving
* information from the serial port connected to the Hydra. We recommend
* the use of a third-party serial communications library when developing
* C programs to communicate with Hydra instruments over PC serial ports.
*/
/*
* NOTE: Hydra must be set up for RS-232 communications, 1200 baud,
* no parity, 8 bit data
*/
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include "asiports.h" /* Greenleaf CommLib include file */
static FILE *testdata; /* File handle for output data file */
main(argc,argv)
int argc;
char *argv[];
{
int ret_code; /* code returned by various GreenLeaf
communications functions */
unsigned numChannels; /* Number of channels to be scanned */
unsigned index; /* counter */
char response[30]; /* Buffer for user response */
char sendbuff[129]; /* local buffer for transmitting to Hydra */
char recvbuff[129]; /* local buffer for receiving from Hydra */
/* Open and initialize COM2, the serial port the Hydra unit is attached
to, for 1200 baud, no parity, 8 it data, and ignore DTR and CTS */
ret_code = asiopen( COM2, (ASINOUT | BINARY | NORMALRX), 1000, 1000,
1200L, P_NONE, 1,8,FALSE,FALSE );
if ( ret_code < ASSUCCESS ) {
fprintf(stderr,"Failed to open the port, Greenleaf error: %d.\n",
ret_code );
exit(1);
}
/*send reset and uninstall */
asiputc (com2, '\x11');
asiputc (com2, '\x03');
checkResponse (); /* Get prompt */
op53_1f.eps
Figure 4-6. Sample Program (QuickC) (1of 5)
Содержание 2635A
Страница 8: ...2635A Users Manual vi...
Страница 26: ...2635A Users Manual xxiv...
Страница 29: ...Preparation for Use Introduction 1 1 3...
Страница 50: ...2635A Users Manual 1 24...
Страница 53: ...Front Panel Operations Summary of Front Panel Operations 2 2 3...
Страница 88: ...2635A Users Manual 2 38...
Страница 180: ...2635A Users Manual 5 10...
Страница 212: ......
Страница 234: ...2635A Users Manual B 4...
Страница 250: ...2635A Users Manual D 8...
Страница 251: ...E 1 Appendix E 8 Bit Binary Coded Decimal Table...
Страница 264: ...Hydra Memory Card Record DATA FILES SET UP FILES DATxx Application Note SETxx Application Note...
Страница 268: ...2635A Users Manual 4...