Serial Communication with Agilent Instruments under DOS, Windows 95/98/NT/2000, and UNIX
|
|
|
- Imogen Hardy
- 9 years ago
- Views:
Transcription
1 Serial Communication with Agilent Instruments under DOS, Windows 95/98/NT/2000, and UNIX By: Michael A. Covington Anil Bahuman Vic Bancroft Artificial Intelligence Center The University of Georgia Athens, GA Abstract Many Agilent instruments have serial ports through which they can communicate with personal computers. Although less versatile than GPIB, serial communication takes advantage of a port already installed in the computer. This paper describes how to control Agilent instruments through the serial port in various programming languages under DOS, Windows 95/98/NT/2000, and UNIX. Files associated with this report are available from ftp:ftp.ai.uga.edu/pub/serial.port. Equipment Required Agilent 54645D or Agilent 54622D Mixed-Signal Oscilloscope or Agilent 34401A Digital Multimeter A PC with DOS and/or Win 95/98/NT/2000 Programming languages: QBasic and/or C/C++ An RS-232 cable (Agilent F ) 1. Introduction Many Agilent instruments have serial ports through which they can communicate with personal computers. Through the serial port, you can set any of the front-panel controls of the instrument and read back whatever data it is displaying. Although less versatile than GPIB, serial communication does not require special hardware in the computer; thus, it is convenient for quick setups and one-time experiments. This paper describes how to communicate with Agilent instruments through the serial port in various programming languages under DOS, Windows 95/98/NT, and UNIX. The programming examples here are as simple as possible and are provided with the expectation that the user will add more functionality as needed. The techniques documented here were tried out on an Agilent 54645D oscilloscope, an Agilent 34401A multimeter, and an Agilent E3631A power supply. 2. The RS-232 hardware interface 2.1. RS-232 versus GPIB There are two ways to connect Agilent instruments to personal computers. The GPIB interface is a bus similar to SCSI; many Agilent instruments can be connected to a single GPIB card. The RS-232 serial interface supports only one Agilent instrument per serial port on the computer. The advantage of RS-232 is that it requires no special hardware and is supported by a larger variety of programming languages.
2 2.2. Cabling The 9-pin serial port on an Agilent instrument has the same connector and pinout as that of an IBM PC. One way to cable the instrument to the PC is to use a Agilent F cable, which has DB-9 sockets (not plugs) at both ends and, internally, swaps the input and output lines as required. Another way is to use a straight-through 9-conductor cable plus a null modem adapter such as Radio Shack s 9-pin null modem to swap the inputs and outputs; or you can make your own cable. Two sets of connections, both of which work, are the following: Beware of 9-to-25-pin adapters that do not connect all the signal pins. Many of these adapters are designed to work only with a serial mouse Baud rate and parity The Agilent instrument will, in general, give you a choice of baud rates and parity settings; in this report we always use 9600 baud, 8 data bits, no parity bit. (In addition, the signal has one start bit and two stop bits; that's standard for Agilent instruments and almost everything else.) See the instrument s manual for more details Handshaking The Agilent instrument and the computer have to be able to tell each other not to transmit at certain times. This is called handshaking. The serial port takes care of handshaking if it is set up properly. In the programming examples, we will show you how to do this. For reference, here are the details of the handshaking methods used. Most newer Agilent instruments, including the E3631A and 34401A, use simple DTR handshaking, as follows: The DTR output of each device (Agilent instrument or PC) is connected to the DSR input of the other device. A high signal (+3V to +12V) on DTR indicates that transmission is allowed. The instrument s CTS (clear to send) line must also be held high in order for it to transmit.
3 The Agilent 54645D oscilloscope is different. Its DTR handshaking mode is actually RTS, not DTR, handshaking. That is: The DTR output of each device is connected to the DSR input of the other device. The oscilloscope holds DTR high as long as it is turned on. The RTS (Ready To Send) output of each device is connected to the CTS (Clear To Send) input of the other device. The oscilloscope holds RTS high when it is ready to accept input. Some Agilent instruments also support another handshaking mode, XON/XOFF, that relies on transmitted characters rather than control lines. With this protocol, your software must scan the input for Ctrl-S ( XOFF ), which means do not transmit, and Ctrl-Q ( XON ), which means resume transmitting. Because this requires extra software action and because it is not available on all Agilent instruments, we do not use it here What to transmit The full command language of each Agilent instrument is described in its manual, but for a quick start, don t read about the language go straight to the sample computer programs that Agilent gives you. Even if they use GPIB or some other interface, they re full of working examples that tell you exactly what strings to send to it and what responses to expect. In general, every command sent to an Agilent instrument must end with Line Feed (Ctrl-J, ASCII decimal 10). Whether to precede this with Return (Ctrl-M, ASCII decimal 13) is up to you. The first couple of commands in each dialogue are generally something like :SYST:REM to put the instrument in remote mode, *RST to reset it, and *CLR to clear errors. Clearing errors is important because if the instrument receives an unrecognized command, it will remain hung until powered off or reset. Agilent instruments transmit numbers as character strings in E format, such as E+2 to represent (that is, ). Out-of-range values are represented by extremely large or small numbers, not by non-numeric strings Troubleshooting Here are solutions to some common problems that arise when setting up an RS-232 interface. No communication in either direction: Check that the instrument and the computer are set to the same baud rate. Check that appropriate cable lines are connected, including RTS and CTS. Most Agilent instruments must have CTS high (positive) in order to communicate. Be sure to reset and clear ( *RST, *CLR ) the instrument at the beginning of the dialogue. Be sure to end all commands with Line Feed. Instrument responds to commands from PC, but PC never receives its responses: Usually, this indicates a problem with the CTS data line into the instrument. 3. A basic set of software functions As far as possible, all the computer programs in this report implement the same basic set of functions, namely: SerMessage to put a message on the screen; SerCrash to put a message on the screen and register an error (or, in BASIC, just terminate the program); SerStatus to inquire whether the most recent operation was successful (not needed in BASIC); SerOpen to open the serial port (with a parameter to indicate whether to use DTR or RTS handshaking); SerClose to close the serial port; SerPut to transmit a character string to the instrument; SerGet to receive a line of data from the instrument as a character string; SerGetNum to receive a line of data from the instrument as a number; and SerGetChar to receive a single byte of data from the instrument. The arguments required by these functions depend somewhat on the programming language. 4. Interfacing with QBASIC under DOS
4 By far the quickest and simplest way to try out a serial interface is to use QBASIC, a free Microsoft BASIC interpreter provided with recent versions of DOS and Windows. QBASIC includes full on-line documentation. On the Windows 95 distribution disk, QBASIC.EXE and QBASIC.HLP are located in \other\oldmsdos; they can also be downloaded from QBASIC buffers the data coming into the serial port so that your program can read it whenever it s ready. Many operating systems do this, including UNIX and Windows, but DOS does not. Thus, if you are developing a DOS-based serial communication program in any other language, you will, in general, have to provide an interrupt service routine for the serial port. QBASIC eliminates that chore. QBASIC runs under DOS or in a DOS box under Windows 95, 98, 2000, or NT. The Microsoft QuickBasic compiler, a commercial product, compiles QBASIC programs into DOS executables. 4.1 Two very simple prototypes Here is the a very simple QBASIC program that demonstrates serial communication with an Agilent 54645D oscilloscope: ' File AGILENTSCOPE1.BAS, QBASIC, M. Covington 1999 CLS PRINT "Very simple communication with Agilent 54645D oscilloscope" PRINT PRINT "Set oscilloscope to 9600 baud, DTR handshaking." PRINT "Press Enter..." LINE INPUT junk$ OPEN "COM1:9600,n,8,1,LF" FOR RANDOM AS #1 PRINT "COM1 opened" ' Reset the scope and clear errors PRINT #1, "*RST" ' Reset it and clear errors PRINT #1, "*CLS" ' Display a message on the oscilloscope screen PRINT #1, ":SYSTEM:DSP 'Communicating with computer'" PRINT "Taking a measurement..." PRINT #1, ":AUTOSCALE" PRINT #1, ":MEASURE:VRMS? ANALOG1" ' Pause a few seconds for response to become ready SLEEP 3 ' Grab the response data$ = INPUT$(LOC(1), #1) PRINT "Analog channel 1 V(rms) = ", VAL(data$) ' Say goodbye PRINT PRINT "Press Enter..." LINE INPUT junk$ CLOSE #1
5 PRINT "COM1 closed." END The program opens the serial port as file #1, sends commands using the PRINT statement (which causes each command to end with Carriage Return and Line Feed), and receives input by simply grabbing the entire contents of the receive buffer. This last step is, as you might guess, somewhat risky because the oscilloscope may not have sent all the data yet. That s why it s preceded by a 3-second delay. Here s a very similar program that communicates with an Agilent 34401A multimeter. Note the addition of CS to the OPEN statement to tell the computer to handshake only on the DTR line, not the RTS line. ' File AGILENTMETER1.BAS, QBASIC, M. Covington 1999 CLS PRINT "Very simple communication with Agilent 34401A multimeter" PRINT PRINT "Set multimeter to 9600 baud, no parity, SCPI language." PRINT "Press Enter..." LINE INPUT junk$ OPEN "COM1:9600,n,8,1,LF,CS" FOR RANDOM AS #1 ' note CS added PRINT "COM1 opened" ' Select remote mode PRINT #1, "SYST:REM" ' Reset the meter and clear errors PRINT #1, "*RST" ' Reset it and clear errors PRINT #1, "*CLS" ' Display a message on the oscilloscope screen PRINT #1, "DISP:TEXT 'HELLO'" PRINT "Taking a measurement..." PRINT #1, ":MEASURE:VOLTAGE:DC?" ' Pause for the response to become ready SLEEP 3 ' Grab the response data$ = INPUT$(LOC(1), #1) PRINT "'"; data$; "'" PRINT "DC voltage = ", VAL(data$) ' Say goodbye PRINT PRINT "Press Enter..." LINE INPUT junk$
6 CLOSE #1 PRINT "COM1 closed." END 4.2. A more sophisticated QBASIC program Here is a more sophisticated QBASIC program that communicates with the same oscilloscope, but this time, the various operations are encapsulated into subroutines. The input routine is also smarter. This program receives input by grabbing bytes one by one until a line terminator (Carriage Return or Line Feed) is received or ten seconds have elapsed. That is, it will wait for a complete line of input to arrive, but if the communication link goes dead, it will bail out after ten seconds. The algorithms in this program were used as a basis for the Visual Basic, C, and C++ programs that follow. ' File AGILENTSCOPE2.BAS, QBASIC, M. Covington 1999 DECLARE SUB SerOpen (Port$, Handshake$) DECLARE SUB SerClose () DECLARE SUB SerPut (data$) DECLARE SUB SerGetChar (byte$) DECLARE SUB SerGet (data$) DECLARE SUB SerGetNum (x AS SINGLE) CLS PRINT "Modular QBASIC program for communicating" PRINT "with Agilent 54645D oscilloscope" PRINT PRINT "Set oscilloscope to 9600 baud, DTR handshaking." PRINT "Press Enter..." LINE INPUT junk$ SerOpen "COM1", "RTS" ' Reset the scope and clear errors SerPut "*RST" ' Reset it and clear errors SerPut "*CLS" ' Display a message on the oscilloscope screen SerPut ":SYSTEM:DSP 'Communicating with computer'" ' Take some measurements SerPut ":AUTOSCALE" SerPut ":MEASURE:VRMS? ANALOG1" SerGetNum vrms PRINT "Analog channel 1 V(rms) = ", vrms SerPut ":MEASURE:VPP? ANALOG2" SerGetNum vpp2 PRINT "Analog channel 2 V(p-p) = ", vpp2 ' Say goodbye
7 PRINT PRINT "Press Enter..." LINE INPUT junk$ SerClose END SUB SerClose CLOSE #99 PRINT "[Serial port closed.]" END SUB SUB SerGet (data$) ' Inputs a line as a string of characters data$ = "" ' Eat any Return or Line Feed characters ' left over from end of previous line DO SerGetChar byte$ LOOP UNTIL (LEN(byte$) = 0) OR (ASC(byte$) > 31) ' Read characters until Line Feed, Return, ' or timeout occurs DO IF byte$ = CHR$(10) THEN EXIT SUB IF byte$ = CHR$(13) THEN EXIT SUB IF byte$ = "" THEN EXIT SUB data$ = data$ + byte$ SerGetChar byte$ ' the next one LOOP END SUB SUB SerGetChar (byte$) ' Retrieves a character from the serial port, ' or times out, returning an empty string, ' if nothing is received for 10 s. seconds = 0 ' time elapsed t$ = TIME$ ' changes once per second WHILE seconds < 10 IF LOC(99) > 0 THEN byte$ = INPUT$(1, 99) EXIT SUB END IF IF t$ <> TIME$ THEN seconds = seconds + 1 t$ = TIME$ END IF WEND byte$ = "" ' timed out, return empty string END SUB
8 SUB SerGetNum (x AS SINGLE) ' Inputs a number from the serial port. ' No error checking. SerGet data$ x = VAL(data$) END SUB SUB SerOpen (Port$, Handshake$) ' Opens "COM1" or "COM2", 9600 baud. ' Handshake$ is "DTR" or "RTS". ' Times out if unsuccessful. IF UCASE$(LEFT$(Handshake$, 1)) = "R" THEN ' RTS/CTS handshaking OPEN Port$ + ":9600,n,8,1,LF" FOR RANDOM AS #99 ELSE ' DTR/DSR handshaking OPEN Port$ + ":9600,n,8,1,LF,CS" FOR RANDOM AS #99 END IF PRINT "[Serial port " + Port$ + " opened.]" END SUB SUB SerPut (data$) ' Transmits a string, adding CR and LF at end PRINT #99, data$ ' If you wanted to end with LF only, do this: ' PRINT #99, data$ + CHR$(10); END SUB To communicate with an Agilent 34401A multimeter, only the main program needs to be changed, as follows: SerOpen "COM1", "DTR" SerPut ":SYST:REM" ' Remote mode SerPut "*RST" ' Reset and clear errors SerPut "*CLS" SerPut ":DISP:TEXT 'READY'" SerPut ":MEASURE:VOLTAGE:DC?" SerGetNum V PRINT "DC voltage = ", V Everything else is the same. 5. Interfacing under Windows 95/98/2000/NT Unlike DOS, Windows does provide buffering of incoming serial data, together with an elaborate application program interface (API) for serial communication. This API is so elaborate that many Windows programming environments
9 encapsulate it somehow to make accessing it easier. In what follows, we describe three ways to do serial communication under Windows Using Visual Basic s MSCOMM object In Visual Basic, the serial port is encapsulated in the MSCOMM component, which you can place on your application s main form. It looks like a telephone: If MSCOMM is not shown on your palette, right-click on a blank area of the palette, select Components, and check Microsoft Comm Control or, if that is not on the menu, search for MSCOMM32.OCX. Once MSCOMM is there, the program code to access it is very simple. Here is an example. In this program, the MSCOMM object is named MSComm1. Note that much of the program code is almost identical to the preceding QBASIC example. The main program actually the event procedure for clicking a button is at the end. Unfortunately, MSCOMM does not support plain DTR handshaking. Thus, although it works fine with the Agilent54645D oscilloscope, it cannot handshake with newer Agilent instruments. Most of the time, you can simply turn handshaking off (MSComm1.Handshaking = comnone) and proceed. Sometimes you may have to introduce delays in your program in order not to transmit to an instrument when it isn t ready. As an alternative to MSCOMM, Visual Basic can also call the DLL described later in this report. ' Visual Basic example code M. Covington 1999 Sub SerMessage(msg$) ' Displays a message to the user. MsgBox msg$ End Sub Sub SerCrash(msg$) ' Displays a message and ends the program. SerMessage msg$ End ' Forces program to end immediately. End Sub
10 Sub SerOpen(portnum%) ' Opens the serial port. ' portnum% = 1 for COM1, 2 for COM2, etc. ' Requires an MSComm control on the main form. MSComm1.CommPort = portnum% MSComm1.Settings = "9600,N,8,1" MSComm1.Handshaking = comrts MSComm1.InputLen = 1 ' read one byte at a time MSComm1.PortOpen = True If Not MSComm1.PortOpen Then SerCrash "Cannot open port COM" + Str$(portnum) End If ' SerMessage "The serial port is open" End Sub Sub SerClose() ' Closes the serial port MSComm1.PortOpen = False ' SerMessage "The serial port is closed" End Sub Sub SerPut(data$) ' Transmits a string, followed by CR and LF MSComm1.Output = data$ + Chr$(13) + Chr$(10) End Sub Sub SerGetChar(c$) ' Retrieves a character from the serial port, ' or times out, returning an empty string, ' if nothing is received for 10 s. start = Timer ' Seconds elapsed since midnight. While Timer - start < 10 If (Timer - start) < 0 Then ' midnight rollover occurred start = 0 End If If MSComm1.InBufferCount > 0 Then c$ = MSComm1.Input Exit Sub End If Wend c$ = "" ' timed out, return empty string End Sub Sub SerGet(data$) ' Inputs a line as a string of characters data$ = "" ' Eat any Return or Line Feed characters
11 ' left over from end of previous line Do SerGetChar c$ Loop Until (Len(c$) = 0) Or (Asc(c$) > 31) ' Read characters until Line Feed, Return, ' or timeout occurs Do If c$ = Chr$(10) Then Exit Sub If c$ = Chr$(13) Then Exit Sub If c$ = "" Then Exit Sub data$ = data$ + c$ SerGetChar c$ ' the next one Loop End Sub Sub SerGetNum(x As Variant) ' Inputs a number from the serial port. ' No error checking. SerGet data$ x = Val(data$) End Sub Private Sub Command1_Click() ' Demonstrates communication with Agilent 54645D oscilloscope. SerOpen 1 SerPut "*RST" ' Reset it and clear errors SerPut "*CLS" SerPut ":SYSTEM:DSP 'Communicating with computer'" SerPut ":AUTOSCALE" ' SerPut ":MEASURE:VRMS? ANALOG1" SerGetNum vrms Print "Analog channel 1 V(rms) = ", vrms ' SerPut ":MEASURE:VPP? ANALOG2" SerGetNum vpp2 Print "Analog channel 2 V(p-p) = ", vpp2 ' SerClose End Sub 5.2. Using the Win32 API in C++ You can also use the Windows API directly. This is most easily done from C or C++, and the following example was developed in Borland C++ Builder. This happens to be a console application that is, it does not use windowing but all the C functions can be called equally well from a windowed program. Although compiled in C++, this is, for all practical purposes, a C program; the only C++ extensions used are cin and cout in the main program. AGILENTSCOPE.CPP - Borland C++ Builder - M. Covington 1999 Dec 1
12 #include <condefs.h> Main pgm is a console application #include <time.h> Used when detecting timeouts #include <windows.h> We use some Windows system calls #include <iostream.h> We use cout, etc. HANDLE hserport; Global variables int iserok; void SerMessage(char* msg1, char* msg2) Displays a message to the user. msg1 = main message msg2 = message caption Change this to your preferred way of displaying msgs. MessageBox(NULL,msg1,msg2,MB_OK); void SerCrash(char* msg1, char* msg2) Like SerMessage, but ends the program. SerMessage(msg1,msg2); iserok = 0; int SerOK() Returns nonzero if most recent operation succeeded, or 0 if there was an error return iserok; void SerOpen(char* portname, char* handshake) Opens the serial port. portname = "COM1", "COM2", etc. handshake = "RTS" or "DTR" Open the port using a handle hserport = CreateFile( portname,generic_read GENERIC_WRITE,0,NULL, OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); if (hserport == INVALID_HANDLE_VALUE) SerCrash("Can't open comm port",portname); Set baud rate and other attributes
13 DCB dcbserport; GetCommState(hSerPort,&dcbSerPort); dcbserport.baudrate = CBR_9600; dcbserport.fbinary = TRUE; dcbserport.fparity = FALSE; Both handshaking modes are sensitive to DSR and DTR... dcbserport.fdsrsensitivity = TRUE; dcbserport.fdtrcontrol = DTR_CONTROL_HANDSHAKE; dcbserport.foutxdsrflow = TRUE;.. but not XON/XOFF. dcbserport.foutx = FALSE; dcbserport.finx = FALSE; Now choose the handshaking mode... if ((handshake[0] == 'r') (handshake[0] == 'R')) dcbserport.foutxctsflow = TRUE; dcbserport.frtscontrol = RTS_CONTROL_HANDSHAKE; else dcbserport.foutxctsflow = FALSE; dcbserport.frtscontrol = RTS_CONTROL_ENABLE; dcbserport.fnull = FALSE; dcbserport.fabortonerror = FALSE; dcbserport.bytesize = 8; dcbserport.parity = NOPARITY; dcbserport.stopbits = ONESTOPBIT; iserok = SetCommState(hSerPort,&dcbSerPort); if (!iserok) SerCrash("Bad parameters for port",portname); Disable Windows' timeouts; we keep track of our own COMMTIMEOUTS t = MAXDWORD,0,0,0,0; SetCommTimeouts(hSerPort,&t); void SerClose() Closes the serial port. iserok = CloseHandle(hSerPort); if (!iserok) SerCrash("Problem closing serial port",""); void SerPut(char* data) Transmits a line followed by CR and LF.
14 Caution! Will wait forever, without registering an error, if handshaking signals tell it not to transmit. DWORD nbytes; iserok = WriteFile(hSerPort,data,strlen(data),&nBytes,NULL); iserok &= WriteFile(hSerPort,"\r\n",2,&nBytes,NULL); if (!iserok) SerCrash("Problem writing to serial port",""); void SerGetChar(char* c, int* success) Receives a character from the serial port, or times out after 10 seconds. success = 0 if timeout, 1 if successful time_t finish; finish = time(null) + 10; *success = 0; DWORD nbytes = 0; while ((*success == 0) && (time(null) < finish)) ReadFile(hSerPort,c,1,&nBytes,NULL); *success = nbytes; if (*success == 0) SerCrash("Timed out waiting for serial input",""); void SerGet(char* buf, int bufsize) Inputs a line from the serial port, stopping at end of line, carriage return, timeout, or buffer full. int bufpos = 0; buf[bufpos] = 0; initialize empty string int bufposmax = bufsize-1; maximum subscript char c = 0; int success = 0; Eat any Return or Line Feed characters left over from end of previous line do SerGetChar(&c,&success); while ((success == 1) && (c <= 31)); We have now read the first character or timed out. Read characters until any termination condition is met. while (1) if (success == 0) return; timeout
15 if (c == 13) return; carriage return if (c == 10) return; line feed if (bufpos >= bufposmax) return; buffer full buf[bufpos] = c; bufpos++; buf[bufpos] = 0; guarantee validly terminated string SerGetChar(&c,&success); void SerGetNum(double* x) Reads a floating-point number from the serial port. char buf[20]; SerGet(buf,sizeof(buf)); iserok = sscanf(buf,"%lf",x); "%lf" = "long float" = double if (iserok < 1) SerCrash("Problem converting string to number",buf); *x = 0.0; int main() char b[20]; double x; Sample dialogue for Agilent 54645D oscilloscope SerOpen("COM1","RTS"); note RTS handshaking SerPut("*RST"); SerPut("*CLS"); SerPut(":SYSTEM:DSP 'Communicating with computer'"); SerPut(":AUTOSCALE"); SerPut(":MEASURE:VRMS? ANALOG1"); SerGetNum(&x); cout << "Channel 1 RMS voltage (as number) = " << x << "\n"; SerPut(":MEASURE:VPP? ANALOG2"); SerGet(b,sizeof(b)); cout << "Channel 2 P-P voltage (as string) = " << b << "\n"; Say goodbye cout << "Press Enter..."; cin.getline(b,1); SerClose(); return 0; To communicate with an Agilent 34401A multimeter using DTR handshaking, the relevant lines of the main program can be changed to:
16 SerOpen("COM1","DTR"); note DTR handshaking SerPut(":SYST:REM"); SerPut("*RST"); SerPut("*CLS"); SerPut(":DISP:TEXT 'OK'"); SerPut(":MEASURE:VOLT:DC?"); SerGetNum(&x); cout << "Voltage (as number) = " << x << "\n"; SerPut(":MEASURE:VOLT:DC?"); SerGet(b,sizeof(b)); cout << "Voltage (as string) = " << b << "\n"; 5.3. Encapsulating the interface in a DLL A DLL (Dynamic Link Library) is the simplest type of Windows software component. It is a file containing pre-compiled functions that can be loaded and called by a running program. Much of the Windows operating system resides in DLLs. The University of Georgia distributes, from ftp:ftp.ai.uga.edu/pub/serial.port, a DLL containing the C functions described in the previous section. In this section we ll describe how the DLL is constructed, and in the next section, how to use it. To build a DLL, you first tell your C compiler that you want to generate a DLL rather than an EXE file. Most compilers automatically generate the DllEntryPoint function when you do this. Then you put in the functions that you want to place into the DLL. The first line of each function requires some additional declarations that are not used in ordinary C. Each function is declared _export so it will be externally callable, and extern "C" so its name in the DLL will be the same as its name in the source code (otherwise we'd have trouble finding it). In addition, we declare all the routines _stdcall so that they will use the Windows standard calling sequence rather than the C calling sequence, making it easier to call them from other languages. The order of these declarations is significant; _export must come right before the function name. Note! When compiling your DLL, you must make sure it does not require any other DLLs other than those that come with Windows. In C++ Builder 4, the way to do this is to go to Project, Options, Linker, and uncheck Use dynamic RTL ; and go to Project, Options, Packages and uncheck Build with runtime packages. The source code for UGASER01.DLL is as follows. A more sophisticated version named UGASER02.DLL will be developed later. UGASER01.CPP - Borland C++ Builder - M. Covington 1999 Dec 1 Source code for UGASER01.DLL #include <vcl.h> #include <time.h> Used when detecting timeouts #include <windows.h> We use some Windows system calls #include <iostream.h> We use cout, etc. HANDLE hserport; Global variables, not exported int iserok; extern "C" void _stdcall _export SerMessage(char* msg1, char* msg2) Displays a message to the user. msg1 = main message msg2 = message caption Change this to your preferred way of displaying msgs.
17 MessageBox(NULL,msg1,msg2,MB_OK); extern "C" void _stdcall _export SerCrash(char* msg1, char* msg2) Like SerMessage, but ends the program. SerMessage(msg1,msg2); iserok = 0; extern "C" int _stdcall _export SerOK() Returns nonzero if most recent operation succeeded, or 0 if there was an error return iserok;...all the other function definitions, with extern "C" and _stdcall _export added to their declarations, and finally... The following makes the DLL identify itself: int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*) return 1; Compile it appropriately, and you have a DLL Calling the functions in a DLL In order to be called from your program, a DLL must reside either in the same directory as the program, or in \windows\system, i or in a directory listed in the PATH environment variable. It must also have a different name than any other DLL anywhere on the computer. That is a potential pitfall, because if it doesn t, you won t get an error message; you may just get the wrong DLL loaded into memory. Name collisions between unrelated DLLs are rare; one memorable example is that there were two completely different TCP packages both called WINSOCK.DLL. More common are collisions between different versions of the same DLL. In our opinion, Microsoft should have provided a way to guarantee the uniqueness of DLL names. Since they did not, the best we can do is start all our DLL names with UGA (for University of Georgia) in the hope that no one else will choose the same three letters. There are two ways to link the DLL to the calling program, statically (at compile time) or dynamically (during execution). Only the latter will be described here Calling from C or C++ Normally, of course, you won t use a DLL to call our C routines from C or C++. However, it s useful to illustrate how to do so, simply because it shows you exactly what system calls are involved. Basically, the calling program must: (1) load the DLL; (2) find the desired function in the DLL, and obtain a pointer to it;
18 (3) call it using this pointer; (4) free the DLL when it s finished with it. Of these, step (3) is the hard one in C because C is a typed language; you must therefore declare a pointer type that matches the function you are calling. The following is an example of calling a DLL dynamically from C++. Caution: You will not get recognizable error messages if you call a function with the wrong type or number of arguments. ii You will probably get messages about stack overflow or underflow or incorrect calling sequence or you may not get any error messages at all. File DemoDLL.CPP - M. Covington 1999 Demonstrates calling a dynamically loaded DLL #include <condefs.h> #include <iostream.h> #include <windows.h> This is a console application We're using cout We're using Windows system calls Because C is a typed language, we need a different pointer type for each combination of function/argument types. For convenience, we make each of them a type unto itself. typedef void _stdcall TSerMessage(char*,char*); typedef void _stdcall TSerCrash(char*,char*); typedef int _stdcall TSerOK(); typedef void _stdcall TSerOpen(char*,char*); typedef void _stdcall TSerClose(); typedef void _stdcall TSerPut(char*); typedef void _stdcall TSerGetChar(char*,int*); typedef void _stdcall TSerGet(char*,int); typedef void _stdcall TSerGetNum(double*); int main() cout << "Finding and loading the DLL..." << endl; HINSTANCE h = LoadLibrary("UGASER01.DLL"); if (h == NULL) cout << "Could not load the DLL." << endl; return -1; cout << "Let's try out SerMessage..." << endl; TSerMessage* psermessage = (TSerMessage*)GetProcAddress(h,"SerMessage"); if (psermessage == NULL) cout << "Could not find SerMessage in the DLL" << endl; return -1; (*psermessage)("greetings from a DLL!","Hi!"); cout << "Freeing the DLL..." << endl;
19 FreeLibrary(h); return 0; If you re not adept at using the C pointer system, this may seem a little obscure. Here s what s going on in the middle part: TSerMessage is the type we define for SerMessage (i.e., a function that takes two char* arguments and returns nothing). We cast the result of GetProcAddress to TSerMessage* (i.e., pointer to an object of type TSerMessage) and assign it to psermessage (the variable that holds the actual pointer). We then call (*psermessage) (i.e., the function to which psermessage points). There are plenty of other ways to do this, of course! Calling from LPA Prolog Calling functions in a DLL from other languages is often easier. Here we call some of the DLL functions from LPA Prolog (a product of Logic Programming Associates, London, England, LPA Prolog provides a built-in routine for calling Windows system functions, but it can actually call any function in any DLL as long as the arguments are 32-bit integers or 32-bit pointers. Crucially, LoadLibrary is actually LoadLibraryA because we are passing it a pointer to an ASCII (8-bit-per-character) character string. There is also a LoadLibraryW for wide (16-bit, UNICODE) strings. The same is true of every Windows system call that takes string arguments. Some programming languages, including C, take care of this distinction for you, but in Prolog you re on your own. The bare minimum Prolog code to call our DLL is the following: test :- winapi((kernel32,'loadlibrarya'),[`ugaser01.dll`],handle), winapi((ugaser01,'sermessage'),[`greetings`,`hello`],_), winapi((kernel32,'freelibrary'),[handle],_). LPA s documentation explains in more detail how winapi/3 works. Basically, the schema is winapi(dllname,function),argumentlist,returnedvalue) where DLLname and Function are Prolog atoms, ArgumentList is a list (possibly empty) of arguments, and ReturnedValue is a Prolog variable to hold the returned value, or an anonymous variable (underscore mark, _ ) to discard it. In addition, wintxt, used in the following program, provides a way to retrieve text from buffers passed to the called function. Here is a more sophisticated Prolog program that conducts a dialogue with an Agilent 54645D oscilloscope and an Agilent 34401A multimeter. The C functions are wrapped in Prolog predicates that fail (i.e., cause backtracking) whenever they cannot carry out the requested operation. Thus, Prolog backtracking will automatically bail out of unsuccessful situations. % File DEMO2.PL - M. Covington 1999 % Dialogue with Agilent instruments in LPA Prolog % Prolog routines to call the C functions. % % These are arranged so that they fail if the operation % is unsuccessful. Thus, Prolog backtracking will % automatically bail out of an unsuccessful operation. :- dynamic serhandle/1. % global data
20 % serok -- succeeds if previous serial operation was successful. serok :- winapi((ugaser01,'serok'),[],result), Result > 0. % seropen(+port,+handshake) % -- loads the DLL and open the serial port. % Port = `COM1` or the like. % Handshake = `RTS` or `DTR`. seropen(port,handshake) :- winapi((kernel32,'loadlibrarya'),[`ugaser01.dll`],handle), asserta(serhandle(handle)), winapi((ugaser01,'seropen'),[port,handshake],_), serok. % serclose -- close the serial port and free the DLL. % (Succeeds even if unable to do so, because % in general we want to clean up as best we can.) serclose :- winapi((ugaser01,'serclose'),[],_), retract(serhandle(handle)), winapi((kernel32,'freelibrary'),[handle],_). % serput(+string) -- send a string out the serial port. % String is a backquoted string. serput(string) :- winapi((ugaser01,'serput'),[string],_), serok. % serget(-string) -- read a string in from the serial port. % String is instantiated to a backquoted string. serget(string) :- fcreate(buffer,[],-2,256), winapi((ugaser01,'serget'),[buffer,256],_), wintxt(buffer,0,string), fclose(buffer), serok.
21 % sergetnum(-num) -- read a string in from serial port as number. % Num is instatiated to a floating-point number. % (Because LPA Prolog can't retrieve floats from % the DLL, we retrieve text and convert it here.) sergetnum(num) :- serget(string), number_string(num,string). % Error checking is done by SerGet. % Main program -- Simple dialog with Agilent 54645D oscilloscope % and Agilent 34401A multimeter test1 :- seropen(`com1`,`rts`), % For Agilent 54645D oscilloscope serput(`*rst`), serput(`*cls`), serput(`:system:dsp 'Hello, world'`), serput(`:autoscale`), serput(`:measure:vrms? ANALOG1`), serget(s), write('channel 1 RMS voltage (as text) = '), write(s), nl, serput(`:measure:vrms? ANALOG1`), sergetnum(n), write('channel 1 RMS voltage (as number) = '), write(n), nl, serclose,!. test1 :- serclose. % fall back to here if anything failed along the way test2 :- seropen(`com1`,`dtr`), % For Agilent 34401A multimeter serput(`:syst:rem`), serput(`*rst`), serput(`*cls`), serput(`:disp:text 'READY'`), serput(`:measure:volt:dc?`), sergetnum(v), write('voltage (as number) = '), write(v), nl, serclose,!. test2 :- serclose. % fall back to here if anything failed along the way 6. Interfacing with C under UNIX
22 Like Windows and unlike DOS, UNIX handles the serial port so that you can read and write it like a file. The UNIX API is somewhat simpler than that of Windows, particularly if you don t want to analyze communication errors. We have been assuming throughout that the user of an instrument will know whether or not it s working and that elaborate error handling is unnecessary. The method for setting handshaking varies a good bit from one UNIX system to another. In practice, Agilent instruments do not necessarily require handshaking; at 9600 baud, if transmitting only modest amounts of data, you may well be able to do without it. The following example program, in C, was tested under Linux on an Intel Pentium-based computer. Since everything except the handshaking selection is POSIX-compliant, it should be very portable. agilentscope.c - GNU g++ egcs , V. Bancroft 1999 #include <stdio.h> ISO C Standard: 4.9 INPUT/OUTPUT #include <time.h> ISO C Standard: 4.12 DATE and TIME #include <termios.h> POSIX Standard: General Terminal Intf. #include <unistd.h> POSIX Standard: 2.10 Symbolic Constants #include <fcntl.h> POSIX Standard: 6.5 File Control Operations #include <sys/types.h> POSIX Standard: 2.6 Primitive System Data Types #include <sys/stat.h> POSIX Standard: 5.6 File Characteristics map DWORD to the GNU variant for read and write sizes #define DWORD size_t a file handle is an integer descriptor, #define HANDLE int open failure results in negative one, #define INVALID_HANDLE_VALUE -1 default device string #define DEVICE "/dev/ttys0" define values for iserok #define TRUE 1 #define FALSE 0 HANDLE hserport; Global variables int iserok; void SerMessage(char* msg1, char* msg2) Displays a message to the user. msg1 = main message msg2 = message caption Change this to your preferred way of displaying msgs. printf( "%s ( %s )\n", msg1, msg2); void SerCrash(char* msg1, char* msg2) Like SerMessage, but ends the program. SerMessage(msg1,msg2); iserok = 0;
23 int SerOK() Returns nonzero if most recent operation succeeded, or 0 if there was an error return iserok; void SerOpen(char* portname, char* handshake) Opens the serial port. portname = "COM1", "COM2", etc. handshake = "RTS" or "DTR" Open the port using a handle hserport = open( portname, O_RDWR ); if (hserport == INVALID_HANDLE_VALUE) SerCrash("Can't open comm port",portname); iserok = FALSE; termios term; if ( tcgetattr( hserport, &term ) ) SerMessage( "Can't get device settings.", "tcgetattr"); iserok = FALSE; Now choose the handshaking mode... if ((handshake[0] == 'r') (handshake[0] == 'R')) term.c_cflag = CRTSCTS; RTS/CTS flow control of output else term.c_cflag &= ~( CRTSCTS ); disable CTS flow control of output Set baud rate and other attributes term.c_cflag = CS8; eight bit character set term.c_cflag = CREAD; enable receiver term.c_cflag = HUPCL; lower modem lines on last close term.c_cflag = CLOCAL; ignore modem status lines term.c_iflag = 0; turn off input processing term.c_iflag = IGNPAR; ignore parity errors term.c_lflag = 0; turn off local processing term.c_oflag = 0; turn off output processing
24 cfsetispeed( &term, B9600 ); cfsetospeed( &term, B9600 ); if (tcsetattr( hserport, TCSANOW, &term )) SerCrash("Bad parameters for port",portname); iserok = FALSE; if (!iserok) SerCrash("Bad parameters for port",portname); Disable Windows' timeouts; we keep track of our own COMMTIMEOUTS t = MAXDWORD,0,0,0,0; SetCommTimeouts(hSerPort,&t); void SerClose() Closes the serial port. iserok!= close(hserport); if (!iserok) SerCrash("Problem closing serial port",""); void SerPut(char* data) Transmits a line followed by CR and LF. Caution! Will wait forever, without registering an error, if handshaking signals tell it not to transmit. DWORD nbytes; iserok = nbytes=write(hserport,(const void *)data,strlen(data)); iserok &= nbytes=write(hserport,"\r\n",2); if (!iserok) SerCrash("Problem writing to serial port",""); void SerGetChar(char* c, int* success) Receives a character from the serial port, or times out after 10 seconds. success = 0 if timeout, 1 if successful time_t finish; finish = time(null) + 10; *success = 0; DWORD nbytes = 0; while ((*success == 0) && (time(null) < finish)) nbytes=read(hserport,c,(size_t)1); *success = nbytes;
25 if (*success == 0) SerCrash("Timed out waiting for serial input",""); void SerGet(char* buf, int bufsize) Inputs a line from the serial port, stopping at end of line, carriage return, timeout, or buffer full. int bufpos = 0; buf[bufpos] = 0; initialize empty string int bufposmax = bufsize-1; maximum subscript char c = 0; int success = 0; Eat any Return or Line Feed characters left over from end of previous line do SerGetChar(&c,&success); while ((success == 1) && (c <= 31)); We have now read the first character or timed out. Read characters until any termination condition is met. while (1) if (success == 0) return; timeout if (c == 13) return; carriage return if (c == 10) return; line feed if (bufpos >= bufposmax) return; buffer full buf[bufpos] = c; bufpos++; buf[bufpos] = 0; guarantee validly terminated string SerGetChar(&c,&success); void SerGetNum(double* x) Reads a floating-point number from the serial port. char buf[20]; SerGet(buf,sizeof(buf)); iserok = sscanf(buf,"%lf",x); "%lf" = "long float" = double if (iserok < 1) SerCrash("Problem converting string to number",buf); *x = 0.0;
26 Sample main program to conduct dialogue with Agilent 54645D oscilloscope, 9600 baud, DTR handshaking int main() char b[20]; double x; Sample dialogue for Agilent 64645D oscilloscope SerOpen("COM1","RTS"); note RTS handshaking SerPut("*RST"); SerPut("*CLS"); SerPut(":SYSTEM:DSP 'Communicating with computer'"); SerPut(":AUTOSCALE"); SerPut(":MEASURE:VRMS? ANALOG1"); SerGetNum(&x); printf( "Channel 1 RMS voltage (as number) = %d\n", x ); cout << "Channel 1 RMS voltage (as number) = " << x << "\n"; SerPut(":MEASURE:VPP? ANALOG2"); SerGet(b,sizeof(b)); printf( "Channel 2 P-P voltage (as string) = %s\n", b ); cout << "Channel 2 P-P voltage (as string) = " << b << "\n"; /* Sample dialogue for Agilent 34401A multimeter SerOpen("COM1","DTR"); note DTR handshaking SerPut(":SYST:REM"); SerPut("*RST"); SerPut("*CLS"); SerPut(":DISP:TEXT 'OK'"); SerPut(":MEASURE:VOLT:DC?"); SerGetNum(&x); printf( "Voltage (as number) = %d\n", x ); cout << "Voltage (as number) = " << x << "\n"; SerPut(":MEASURE:VOLT:DC?"); SerGet(b,sizeof(b)); printf( "Voltage (as string) = %s\n", b ); cout << "Voltage (as string) = " << b << "\n"; */ Say goodbye printf( "Press Enter..."); scanf("\r");
27 SerClose(); return 0; 7.0. Some ideas for exploiting computer-to-instrument communication Once you can combine the intelligence of a general-purpose computer with the input and output versatility of Agilent test equipment, a wide range of new applications becomes possible. Here, in no particular order, are a few ideas for possible projects, ranging from simple to complex. Build a talking instrument interfaced to a PC with a speech synthesizer. Test, cycle, and recharge NiCd batteries under computer control; report when a battery seems to be defective. Monitor the quality of the 120-volt AC line for a whole day or more. Compute the statistics of a set of components (such as a collection of resistors that are supposed to be the same value). Build an expert system in Prolog that diagnoses failures in a piece of equipment, telling the technician where to connect the probes at each step. Build an expert system that learns that is, you use it to make measurements on one or more known-good pieces of equipment under varying conditions, and it learns to distinguish normal from abnormal measurements. Why stop at PCs? Using a microcontroller and a MAX-232 chip, you can build a small module that can deliver elaborate commands to a piece of test equipment. This allows even more customization than Agilent provided for. Those are just a few of many possibilities. Bear in mind that if multiple Agilent instruments are involved, you should consider using GPIB (multiple instruments on one bus) rather than serial ports. -end- i More precisely, the directory returned by calling GetSystemDirectory; in Windows NT/2000, normally \windows\system32. ii As Cartic Ramakrishnan pointed out to us, having found it out the hard way.
RS-232 Communications Using BobCAD-CAM. RS-232 Introduction
RS-232 Introduction Rs-232 is a method used for transferring programs to and from the CNC machine controller using a serial cable. BobCAD-CAM includes software for both sending and receiving and running
Using HyperTerminal with Agilent General Purpose Instruments
Using HyperTerminal with Agilent General Purpose Instruments Windows HyperTerminal can be used to program most General Purpose Instruments (not the 531xx series counters) using the RS-232 Serial Bus. Instrument
Modbus Communications for PanelView Terminals
User Guide Modbus Communications for PanelView Terminals Introduction This document describes how to connect and configure communications for the Modbus versions of the PanelView terminals. This document
LTM-1338B. Plus Communications Manual
LTM-1338B Plus Communications Manual 2000. Best Power, Necedah, Wisconsin All rights reserved. Best Power The System Setup option from the Main Menu on the front panel is passwordprotected. The default
Remote Access Server - Dial-Out User s Guide
Remote Access Server - Dial-Out User s Guide 95-2345-05 Copyrights IBM is the registered trademark of International Business Machines Corporation. Microsoft, MS-DOS and Windows are registered trademarks
MS Visual C++ Introduction. Quick Introduction. A1 Visual C++
MS Visual C++ Introduction 1 Quick Introduction The following pages provide a quick tutorial on using Microsoft Visual C++ 6.0 to produce a small project. There should be no major differences if you are
Virtual Integrated Design Getting started with RS232 Hex Com Tool v6.0
Virtual Integrated Design Getting started with RS232 Hex Com Tool v6.0 Copyright, 1999-2007 Virtual Integrated Design, All rights reserved. 1 Contents: 1. The Main Window. 2. The Port Setup Window. 3.
Docklight V2.1 User Manual 08/2015. Copyright 2015 Flachmann und Heggelbacher GbR
Table of Contents 2 1. Copyright 5 2. Introduction 6 2.1 Docklight - Overview... 7 2.2 Typical Applications... 8 2.3 System Requirements... 9 3. User Interface 10 3.1 Main Window... 11 3.2 Clipboard -
RS-232 COMMUNICATIONS
Technical Note D64 0815 RS-232 COMMUNICATIONS RS-232 is an Electronics Industries Association (EIA) standard designed to aid in connecting equipment together for serial communications. The standard specifies
Freescale Semiconductor, I
nc. Application Note 6/2002 8-Bit Software Development Kit By Jiri Ryba Introduction 8-Bit SDK Overview This application note describes the features and advantages of the 8-bit SDK (software development
Serial Communications
April 2014 7 Serial Communications Objectives - To be familiar with the USART (RS-232) protocol. - To be able to transfer data from PIC-PC, PC-PIC and PIC-PIC. - To test serial communications with virtual
Aquadyne TechTip TITLE: TROUBLESHOOTING PC COM PORT AND MODEM PRODUCTS AFFECTED SYMPTOMS POSSIBLE CAUSES
Aquadyne TechTip TITLE: TROUBLESHOOTING PC COM PORT AND MODEM COMMUNICATIONS WITH AN OCTOPUS. Article # 072297-1 Last reviewed: 03/25/98 Keywords: Serial Port, Modem, Polling, AquaWeb, Node Not Responding
IP SERIAL DEVICE SERVER
IP SERIAL DEVICE SERVER ( 1 / 2 / 4 serial port ) Installation guide And User manual Version 1.0 1Introduction... 5 1.1Direct IP mode...5 1.2Virtual COM mode...5 1.3Paired mode...6 1.4Heart beat... 6
RS-232 Baud Rate Converter CE Model 232BRC Documentation Number 232BRC-3903 (pn5104-r003)
S-232 Baud ate Converter CE Model 232BC Documentation Number 232BC-3903 (pn5104-r003) International Headquarters B&B Electronics Mfg. Co. Inc. 707 Dayton oad -- P.O. Box 1040 -- Ottawa, IL 61350 USA Phone
Appendix A. This Appendix includes the following supplemental material:
Appendix A This Appendix includes the following supplemental material: Cabling Diagrams and Instructions Connectors (9-pin D-type) Data Transfer Protocols Usage/Handshaking Ultimax Dual Screen Console
The programming language C. sws1 1
The programming language C sws1 1 The programming language C invented by Dennis Ritchie in early 1970s who used it to write the first Hello World program C was used to write UNIX Standardised as K&C (Kernighan
SUDT AccessPort TM Advanced Terminal / Monitor / Debugger Version 1.37 User Manual
SUDT AccessPort TM Advanced Terminal / Monitor / Debugger Version 1.37 User Manual Version 1.0 - January 20, 2015 CHANGE HISTORY Version Date Description of Changes 1.0 January 20, 2015 Initial Publication
SMTP-32 Library. Simple Mail Transfer Protocol Dynamic Link Library for Microsoft Windows. Version 5.2
SMTP-32 Library Simple Mail Transfer Protocol Dynamic Link Library for Microsoft Windows Version 5.2 Copyright 1994-2003 by Distinct Corporation All rights reserved Table of Contents 1 Overview... 5 1.1
PCMCIA 1 Port RS232 2.1 EDITION OCTOBER 1999
232 232232 PCMCIA 1 Port RS232 2.1 EDITION OCTOBER 1999 Guarantee. FULL 36 MONTHS GUARANTEE. We guarantee your interface card for a full 36 months from purchase, parts and labour, provided it has been
Date Rev. Details Author
Jtech engineering ltd J - Te c h E n g i n e e ring, L t d. 11080 Bond Boulevard Delta BC V4E 1M7 Canada Tel: 604 543 6272 Fax: 604 543 6476 http://www.jtecheng.com AUTODIALER USER S MANUAL REVISION HISTORY
LAN / WAN Connection Of Instruments with Serial Interface By Using a Terminal Server
Products: EFA with EFA Scan, DVRM and DVMD with Realtime Monitor or Stream Explorer DVMD-B1 LAN / WAN Connection Of Instruments with Serial Interface By Using a Terminal Server Remote control of test and
Using a Laptop Computer with a USB or Serial Port Adapter to Communicate With the Eagle System
Using a Laptop Computer with a USB or Serial Port Adapter to Communicate With the Eagle System ECU DB9 USB 20-060_A.DOC Page 1 of 18 9/15/2009 2009 Precision Airmotive LLC This publication may not be copied
VB (Serial Comms) Project Components (Ctrl-T)
26 VB (Serial Comms) 26.1 Introduction This chapter discusses how Visual Basic can be used to access serial communication functions. Windows hides much of the complexity of serial communications and automatically
The Answer to the 14 Most Frequently Asked Modbus Questions
Modbus Frequently Asked Questions WP-34-REV0-0609-1/7 The Answer to the 14 Most Frequently Asked Modbus Questions Exactly what is Modbus? Modbus is an open serial communications protocol widely used in
OPERATOR INTERFACE PRODUCTS APPLICATION NOTE. Xycom 4800/2000 OIL (Operator Interface Language)- Series Terminals: Backup and Restore with ProComm
Page 1 of 9 Xycom 4800/2000 OIL (Operator Interface Language)- Series Terminals: Backup and Restore with ProComm Introduction The Xycom 4800/2000 OIL-series terminals offer you the ability to backup and
Single channel data transceiver module WIZ2-434
Single channel data transceiver module WIZ2-434 Available models: WIZ2-434-RS: data input by RS232 (±12V) logic, 9-15V supply WIZ2-434-RSB: same as above, but in a plastic shell. The WIZ2-434-x modules
CANnes PC CAN Interface Manual
CANnes PC CAN Interface Manual Version: 1.21 October 1 st, 2004 D 20375 Hamburg, Germany Phone +49-40-51 48 06 0 FAX: +49-40-51 48 06 60 2 CANnes Card Manual V1.21 Version Version Date Author Comment 1.00
Remote control circuitry via mobile phones and SMS
Remote control circuitry via mobile phones and SMS Gunther Zielosko 1. Introduction In application note No. 56 ( BASIC-Tiger sends text messages, in which we described a BASIC-Tiger sending text messages
To perform Ethernet setup and communication verification, first perform RS232 setup and communication verification:
PURPOSE Verify that communication is established for the following products programming option (488.2 compliant, SCPI only): DCS - M9C & DCS M130, DLM M9E & DLM-M9G & DLM M130, DHP - M9D, P series, SG,
Control Technology Corporation CTC Monitor User Guide Doc. No. MAN-1030A Copyright 2001 Control Technology Corporation All Rights Reserved Printed in USA The information in this document is subject to
Unique Micro Design Advanced Thinking Products. Model S151 UMD Transfer Utility for the Nippondenso BHT Series User Manual
S151 User Manual Advanced Thinking Products Unique Micro Design Advanced Thinking Products Model S151 UMD Transfer Utility for the Nippondenso BHT Series User Manual Document Reference : DOC-S151-UM UMD
The Analyst RS422/RS232 Tester. With. VTR, Monitor, and Data Logging Option (LOG2) User Manual
12843 Foothill Blvd., Suite D Sylmar, CA 91342 818 898 3380 voice 818 898 3360 fax www.dnfcontrolscom The Analyst RS422/RS232 Tester With VTR, Monitor, and Data Logging Option (LOG2) User Manual Manual
Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas
CS 110B - Rule Storage Classes Page 18-1 Attributes are distinctive features of a variable. Data type, int or double for example, is an attribute. Storage class is another attribute. There are four storage
PM1122 INT DIGITAL INTERFACE REMOTE
PM1122 INT DIGITAL INTERFACE REMOTE PM1122 INT front panel description: 1. Clear wireless remotes knob: push this button for more than 2 seconds to clear the list of all assigned wireless remote settings
Programming and Using the Courier V.Everything Modem for Remote Operation of DDF6000
Programming and Using the Courier V.Everything Modem for Remote Operation of DDF6000 1.0 Introduction A Technical Application Note from Doppler System July 5, 1999 Version 3.x of the DDF6000, running version
µtasker Document FTP Client
Embedding it better... µtasker Document FTP Client utaskerftp_client.doc/1.01 Copyright 2012 M.J.Butcher Consulting Table of Contents 1. Introduction...3 2. FTP Log-In...4 3. FTP Operation Modes...4 4.
MCB3101 (Class I) WiRobot Serial Bluetooth Wireless Module User Manual
MCB3101 (Class I) WiRobot Serial Bluetooth Wireless Module User Manual Version: 1.0.1 Dec. 2005 Table of Contents I. Introduction 2 II. Operations 2 II.1. Theory of Operation 2 II.2. Configuration (PC-PC
Getting Started with IntelleView POS Administrator Software
Getting Started with IntelleView POS Administrator Software Administrator s Guide for Software Version 1.2 About this Guide This administrator s guide explains how to start using your IntelleView POS (IntelleView)
NortechCommander Software Operating Manual MAN-00004 R6
NortechCommander Software Operating Manual MAN-00004 R6 If the equipment described herein bears the symbol, the said equipment complies with the applicable European Union Directive and Standards mentioned
1 Serial RS232 to Ethernet Adapter Installation Guide
Installation Guide 10/100 Mbps LED (amber color ) Link/Activity LED (green color ) 1. Introduction Thank you for purchasing this 1-port RS232 to Ethernet Adapter (hereinafter referred to as Adapter ).
The BSN Hardware and Software Platform: Enabling Easy Development of Body Sensor Network Applications
The BSN Hardware and Software Platform: Enabling Easy Development of Body Sensor Network Applications Joshua Ellul [email protected] Overview Brief introduction to Body Sensor Networks BSN Hardware
1.1 Connection. 1.1.1 Direct COM port connection. 1. Half duplex RS232 spy cable without handshaking
POS function Marchen POS-DVR surveillance system is a professional surveillance integrated with POS system. By bringing video and POS transaction data together, the POS-DVR surveillance system provides
LOVELINK III- Process Monitoring, Logging, Graphing, & Configuration
LOVELINK III- Process Monitoring, Logging, Graphing, & Configuration VERSION 1.00.00 USER MANUAL Updated 09/13/2002 Table of Contents Hardware/Software Requirements...2 Computer Requirements...2 Instrument
Quick Installation. A Series of Intelligent Bar Code Reader with NeuroFuzzy Decoding. Quick Installation
Quick Installation A Series of Intelligent Bar Code Reader with NeuroFuzzy Decoding This chapter intends to get your new FuzzyScan scanner working with your existing system within minutes. General instructions
I. DigitalCAT Captioning Software Overview... 1. A. Welcome... 1. B. Acquiring the Captioning Add-On... 1. C. Purpose of this Guide...
I. DigitalCAT Captioning Software Overview... 1 A. Welcome... 1 B. Acquiring the Captioning Add-On... 1 C. Purpose of this Guide... 1 II. Direct or Dial-Up Connections... 1 A. Direct Connections... 1 B.
ODBC Client Driver Help. 2015 Kepware, Inc.
2015 Kepware, Inc. 2 Table of Contents Table of Contents 2 4 Overview 4 External Dependencies 4 Driver Setup 5 Data Source Settings 5 Data Source Setup 6 Data Source Access Methods 13 Fixed Table 14 Table
How To Connect A Directsofl To A Powerpoint With An Acd With An Ctel With An Dm-Tel Modem On A Pc Or Ipad Or Ipa (Powerpoint) With A Powerline 2 (Powerline
Application Note Last reviewed: 03/17/2008 AN-KEP-003.doc Page 1 of 23 Introduction... 1 Recommended s and ports to use... 1 Cable Wiring... 2 MDM-TEL Configuration ( Wizard)... 3 Direct Logic Communications
Software Development to Control the Scorbot ER VII Robot With a PC
Software Development to Control the Scorbot ER VII Robot With a PC ANTÓNIO FERROLHO Electrical Engineering Department Superior School of Technology of the Polytechnic Institute of Viseu Campus Politécnico
How to setup a serial Bluetooth adapter Master Guide
How to setup a serial Bluetooth adapter Master Guide Nordfield.com Our serial Bluetooth adapters part UCBT232B and UCBT232EXA can be setup and paired using a Bluetooth management software called BlueSoleil
Technical Manual. For use with Caller ID signaling types: Belcore 202, British Telecom, & ETSI
Technical Manual For use with Caller ID signaling types: Belcore 202, British Telecom, & ETSI Caller ID.com WHOZZ CALLING? POS 2 Caller ID Monitoring Unit Technical Manual For use with Caller ID signaling
CENTRONICS interface and Parallel Printer Port LPT
Course on BASCOM 8051 - (37) Theoretic/Practical course on BASCOM 8051 Programming. Author: DAMINO Salvatore. CENTRONICS interface and Parallel Printer Port LPT The Parallel Port, well known as LPT from
WinLIN Setup and Operation:
Frequently Asked Questions about the 07551-Series Masterflex L/S Computer-Compatible drives and about the Masterflex WinLIN Linkable Instrument Control Software (07551-70) WinLIN Setup and Operation: Will
Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture
Last Class: OS and Computer Architecture System bus Network card CPU, memory, I/O devices, network card, system bus Lecture 3, page 1 Last Class: OS and Computer Architecture OS Service Protection Interrupts
Fanuc 0 M/T Model C Serial (RS232) Connection Guide
Memex Automation Inc., Burlington, Ontario Canada L7N 1 http://www.memex.ca Fanuc 0 M/T Model C Serial (RS232) Connection Guide The Fanuc 0-C control has two RS-232 interfaces. Interface number 1 (M5)
Why you need to monitor serial communication?
Why you need to monitor serial communication Background RS232/RS422 provides 2 data lines for each data channel. One is for transmitting data and the other for receiving. Because of these two separate
Building Applications Using Micro Focus COBOL
Building Applications Using Micro Focus COBOL Abstract If you look through the Micro Focus COBOL documentation, you will see many different executable file types referenced: int, gnt, exe, dll and others.
Toshiba Serial Driver Help. 2012 Kepware Technologies
2012 Kepware Technologies 2 Table of Contents Table of Contents 2 3 Overview 3 Device Setup 4 Modem Setup 4 Cable Diagram - EX100/200 PLCs 4 Cable Diagram - T1 PLCs 5 Cable Diagram - T2/T3 PLCs 5 Cable
1. Make sure that no client accounts are open. 2. Click on Setup, then click Modem. The Modem Setup window will appear.
SECURITY SYSTEM MANAGEMENT SOFTWARE FOR WINDOWS WINLOAD MODEM SETUP The modem setup is a very important step in the connection process. If the modem setup is not properly completed communication between
FTP Client Engine Library for Visual dbase. Programmer's Manual
FTP Client Engine Library for Visual dbase Programmer's Manual (FCE4DB) Version 3.3 May 6, 2014 This software is provided as-is. There are no warranties, expressed or implied. MarshallSoft Computing, Inc.
2 ASCII TABLE (DOS) 3 ASCII TABLE (Window)
1 ASCII TABLE 2 ASCII TABLE (DOS) 3 ASCII TABLE (Window) 4 Keyboard Codes The Diagram below shows the codes that are returned when a key is pressed. For example, pressing a would return 0x61. If it is
Sources: On the Web: Slides will be available on:
C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,
LDG Electronics External Meter Serial Communications Protocol Specification
M1000 METER PROTOCOL SPECIFICATION MANUAL REV A LDG Electronics External Meter Serial Communications Protocol Specification LDG Electronics 1445 Parran Road St. Leonard MD 20685-2903 USA Phone: 410-586-2177
Process Control and Automation using Modbus Protocol
Process Control and Automation using Modbus Protocol Modbus is the fundamental network protocol used in most industrial applications today. It is universal, open and an easy to use protocol. Modbus has
OWNERS MANUAL. Status Monitor. for Windows 95, 98, ME, NT 4, 2000 & XP. SIGNALCRAFTERS TECH, INC. www.signalcrafters.com
OWNERS MANUAL Status Monitor for Windows 95, 98, ME, NT 4, 2000 & XP SIGNALCRAFTERS TECH, INC. www.signalcrafters.com 57 Eagle Rock Avenue, East Hanover, NJ 07936 Tel: 973-781-0880 or 800-523-5815 Fax:
Introduction: Implementation of the MVI56-MCM module for modbus communications:
Introduction: Implementation of the MVI56-MCM module for modbus communications: Initial configuration of the module should be done using the sample ladder file for the mvi56mcm module. This can be obtained
DUKANE Intelligent Assembly Solutions
PC Configuration Requirements: Configuration Requirements for ipc Operation The hardware and operating system of the PC must comply with a list of minimum requirements for proper operation with the ipc
TAP Interface Specifications
TAP Interface Specifications This Document is for those who want to develop their own paging control software or add an interface for the WaveWare v9 Series Paging Encoder to their existing software applications.
PROLOGIX GPIB-USB CONTROLLER USER MANUAL VERSION 6.107. May 14, 2013 PROLOGIX.BIZ
PROLOGIX GPIB-USB CONTROLLER USER MANUAL VERSION 6.107 May 14, 2013 PROLOGIX.BIZ Table of Contents 1. Introduction... 4 2. Installation... 4 3. Firmware Upgrade... 4 4. Host Software... 4 5. Configuration...
ARM Thumb Microcontrollers. Application Note. Software ISO 7816 I/O Line Implementation. Features. Introduction
Software ISO 7816 I/O Line Implementation Features ISO 7816-3 compliant (direct convention) Byte reception and transmission with parity check Retransmission on error detection Automatic reception at the
Troubleshooting and Diagnostics
Troubleshooting and Diagnostics The troubleshooting and diagnostics guide provides instructions to assist in tracking down the source of many basic controller installation problems. If there is a problem
Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs
Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs AN033101-0412 Abstract This describes how to interface the Dallas 1-Wire bus with Zilog s Z8F1680 Series of MCUs as master devices. The Z8F0880,
WHQL Certification Approval...2 User Interface...3 SUNIX s COMLab..4
INDEX WHQL Certification Approval...2 User Interface....3 SUNIX s COMLab..4 1.0 Introduction...5 2.0 Specification..5 2.1 Features 2.2 Universal Serial PCI Card 2.3 RS-232 Specification 2.4 Low Profile
Visual Basic Programming. An Introduction
Visual Basic Programming An Introduction Why Visual Basic? Programming for the Windows User Interface is extremely complicated. Other Graphical User Interfaces (GUI) are no better. Visual Basic provides
Quectel Cellular Engine
Cellular Engine GSM UART Port Application Notes GSM_UART_AN_V1.01 Document Title GSM UART Port Application Notes Version 1.01 Date 2009-11-16 Status Document Control ID Release GSM_UART_AN_V1.01 General
Application Note 2. Using the TCPDIAL & TCPPERM Commands to Connect Two TransPort router Serial Interfaces Over TCP/IP.
Application Note 2 Using the TCPDIAL & TCPPERM Commands to Connect Two TransPort router Serial Interfaces Over TCP/IP. Reverse Telnet or Serial Terminal Server MultiTX feature UK Support March 2014 1 Contents
Programing the Microprocessor in C Microprocessor System Design and Interfacing ECE 362
PURDUE UNIVERSITY Programing the Microprocessor in C Microprocessor System Design and Interfacing ECE 362 Course Staff 1/31/2012 1 Introduction This tutorial is made to help the student use C language
Sending SMS Messages and E-mails
GDW-11 GSM Modem Sending SMS Messages and E-mails AN-0139-ENG rev 3.1 Page 1 Contents 1. Introduction - Sending SMS Messages... 2. Configuring the GDW-11... 3. Configuring Hyperterminal. 4. Method 1- Using
E-i. Section E. Code Formatting. E/D = Enable/Disable T/DNT = Transmit/Do Not Transmit EX/DNEX = Expand/Do Not Expand
Section E Code Formatting E/D = Enable/Disable T/DNT = Transmit/Do Not Transmit EX/DNEX = Expand/Do Not Expand C/DNC = Convert/Do Not Convert E/DNE = Enable/Do Not Enable T/DNT UPC-A Check Digit (E - 1)
Serial Programming HOWTO
Gary Frerking [email protected] Peter Baumann Revision History Revision 1.01 2001 08 26 Revised by: glf New maintainer, converted to DocBook Revision 1.0 1998 01 22 Revised by: phb Initial document release
Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)
Unit- I Introduction to c Language: C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating
APPLICATION PROGRAMMING INTERFACE
APPLICATION PROGRAMMING INTERFACE Advanced Card Systems Ltd. Website: www.acs.com.hk Email: [email protected] Table of Contents 1.0. Introduction... 4 2.0.... 5 2.1. Overview... 5 2.2. Communication Speed...
Web Site: www.parallax.com Forums: forums.parallax.com Sales: [email protected] Technical: [email protected]
Web Site: www.parallax.com Forums: forums.parallax.com Sales: [email protected] Technical: [email protected] Office: (916) 624-8333 Fax: (916) 624-8003 Sales: (888) 512-1024 Tech Support: (888) 997-8267
Keep it Simple Timing
Keep it Simple Timing Support... 1 Introduction... 2 Turn On and Go... 3 Start Clock for Orienteering... 3 Pre Start Clock for Orienteering... 3 Real Time / Finish Clock... 3 Timer Clock... 4 Configuring
RSLinx-Lite PLC Programming software communication interface. RSLinx-OEM Provides DDE capability for Rockwell DDE capable software.
H 1 H. RSLinx is a windows based communication software package developed by Rockwell Software to interface to all of the Rockwell and A-B industrial control and automation hardware. RSLinx comes in a
B&K Precision 1785B, 1786B, 1787B, 1788 Power supply Python Library
B&K Precision 1785B, 1786B, 1787B, 1788 Power supply Python Library Table of Contents Introduction 2 Prerequisites 2 Why a Library is Useful 3 Using the Library from Python 6 Conventions 6 Return values
Cable Guide. Click on the subject to view the information. Digi Cables Building Cables General Cable Information
Cable Guide Click on the subject to view the information. Digi Cables Building Cables General Cable Information Digi Cables Click on the subject to view the information. Digi Connector Options Digi Connector
Animated Lighting Software Overview
Animated Lighting Software Revision 1.0 August 29, 2003 Table of Contents SOFTWARE OVERVIEW 1) Dasher Pro and Animation Director overviews 2) Installing the software 3) Help 4) Configuring the software
Orbit PCI Mk 2 Network Card. User Manual. Part No. 502566 Issue 4
Orbit PCI Mk 2 Network Card User Manual Part No. 502566 Issue 4 Information in this document is subject to change without notice. Companies, names and data used in examples herein are fictitious unless
SA-9600 Surface Area Software Manual
SA-9600 Surface Area Software Manual Version 4.0 Introduction The operation and data Presentation of the SA-9600 Surface Area analyzer is performed using a Microsoft Windows based software package. The
TUTORIAL FOR INITIALIZING BLUETOOTH COMMUNICATION BETWEEN ANDROID AND ARDUINO
TUTORIAL FOR INITIALIZING BLUETOOTH COMMUNICATION BETWEEN ANDROID AND ARDUINO some pre requirements by :-Lohit Jain *First of all download arduino software from www.arduino.cc *download software serial
PC Program User s Guide (01.01.05) 1. Connecting the PC. 2. Installation and Start-up. 3. Programming
Work Off-Line Set up a new database or modify a previously saved database (without being connected to the telephone system). This helps minimize on-site programming time. Work On-Line (connected directly
Experiments: Labview and RS232
Experiments: Labview and RS232 September 2013 Dušan Ponikvar Faculty of Mathematics and Physics Jadranska 19, Ljubljana, Slovenia There are many standards describing the connection between a PC and a microcontroller
Global Monitoring + Support
Use HyperTerminal to access your Global Monitoring Units View and edit configuration settings View live data Download recorded data for use in Excel and other applications HyperTerminal is one of many
SIS-PM / SiS-PM-841 / SIS-PMS User Manual. Table of contents
Silver Shield Power Manager Silver Shield Power Manager 841 Silver Shield Power Manager S (With built-in power supply unit) 2 Table of contents 1. Introduction and features of the SiS-PM/SiS-PM-841/SiS-PMS
Wireless Communication With Arduino
Wireless Communication With Arduino Using the RN-XV to communicate over WiFi Seth Hardy [email protected] Last Updated: Nov 2012 Overview Radio: Roving Networks RN-XV XBee replacement : fits in the
Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.
Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to
- 35mA Standby, 60-100mA Speaking. - 30 pre-defined phrases with up to 1925 total characters.
Contents: 1) SPE030 speech synthesizer module 2) Programming adapter kit (pcb, 2 connectors, battery clip) Also required (for programming) : 4.5V battery pack AXE026 PICAXE download cable Specification:
The Bus (PCI and PCI-Express)
4 Jan, 2008 The Bus (PCI and PCI-Express) The CPU, memory, disks, and all the other devices in a computer have to be able to communicate and exchange data. The technology that connects them is called the
Bluetooth Serial Adapter
RN-BT-SRL-UM Bluetooth Serial Adapter 0 Roving Networks. All rights reserved. RN-BT-SRL-UM-.0 Version.0 //0 USER MANUAL RN-BT-SRL-UM-.0 OVERVIEW Roving Networks offers a variety of Bluetooth serial adapters
