i re dsh UNIVERSITY OF HERTFORDSHIRE ert fo r Faculty of Engineering & Information Sciences Department of Engineering and Information Science yo fH MSc in DATA COMMUNICATION AND NETWORKS rsit Project Report Un ive WEB BASED REMOTE OPERATION OF AN RF SPECTRUM ANALYSER Xiaoqiao SUN August 2004
i re dsh A declaration statement as follows: I certify that the work submitted is my own work and that any material derived or quoted form the published or unpublished work of other person has been duly acknowledged (ref. UPR AS/C/6.
i re dsh ABSTRACT The aim of the project is to develop a system to control a HP 8591EM Spectrum Analyser remotely via Internet using a Web browser. The aim, objectives and some background information about this fo r project are introduced. The specifications of the equipments used in this project are described. The system requirements are referred to the minimum requirements with which the system will work properly.
i re dsh ACKNOWLEDGEMENT First of all, I would like to express my deepest gratitude to my Project Supervisor Mr. David Lauder. Before doing this project, I have little knowledge about remote control, Mr. David Lauder gives me fo r lots of beneficial suggestions and continuous guidance through out the duration of the whole project. ert I also want to thank staff of laboratory for their help whenever I needed.
i re dsh CONTENTS ABSTRACT………………………….………………………………………………………………I fo r ACKNOWLEDGEMENT…………………………………………………………………………II CONTENTS….……………………………………………………………………………………III LIST OF FIGURES...………………………………………………………………………………V ert LIST OF TABLES….………………………………………………………………………………V fH Chapter 1: INTRODUCTION 1.1 Background……………………………………………………………………………………..1 1.2 Aim and Objectives……………………………………………………………………………..1 yo Chapter 2: SYSTEM SPECIFICATION 2.1 Hardware Specification……………………………………………………...………………….4 2.1.
i re dsh 4.2.4 IEEE 488 Shake Hands…………………………………………………………………20 4.2.5 Bus Properties…………………………………………………………………………..21 4.3 Communication between Server and Client…………………………………………………...21 4.3.1 Transmission Control Protocol (TCP)…………………………………………….……22 4.3.2 User Datagram Protocol (UDP)………………………………………………………...22 fo r Chapter 5: SYSTEM SETTING 5.1 Introduction and Configuration of PC-LAB GPIB Card……………………………………...24 5.1.1 Switch and Jumper Setting……………………………………………………………...24 5.1.
i re dsh LIST OF FIGURES 1.1 Structural Diagram of Project 2.1 HP 8591 Spectrum Analyser 2.2 PC-Lab GPIB Card fo r 2.3 HP 10833A GPIB Cable 3.1 Design of sgpib driver 3.2 Data Flow of sgpib driver 4.2 IEEE 488.1 Shake Hands ert 4.1 IEEE 488.2 GPIB connection between Linux and the Spectrum Analyser 3 6 8 8 17 17 19 21 23 5.1 Location of switches and jumpers 24 fH 4.3 The conceptual layering of UDP and TCP above IP 5.2 IRQ setting (JP3) 6.1 Recovered data trace 34 34 rsit yo 6.
i re dsh Chapter One: INTRODUCTION fo r This chapter gives the basic information of this project, such as Internet, TCP/IP and client/server architecture. In addition, the aim and objectives of the project are also introduced. 1.1 Background The Internet has enjoyed fabulous development in recent 20 years, people showed tremendous ert interest on it, and lots of engineers are trying to make the Internet more convenient.
i re Internet applications, such as Web and this project, are based on the concept of client/server architecture. Client/server architecture is a kind of network architecture in which each computer or dsh process on the network is either a client or a server. Clients rely on servers for resources, such as files, devices, and even processing power. The client/server architecture is not one-to-one.
i re dsh IEEE 488.2 GPIB Connection HP 8591EM Spectrum Analyser fo r Server with GPIB Interface Figure 1.1 Structural Diagram of Project Client 1 yo Client 2 fH ert Internet The objectives of this project were: Create client software to control the Spectrum Analyser via the Internet. The trace data should be obtained from the Spectrum Analyser and it should be displayed as a spectrum rsit plot on the client’s Web Browser.
i re dsh Chapter Two: System Specification In this chapter, all required Hardware and Software system requirements and specifications are listed. fo r 2.1 Hardware Specification In this project, a server machine, client machine and HP 8591 EM Spectrum Analyser are required. Both server machine and client machine must have an Internet connection, and the server and the fH 2.1.1 Server Hardware Specification ert Spectrum Analyser must be connected by GPIB interface.
Matrox: G450/G550 i re nVidia: GeForce 4, GeForce FX dsh ISA plug & play cards ISA plug & play cards may have to be configured manually. (SUSE Linux desktop system fo r requirement, 2004) For this project, Internet connection or Modem is also required. ert 2.1.2 Client Hardware Specification To achieve the objectives of the project, the client machine required a computer, which is connected to the Internet and can use Web Browser.
i re 2.1.3 HP 8591 EM Spectrum Analyser dsh HP 8591 EM Spectrum Analyser is provided in the Telecommunication Lab (D416) of the University of Hertfordshire. The Hewlett Packard (HP) 8591EM is a stand-alone, automated EMC pre-compliance analyser that reduces the time it takes to find, measure and document radiated and conducted EMI emissions. It belongs to the 8590EM series of EMC analysers, which do not require fo r an external computer and automation software to perform automated EMC measurements.
400 kHz to 1 GHz 30 Hz RBW 1 kHz RBW -23 dBµV i re Displayed Average Noise Level: -8 dBµV Frequency Response: 9kHz to 1GHz: ±1.5 dB Input: 50W type N Cal Output: 50 W BNC -20 dBm 300 MHz ert Rear Panel Connector fo r Input/Output Front Panel Connectors dsh Earphone: 1/8" monaural jack Interface: GPIB High Sweep In/Out: BNC, high TTL = sweep Aux Video Out: 50W BNC, 0-1 V Aux IF Output: 50W BNC, -10 to 60 DBM, 21.4MHz Ext.
i re dsh The details about HP 8591 EM Spectrum Analyser commands are given in section 6.1. 2.1.4 GPIB Card Specification The PC Lab GPIB Card can be found in Telecommunication Lab (D416), it is used to connect the fo r Spectrum Analyser with the Server. The PCL-848A/B MULTIFUNCTION IEEE-488 INTERFACE CARD can communicates with over 2000 instrument products, made by over 200 manufacturers, in over 14 countries.
i re dsh 2.2 Software Specification 2.2.1 Server Software Specification Operating System: SUSE Linux ver 8. Program Complier: GNU cc. GPIB Driver for Linux: sgpib. fo r ert 2.2.2 Client Software Specification Internet Explorer 4+ or Netscape Navigator 4+ Borland JBuilder 3.0 fH Un ive rsit yo The reasons of selection of Operating System and program language will be described in Chapter 3.
i re dsh Chapter Three: Project Environment Selection This chapter will explain the reasons of that author select those hardware and software listed in chapter 2. fo r 3.1 Server Operating System Selection ert 3.1.1 Introduction to Linux Linux was originally conceived as a freely distributed UNIX clone operating on PCs equipped with 386, 486 or more advanced processors.
i re Buffer cache: a memory area reserved to buffer inputs and outputs from different processes, Demand paging memory management: a page is not loaded unless it is needed in memory, Dynamic and share libraries: dynamic libraries are only loaded when they are needed and dsh their code is shared if several applications are using them, File systems which can equally well manage Linux file partitions used by filesystems such as Ext2 as partitions having other formats(MS-DOS, ISO9660 etc.
i re Linux is secure and versatile: The security model used in Linux is based on the UNIX idea of security, which is known to be dsh robust and of proven quality. But Linux is not only fit for use as a proxy server against the attacks from the Internet, but also it will be adapted to other situations. With Linux your computers and network will be as secure as your firewall.
i re Linux is free: Is it a disadvantage? But most of people will ask the question, is an Open Source and free product dsh trustworthy? The current situation will answer it. If Linux were not trustworthy, it would have been long gone, never knowing the popularity it has now, with millions of users. After long periods of testing, most Linux users come to the conclusion that Linux is not only as good, but in many cases fo r better and faster that the traditional solutions. (Garrels, 2002) 3.1.
i re serve as the base on which the language’s functionality is built. You might think that a language with more keywords (sometimes called reserved words) would be more powerful. programming task. dsh This isn’t true. As you program with C, you will find that it can be used to tackle any C is modular. C code can (and should) be written in routines called functions. By passing pieces of information to the functions, you can create useful, reusable code.
i re dsh 3.4 GPIB Card Selection Three GPIB Cards are available in Telecommunication Laboratory (D416) of the University of Hertfordshire: Agilent 82350B PCI GPIB Interface Card Varian GPIB Card PCL-848A/B Multifunction IEEE-488 Interface Card fo r ert Both Agilent GPIB Card and Varian GPIB Card are not suitable for this project. Agilent GPIB Card only support Windows 98/Me/NT/2000/XP, so it useless in this project. In addition Varian GPIB Card also can not be driven in Linux Machine.
i re programmable. It has automatic initialization. Interface parameters are set to default automatically when dsh starting using the interface. Parameters can still be changed by calling the initialization routine. Its DIP switch selectable wait states (0/2/4/6 wait states) to ensure the compatibility to very high speed PC’s. Its PCL-848A offers the connectors of the IEEE-488 standard white PCL-848B uses the 25 fo r pin D type connectors for the IEC-625 standard.
i re dsh fo r ert fH Un ive rsit yo Figure 3.1 Design of sgpib driver Figure 3.
i re Advantages of sgpib driver No configuration needed (except io/irq for ISA-Version) No insmod needed for embedded systems when linked to the kernel No library needed. ASCII commands can be written with echo/write()/puts to the device. Freeware (GPL).
i re dsh Chapter Four: COMMUNICATION fo r This chapter will describe two different communications in the project. One is the communication between server and the Spectrum Analyser, the other is the communication between server and client. 4.1 Overview To control the Spectrum Analyser from client via the Internet, there are two types of connection ert need to be concerned. Client make a TCP/IP connection to server, once the connection has built, client can send control message to the server.
i re quickly gained popularity, because of its high transfer data rate (nominally 1 bytes/s). In 1975, it was later accepted as IEEE Standard 488-1975, and in 1987 it has evolved to ANSI/IEEE Standard dsh 488.1-1987. ANSI/IEEE 488.2-1987 enhanced and strengthened 488.1-1987 by defining precisely how controllers and instruments communicate. In addition, Standard Commands for Programmable Instruments (SCPI) took the command structures defined in IEEE 488.
i re dsh fo r ert Figure 4.2 IEEE 488.1 Shake Hands (GPIB Tutorial, 2000) 4.2.5 Bus properties Up to 15 instruments, called devices, can be connected to one computer, usually called fH controller, because it is responsible for coordinating bus traffic. Specified transfer rate: 1 MByte per second Cable length: 20m between controller and one device or 2m between each device.
i re The TCP/IP protocol suite comprises two protocols that correspond roughly to the OSI Transport dsh and Session Layers; these protocols are called the Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP). fo r 4.3.
User Datagram (TCP) (UDP) dsh Reliable Stream i re Application Internet Protocol (IP) fo r Network Interface Figure 4.3 The conceptual layering of UDP and TCP above IP ert When using UDP to transport datagrams, some possible errors may occur. Datagrams are discarded, when router’s buffer is full. The sender will not receive error fH information. Datagrams are discarded, if datagrams cannot reach the destination. ICMP message will be sent, if the datagrams pass by router.
i re dsh Chapter Five: SYSTEM SETTING fo r This chapter will introduce the whole process about system setting including: the installation of PCL 848A/B GPIB Card, and its initial settings, and the installation and configuration of sgpib driver. 5.1 Installation and Configuration of PC-LAB GPIB Card ert 5.1.1 Switch and Jumper Setting The PCL 848A/B GPIB Card has two DIP switch (SW1 and SW2), one slide switch (SW3) and three jumpers (JP1, JP2 and JP3).
i re dsh 5.1.2 I/O Base Address and Wait State Setting The I/O ports base address and the numbers of wait states are selectable by the 8 position DIP switch SW1. This card takes 16 addresses of I/O port following the base address. The digital output port takes the addresses of BASE+0 and BASE+1 and the IEEE-488 interface takes the addresses fo r from BASE+8 to BASE+15. The default address of the IEEE-488 interface is hex 2B8.
i re dsh 5.1.3 Operating Mode Setting SW3 is set to select operating mode. When it is set to “A”, this card is compatible with the easy-to-use PCL-748 IEEE-488 interface card except there is no real time clock. When SW3 is set fo r to “N”, this card becomes NI PC-II compatible. For this project, SW3 is set to “A”. ert 5.1.4 DMA Level Setting DMA (Direct Memory Access) is permitted by the PCL-848A/B GPIB Card. The DMA level is set by JP1 and JP2.
i re Selection Default setting SW1 1-5 I/O port base address Hex 2B0 SW1 7-8 Wait states 0 SW2 Firmware base address SW3 Operating mode JP1 DACK level JP2 DRQ level JP3 IRQ level dsh Jumper/Switch Hex D000 A 1 fo r 1 7 ert Table 5.3 the factory of default setting of PCL -848A/B GPIB Card 5.2 Installation and Configuration of sgpib Driver fH Installation is simple, just run following commands in the folder of GPIB Driver.
i re dsh Chapter Six: SPECTRUM ANALYSER CONTROL fo r This chapter described how to control Spectrum Analyser from the server machine. Sgpib programming commands and some useful Spectrum Analyser programming commands will be described. 6.1 HP 8591 EM Spectrum Analyser Programming Commands Because there are hundreds of programming commands, author only lists some commands which ert used in this project. See total Programming Commands in 8590 Series Programming Compatibility Guide (2001).
i re NR (next right) moves the active marker to the next signal peak of higher frequency. dsh NL (next left) moves the active marker to the next signal peak of lower frequency. SNGLS (Single Sweep): Sets the spectrum analyzer to single-sweep mode. SP (Span): Changes the total displayed frequency range symmetrically about the center fo r frequency. Specifying 0 Hz enables zero-span mode, which configures the spectrum analyzer as a fixed-tuned receiver.
i re The setting of the MDS command determines whether the trace data is transferred as dsh one or two 8-bit bytes. TDF M TDF M is the measurement data format. The measurement data format transfers trace data in measurement units, and the measurement data can range from 32768 to fo r +32767. TRA/TRB/TRC (Trace Data Input and Output): The TRA/TRB/TRC commands provide a ert method for returning, storing or changing the 16-bit trace values.
i re MTA: Set Controller to Talker MLA: Set Controller to Listen REN: Remote Enable TALK : Set device address as talker UNL: Unlisten UNT: Untalk fo r ert fH Shortcuts for above commands dsh RECEIVE : same as “MLA TALK ”, this command is used to start receiving the yo data from the specified address (GPIB device). SEND : same as “MTA LISTEN DATA ”, this command is used rsit to send the data to specified address (GPIB device). 6.
i re To set the Start Frequency dsh c460-00:~ # echo “MTA LISTEN 18 DATA ‘FA 100MZ’”| cat -> /dev/gpib0 or shortcut as: c460-00:~ # echo “SEND 18 ‘FA 100MZ’”| cat - > /dev/gpib0 fo r FA is a Spectrum Analyser command used to set the Start Frequency. In this case, the Start Frequency is set to 100 MHz.
i re ID is a Spectrum Analyser command used to ask Spectrum Analyser return model number to Analyser.
i re ert fo r dsh The trace displayed on the Spectrum Analyser screen is shown below: fH Figure 6.1 the spectrum plotted on the Spectrum Analyser screen The acquired data point should be 401 points and by using which, the whole spectrum can be Un ive rsit points: yo recovered. However, author only acquire 17 data points. The recovered data trace with 17 data Figure 6.
i re fo r 7.1 Introduction to TCP Socket Programming dsh In this chapter, TCP and socket programming is introduced, which used to transfer message between the server and the client. And the server program is explained. In this project, TCP and socket programming are used to transfer messages between the server and the client. The following system functions are used for programming, and will be introduced ert respectively. fH socket #include #include
dsh SOCK_RDM: Not implemented i re SOCK_SEQPACKET: Only used in AF_NS protocol The third argument is the protocol number. fo r bind #include #include ert int bind(int socket, struct sockaddr *my_addr, int my_addr_length) The bind function is used to associate a process with a socket. In this project, bind function is used in server processes to set up a socket for incoming client connections.
i re send & recv dsh #include #include int send(int socket, void *buf, int buf_len, unsigned int flags); fo r int recv(int socket, void *message_data, int message_data_len, unsigned int flags); The send and recv functions are used to send/receive messages to/from a connected socket, which has been connected to a socket using a call to connect.
i re sin.
i re dsh In this chapter, the conclusion is drawn. The achievements and the problems author met during the project processing are mentioned as well as solutions. In addition, some further works are suggested. 8.1 Conclusion fo r This report introduced all related information about this project step by step by using simple langurage, so any no-technique person can understand complete concepts. ert There are so many options of Operating Systems, Programming languages, GPIB cards, and GPIB drivers.
i re Internet. dsh The following are the achievements: Comparison and selection of Operating System, programming language, GPIB card and GPIB driver. The GPIB Card has been installed and configured properly. The Spectrum Analyser can be fully controlled on the Linux (server). Any commands can be fo r send to the Spectrum Analyser by using sgpib commands, and the results can be received.
i re install -o root -g root -m 755 gpib.o /lib/modules/$$REL/kernel/misc; install -o root -g root -m 755 kpci.o /lib/modules/$$REL/kernel/misc; dsh install -o root -g root -m 755 pc488.o /lib/modules/$$REL/kernel/misc; Problem 3, server cannot receive response from the Spectrum Analyser. fo r When author testing the driver, the server only can send commands to the Spectrum Analyser, but cannot receive anything from the Spectrum Analyser.
REFERENCES 42 ert fH yo rsit Un ive fo r dsh i re
i re 8590 Series Programming Compatibility Guide (April 2001) [Online], [Accessed 25th May 2004]. Available from: dsh fo r 8591 EM EMC Analyzer, 9KHz to 1.8GHz (1995) [Online], [Accessed 25th June 2004]. Available from:
i re [online], [accessed 24th June 2004]. Available from: dsh Programmer’s Guide HP 8590 E-Series and L-Series Spectrum Analyzers and HP 8591C Cable TV Analyzer (June 1995) [Online], [Accessed 2nd June 2004]. Available from: :
i re dsh Aitken, P. & Jones, B. L. (1997) Teach Yourself C in 21 Days (4th ed). Indiana: SAMS. Chen, C. (2002) C++ Builder. Beijing: China Railway Publishing House. Coulouris, G., Dollimore, J. & Kindberg, T. (2001) Distributed Systems: Concepts and design (3rd ed). fo r London: Pearson Education Limited. Deitel, H. M. & Deitel, P. J. (2001) The Complete C++ Training Course (2nd ed). Beijing: Publishing ert House of Electronics Industry Eckel, B.
i re V_ID=-11144.0.00&LANGUAGE_CODE=eng&CONTENT_KEY=1000000379-1%3aepsg%3 Un ive rsit yo fH ert fo r Zhang W. (2002) Linux Programming Instances. Beijing: BHP. dsh aman&COUNTRY_CODE=US&CONTENT_TYPE=AGILENT_EDITORIAL> APPENDIX: /* server.
i re dsh #include #include #include #include #include int port = 8000; ert fo r void main() { struct sockaddr_in sin; struct sockaddr_in pin; int sock_descriptor; int temp_sock_descriptor; int address_size; char buf[16384]; int i, len; char *spec[3]; char result[]; fH sock_descriptor = socket(AF_INET, SOCK_STREAM, 0); if (sock_descriptor == -1) { perror("call to socket"); exit(1); } bzero(&sin, sizeof(sin)); sin.sin_family = AF_INET; sin.
i re Un ive rsit yo fH } ert close(temp_sock_descriptor); fo r dsh else if (buf=="ID?"){ system ("echo \"SEND 18 \'ID?\'\"| cat - > /dev/gpib0"); printf("Identify HP8591 EM Spectrum Analyser \n"); } else { spec[3]=buf; system("echo \"SEND 18 \'FA %s MZ;FB %s MZ;CF %s MZ;SP %s MZ;\'\"| cat -> /dev/gpib0\n",spec[0],spec[1],spec[2],spec[3]); printf("To control the HP8591 EM Spectrum Analyser at FA: %s, FB: %s, CF: %s, SP: %s \n", spec[0],spec[1],spec[2],spec[3]); system("echo \"RECIEVE 18\"| cat - >
ert fH yo rsit Un ive fo r dsh i re