Sei sulla pagina 1di 21

DESCRIPTION The IFD5 is shown in Figure 1.

The front panel of the unit consists of a 50-way IDC header which carries the signals to and from the equipment (1), a red power LED (2) which lights when the unit is connected to the PC and a green active LED (3) which lights when the unit has been recognised by the PC. The rear panel of the unit consists of the USB connector, which carries the signals to the PCs USB port (4) and a power supply socket (5), which is not normally used.

In some cases, two IFD5s are used in unison. In this case, one of the devices will be marked expansion. The marking showing whether the unit is a master or expansion is on the label on the top panel of the unit. The IFD5 and associated software is designed to work with Windows 98 or Windows 2000. The device will not work with older versions of the Windows operating system, since they do not support Universal Serial Bus (USB) technology.

INSTALLATION The IFD5 is normally powered form the PC via USB port, so no external connection is necessary. If however, another USB device is being used which is also taking power from the USB port, then the current limit of the USB may be exceeded. In this case, it will be necessary to power the IFD5 using the power socket (5) on the rear of the unit (9-15V @ 120mA). Ensure that the software supplied with the IFD5 is installed before connecting the interface to the computer (see page 6 for details on software installation). With the PC switched on, connect USB port on the IFD5 (4) to a USB port on the computer, using the USB cable supplied. When connected, the red power LED (2) on the front of the unit should illuminate. The green active LED (3) will also illuminate a short time later. This indicates that communications are established between the IFD5 and the PC. If the active LED fails to light, disconnect the device, wait for about 30 seconds and then try again. If the LED still fails to light, re-start the computer and try again. The PC will then display a message saying that it has found new hardware and the new hardware wizard should find the files it requires automatically. If this does not happen, insert the ArmSoft CD-ROM into the drive, and direct the wizard to look at the CD drive when prompted to do so. Connect the data port on the IFD5 (1) to that on the apparatus using the 50-way ribbon cable supplied. The socket for this on the equipment can be found on the rear of the console for equipment with a separate console or on the side of the plinth for items with integral console (refer to the instruction manual for your apparatus for details). When connecting two IFD5s, it should not matter which device is connected first. However, if the software fails communicate with either of the devices (indicated in the status bar at the bottom of the screen), disconnect one of the IFD5s for about 30 seconds and then re-connect it.

SOFTWARE INSTALLATION To run the Armfield software, users must have access to a PC with the following: Pentium processor or equivalent 16 MB RAM 10 MB hard disk space (per program) SVGA display (800 x 600 high colour) or better USB port CD-ROM drive Microsoft Windows 98 or 2000

The software is supplied on CD-ROM. To install the software use the following procedure: Insert the CD-ROM into the drive. The CD should autorun. If it doesn't, choose 'run' from the 'start' menu and type: d:\setup.exe where d is the letter of the drive you are using. Click 'OK'. Follow the instructions on the screen. Setup will add a group to the start menu for your Armfield software. To run the software, choose the appropriate shortcut from this group.

If the IFD5 is not installed correctly, then it is possible to cause Windows to allow the Armfield device to be connected to the computer without the appropriate driver being installed. This will cause the software to display the message IFD: Device Error in the bottom right-hand corner of the screen. In normal operation this message can be cleared and communications restored by disconnecting and reconnecting the USB cable and/or restarting the software or computer. If these actions do not clear the message, it will be necessary to manually prompt the computer to install the correct driver software, as follows.

Windows 98 On the computer desktop right-click on the My Computer icon and choose Properties. View the Device Manager screen. The Armfield device should be displayed under Universal Serial Bus controllers. If it is not, then there should be a category named Other with a device called Armfield USB Interface shown with a yellow question mark icon. Right-click on this icon and choose Properties. In the Driver screen click the Update Driver button. Windows will show the Update Driver Wizard. Ensure that the Armfield CD is in the drive. Choose for Windows to search for a driver, and select the CD-ROM drive as the location when prompted to do so. Windows will find the driver files from the CD-ROM and install them. Restart the computer. Start the Armfield Software. Data logging should function as normal.

Windows 2000 On the computer desktop, double click on the Unplug/Eject Hardware icon on the taskbar and select the Armfield USB Device. Place the Armfield CD-ROM in the drive. Click the Properties button. View the Driver page and click the Update Driver button. Proceed through the wizard, selecting Search for a suitable driver when prompted and selecting CD-ROM drive as the location. The wizard will install the driver files. Start the Armfield software. The data logging should function as normal.

I/O PORT PIN FUNCTIONS The IFD5 is capable of passing data on 26 channels, as described below: Analogue Inputs 8 differential channels or 16 single ended channels, each with 5V to 5V signals digitised into a 12-bit number. IFD5 will pass a value between 2047 and 2047 to the computer. Analogue Outputs 2 channels, each with 5V to 5V signals, taken from a 12-bit number. Computer must pass a value between 2047 and 2047 to the IFD5. Digital Inputs 8 channels each receiving a 0 or 1. Digital Outputs 8 channels each passing a 0 or 1.

These channels are arranged on the 50-way ribbon cable as shown in table 1 overleaf:

APPENDIX 1 Using third party software to access the IFD5 Installing the Driver Software Insert the CD-ROM into the drive. The program should start automatically, but if autorun is disabled on your computer, go to the start menu, choose run and type d:\setup where d is the letter of your CD-ROM drive. Select the Install Driver Software option and follow the instructions on screen. Under Windows 98, the setup program will create the following files on your computer: Under Windows 2000 these files will be: The first two files tells the computer how to recognise the IFD5 when it is plugged in to the PC, the next two files are the drivers for the IFD5s USB interface and the last file is a library file, used to pass data between the user program and the IFD5 driver. Also included on the CD-ROM are a tutorial on constructing a LabView or Matlab data logger and a test program for checking that the apparatus and IFD5 are functioning properly.

Connecting the Equipment to the PC Connect the IFD5 to the PC and equipment using the procedure on page 5. Run the test program from Start Programs Armfield Data Logger Test Program. Check that the displays show appropriate readings. Refer to the product manual for the apparatus you are using for a list of channel numbers and their functions. IFD5 Driver Function Calls The driver for the Armfield IFD5 data logger is accessed using function calls to the dynamic link library file ARMIFD.DLL. There are four basic calls which can be made to the library file, based on the four types of data I/O described above. These functions must be supplied with a full set of variables of the correct format. All of the variables passed are 32-bit integer types. Read Analogue This call returns a value from one of the analogue channels. The syntax for the call is:

The stdcall directive indicates that the call is handled in a way which is recognisable by most programming languages, including LabView. The channel number should be selected as follows: Channels 0-7 for differential channels Channels 0-15 for single ended channels Channels 16-31 for multiplexed channels (where appropriate)

The value returned will be an integer 2047 corresponding to 5V. A value of 9999 indicates an error. Write Analogues This call sends values to the two analogue output channels. The syntax is:

The values sent should be between 2047 corresponding to 5V. Read Digitals

This call returns the values from one of the eight digital channels. The syntax for the call is:

The return value will be 0 if the channel is off or 1 if the channel is on. A value of -1 indicates an error. Write Digitals This call writes values from the eight digital output channels. The syntax for the call is:

The analogue channels use values between 2047 and 2047, relating to 5V to 5V on the apparatus. The digital channels use either a 0 or a 1 for ON or OFF. There are also several more advanced calls which can be made to the IFD5 driver, as listed below: Set Mode When data is transmitted in single-ended mode, such as on the UOP3cc, the mode must be set to single-ended using the following call: This call sets the mode for the device to either 8 differential channels (Mode = 0) or 16 open-ended channels (Mode = 1). Read Frequency The IFD5 interface incorporates a frequency counter which can measure the frequency of a signal on one of the digital input channels. The syntax for the call is:

The channel number supplied must be between 0 and 7. The first call to this function will initiate counting, while subsequent calls will retrieve the value from the previous count and begin a new count. Each count takes approximately 1 second. Because of this, the counter will give the most

accurate results when the frequency being measured is reasonably stable; there will be a delay in the reading if the frequency is changing. High Speed Data Capture The IFD5 also incorporates a routine for the high speed capture of multiple data points from the first two analogue channels. An array of 2000 point is stored for each channel, sampled at intervals of 0.77 milliseconds. The data capture can be initiated by the software, or can be triggered by one of the digital channels. The required syntax is:

The channel variable determines the trigger mode (0 selects a software trigger, 1 to 8 selects a hardware trigger via the appropriate digital channel). Ch1Data and Ch2Data are array types with 2000 elements each. When using the ReadHS function, it is important that all other communications with the IFD are paused, so as not to interrupt the data capture. If using the ReadFrequency function, it will be necessary to allow a pause of approximately one second before starting ReadHS, to ensure that the frequency count has finished.

C/C++ (Cdecl) Procedures In addition to the above stdcall procedures, the IFD5 driver contains a duplicate set of functions which use the cdecl calling convention. These functions are required when using Matlab to access the IFD5, and it may also be preferable to use them if C or C++ is to be used. The functions are summarised as follows:

There is also the function for setting the mode (8 differential or 16 open ended channels) for the analogue data transfer: The advanced functions for frequency and high speed data capture are also repeated:

Building a Data Logger Using the methods and function calls detailed above it should be possible to construct a data logging or control program in any programming environment which allows calls to dynamic link libraries (.dll files). Examples of such environments include, but are not limited to C, C++, Delphi (Visual Pascal) and Visual Basic. The following pages give procedures for the construction of simple data loggers using Matlab, LabView and Microsoft Excel.

Building a LabView Data Logger This section assumes that the user has a knowledge of the basics of LabView. Load LabView and choose new VI from the initial menu screen. This will give you a blank document in which to work. Alternatively, you could add the data logging facility to an existing VI. Select View Diagram from the window menu. Make sure that the tools palette and functions palette are visible. Accessing the Analogue Input Channels From the functions palette, select Advanced and then Call Library Function. Place the icon on the diagram, and double click on it with the selector tool to access the setup page. Click on the browse button at the top of the page, and locate the file C:\WINDOWS\SYSTEM\ARMIFD.DLL. Click on the Function Name box and type ReadAnalog. Check that Calling Conventions is set to default (StdCall) and that the function is set to Run in UI Thread. Click on the Add a Parameter After button. The parameter area will change, allowing various choices. Name the parameter Channel, set the Type to numeric, set the Data Type to Signed 32-bit Integer and set Pass to Pointer to Value. These settings apply to all of the parameters used by the library file. Repeat this step so that there are two parameters, naming the second one 'Value'. When this is done, click OK to close the page. The icon on the diagram should now have four cells on it, representing the two parameters before and after being passed to the library file. The column on the left contains the input parameters, while the column on the right contains the outputs. Popup (click with the right-hand mouse button) the top left-hand cell and choose create constant. Type 0 in the box that appears. Repeat this step for the second cell in the left-hand column. This means that the channel number and output will be set to zero before passing to the library file. Popup on the bottom cell in the right-hand column and choose Create Indicator. A blue box will appear with the caption Value. Click on View Panel in the window menu to see the front panel. There should be an indicator box present, titled 'value'. Save the VI using the file menu, then click on the run continuously button. The value in the indicator box will update continuously, showing the value being read by the IFD5 on channel 0. If the program fails to run, then is probably an error in the Call Library Function page. Check all of the values and settings on

This procedure can be repeated in order to create indicators for analogue channels as required. Accessing the Digital Input Channels Place another Call Library Function icon on the diagram screen, and edit its settings as before. Locate the library file, and ensure that the calling conventions and run mode are set correctly. Set the Function Name to ReadDigital and specify two parameters to be passed, named Channel and Value, of type numeric, data type Signed 32-bit Integer and pass Pointer to Value. Click OK to exit. On the diagram, create two constants of 0 as before. For the output parameters, we need to convert the value from integer (0 or 1) to Boolean (true or false) data types. One method of doing this is to compare the value to a constant (1). If the values are the same then the result is true, otherwise it is false. On the Front Panel, Select Boolean from the Controls palette, and choose the Round Light indicator. Return to the diagram, and there will be a green box with T F inside it. Move this box so that it is to the right of the Call Library icon. On the Functions palette select Comparison and then Equal?, and place this icon between the other two. Using the wire tool, connect the output from the top right-hand cell on the Call Library Function and connect to one of the inputs to the Equal? icon. Connect the output from the Equal? icon to the input for the T F indicator. Finally popup on the spare input to the Equal? icon and click create constant. Set the constant value to 1. Save the file before running. The LED will light on the screen when the digital channel is switched by the equipment. This can be repeated to build indicators for each digital channel as required, modifying the channel input parameter to view different channels. Writing the Analogue Outputs Create a Call Library Function block as before, with the Function Name set to WriteAnalogs. Define two integer parameters called AO1 and AO2. On the Front Panel create two Digital Control boxes from the Numeric button on the Controls palette. Popup on each of the boxes in turn and select Data Range. Set the representation to Word (I16), the minimum value to 2047, the maximum value to +2047, the increment to 1, and the default to 0. In the If Value is Out of Range box, select coerce. Return to the diagram and connect the outputs from the two controls (labelled I16) to the input parameters on the Call Library Function icon. Save the file

before running. Any analogue outputs on the apparatus (pumps, etc.) will now be set to the values in the boxes. Writing the Digital Outputs Create a Call Library Function block with a Function Name WriteDigitals. Add eight parameters, named DO1 to DO8. On the Front Panel create eight Check Box controls from the Boolean button on the Controls palette. Label these DO1 to DO8. On the diagram go to the Functions palette and select Boolean, then Boolean to (0,1). Place the icon on the diagram next to the DO1 control. Using the wire tool, connect the DO1 control to the input to the Boolean icon and connect the output from the Boolean icon to the top input to the Library Function Call icon. Repeat this for all eight controls. Save the file before running. Any digital switches on the equipment can now be controlled from the computer, by clicking on the appropriate check box. Customising the VI The virtual instrument created using the above procedure can now be customised to fit exactly with the requirements of the experiment being performed. Any of the indicators on the front panel can be renamed or deleted as applicable. Controls can also be renamed, but if you wish to delete a control, remember that each Call Library Function block must have a full complement of inputs before it can run. This means that the deleted control must be replaced with a constant of value 0.

Building an Excel Data Logger This section assumes that the user has a knowledge of the basics of Excel. Load Excel and a new spreadsheet should appear. This will give you a blank document in which to work. Alternatively, you could add the data logging facility to an existing spreadsheet. Note: Excel is very sensitive to the syntax used in the functions described in this section. Errors in the syntax may cause Excel to close and the system to become unstable. Care should be taken to ensure that the formulae are entered correctly before pressing the Enter key, and it is sensible to save your work at regular intervals to avoid losing too much should Excel close unexpectedly. The IFD5 MUST be plugged in to the PC in order for the Excel data logger to work. Accessing the Analogue Input Channels Select the cell where you wish the value from the first analogue channel to be displayed. Enter the following formula: This will setup a call to the ArmIFD.DLL file, using the ReadAnalogs function. The third parameter (2NN!) indicates that the function requires two variables to be passed, and we want Excel to retrieve the first variable in the list. The zero indicates that we wish to collect channel 0 data. For further help on the parameters passed in this function, see Excel help. Copy this formula down for seven further cells, and increment the fourth parameter by one in each successive cell e.g. the second cell down should contain: These eight cells will then update to read the current values from the eight analogue input channels whenever the spreadsheet is calculated.

Accessing the Digital Input Channels Select the cell where you wish the value from the first digital channel to be displayed. Enter the following formula:

This will setup a call to the .dll file to read the first digital channel. Copy the cell down seven further rows, and increment the fourth parameter for each cell as before. Writing the Analogue Outputs Select the cells where you wish to enter the values for the analogue output channels. Enter values of 1024 (50%) in both. In the cells to the right, enter the following formulae (in this example the cells B5 and B6 are used as the entry cells): These formulae take the values from the left-hand cells and send the values to the analogue output channels. In fact, only one of these formulas is required to send the data, but both are included for completeness of display. Writing the Digital Outputs Select eight cells where you wish to enter the values for the digital outpu channels. Enter values of either 0 or 1 in each of the cells (0 for off, 1 for on). In the cells to the right of these, enter the following formula (in this example cells B245 to B32 are used as the entry cells): Increment the first digit of the third parameter by one for each successive cell. As for the analogue output call, it is not actually necessary to repeat this formula eight times, but doing so does confirm the values which are sent. Building a Recalculate Macro The above formulae will get data from the IFD5 whenever the spreadsheet is updated. If automatic data retrieval is required then we must write a macro (a short visual basic function) which will force the spreadsheet to update. Right-click on the toolbars at the top of the screen, and choose the Forms toolbar. Place a button on the sheet. The macro window will appear; click OK to add a new macro. The code editor window will appear, with the module for the spreadsheet in the main window. Replace the code for the button click which you have just generated with the following code:

Insert another button and assign the macro Button2_Click to it. Replace the code for the macro with the following: Save the spreadsheet. The buttons Button1 and Button2 can be renamed Start and Stop respectively. Clicking on the start button will force the sheet to recalculate every 0.5 seconds. Clicking on the stop button will halt this process.

Building a Matlab Data Logger This section assumes that the user has a knowledge of the basics of Matlab. To access the IFD5 from Matlab, you will need access to a C or C++ compiler. It may be possible to use the compiler supplied with Matlab, but this tutorial is based on the Microsoft C++ compiler. Ensure that you have set up your C compiler for use with Matlab using the command: You need to create a text file called ARMIFD.DEF $MATLAB$\extern\include directory, with the following content: in

This defines the functions in the Dynamic Link Library (.dll) file which are to be used by Matlab. Accessing the Analogue Input Channels To access the functions within the .dll we need to create a C program, which can be called from within Matlab. Create a new text file called ANREAD.C in the $MATLAB$\work directory. Enter the following text:

This code defines a function CReadAnalog which returns a value from the IFD5 channel corresponding to the channel number sent. It then defines a long variable to store the answer, and an int variable to act as a loop counter. Using a while loop we check each of the 8 channels in turn, and print the answer onto the screen. Compile and run the program using the command line:

The values from the eight IFD5 analogue channels will be displayed. The range of the values is 2047 corresponding to 5V. Accessing the Digital Input Channels Create a new text file called DIGREAD.C and enter the following code:

This code defines a function which reads the data from the eight digital channels on the IFD5, returned as an eight bit word. It also defines a long variable to receive the result, and an array of eight integers to receive the channel values. The code calls the function, and receives an eight bit word (ans). It then loops through the word, checking whether each bit is a 1 or a 0, and setting the appropriate value in the Digitals array. Compile and run the program as before. Writing the Analogue Outputs Create a new text file called ANWRITE.C and enter the following code:

This code defines a function called CReadAnalogs which takes two long parameters and passes them to the .dll. It then informs the user that the channels have been written. Compile and run the program as before. Matlab will output values of 1024 to each of the analogue outputs (e.g. a pump on the apparatus would rotate at 50% of its maximum speed). Writing the Digital Outputs Create a new text file called DIGWRITE.C and enter the following text:

This code defines a function which passes eight integer parameters to the IFD5 digital outputs. It sets all f the values in the digitals array to 1, sends them to the .dll, and then informs the user that the channels have been written. Set Mode The other function defined on page 12 for use with C or C++ is the SetMode call, which is used to set either differential or single ended data transfer. If the apparatus you are using has 16 single ended analogue channels rather than eight differential channels, it will be necessary to use this function before the data transfer is commenced.

Potrebbero piacerti anche