background image

Chapter 4:  Programming the AD12-8

Manual Number: 00650-014-4

Page 4-7

Using the Driver with Turbo or Borland C

The following list shows you how to use the driver with Borland or Turbo C.  You may refer to any

of the “C” example programs for further illustration.

A. Include the 

A12DRVC.H

 header in your program.  This simple header provides a function

prototype of the procedure call.

#include “a12drvc.h”

B. Declare the three variables for the driver globally, at the beginning of your program.

int task,params[5],status;

C. Make your assignment to these variables as desired for the function you wish to perform.  See

CHAPTER 5: DRIVER REFERENCE

 for details on each task.

D. Make the call to the driver, passing the offset of each parameter.

a12drv(FP_OFF(&task),FP_OFF(params),FP_OFF(status));

E. Create a project file within the Turbo C environment, and add the name of your program with

the .C extension, and the name of the driver with a .OBJ extension.

F. Select “LARGE”  memory model under the compiler section of the options menu.
G. Compile and link the program.

Using the Driver with Microsoft C

To use the driver with Microsoft C version 6.0, add the following code to your application code as

shown below:

_asm

{

push DS

mov AX,ES

mov DS,AX

}

/* call driver as normal */

a12drv(FP_OFF(&task),FP_OFF(params),FP_OFF(status));

_asm

{

pop DS

}

Содержание AD12-8

Страница 1: ...Model AD12 8 Product Manual MANUAL NUMBER 00650 014 4C...

Страница 2: ...ual in our online Support Library Thank you The information in this document is provided for reference only ICS Advent does not assume any liability arising from the application or use of the informat...

Страница 3: ...Page iv This page intentionally left blank...

Страница 4: ...ts which are not in an as new and re saleable condition are not eligible for credit return and will be returned to the customer Limited Warranty Effective April 1 1998 all products carry a 2 year limi...

Страница 5: ...made by various manufacturers in performing warranty repairs and building replacement products If ICS Advent repairs or replaces a product its warranty term is not extended ICSAdvent will normally re...

Страница 6: ...Cautions and Warnings are accented with triangular symbols The exclamation symbol is used in all cautions and warnings to help alert you to the important instructions The lightning flash symbol is us...

Страница 7: ...Page viii This page intentionally left blank...

Страница 8: ...O 1 5 Interrupt Channel 1 5 Programmable Timer 1 6 Environmental 1 6 How to remain CE Compliant 1 6 Chapter 2 Software 2 1 Software Provided 2 1 Backing up the Master Diskettes 2 1 Hard Disk Installat...

Страница 9: ...er with Turbo Pascal 4 8 Using the Driver with QuickBASIC 4 8 Using the Driver with BASIC 4 9 Chapter 5 AD12 8 Driver Reference 5 1 Using the Driver 5 1 The Point List Concept 5 1 Other Software Featu...

Страница 10: ...s 6 7 AD128_ResetListIndex 6 7 AD128_ClearPointList 6 7 AD128_DelPtListIndexes 6 8 AD128_SetSettleTime 6 8 AD128_GetNextPoint 6 8 AD128_GetIndexPoint 6 9 AD128_GetDirectPoint 6 9 AD128_IRQTerminate 6...

Страница 11: ...and Loading the Counters 8 4 Programming Examples 8 4 Using Counter 0 as a Pulse Counter 8 4 Reading Counter 0 8 4 Programming Examples Using theA12DRV Driver 8 4 TriggeringA D Conversions Periodical...

Страница 12: ...k Diagram 1 4 Figure 3 1 Option Selection Map 3 1 Figure 3 2 Standard BaseAddressAssignments for PC and PC XT Computers 3 3 Figure 3 3 BaseAddress Example 3 4 List of Tables Table 2 1 Configuration Fi...

Страница 13: ...nable Input System Expansion The AD12 8 card may be used alone or it can support up to eight AT16 P or LVDT8 P analog input expansion cards An 8 bit standard LSTTL logic output from the AD12 8 is used...

Страница 14: ...cycle c The writing of a command word to the card That is either updating the gain or channel selection multiplexer on the AT16 P expansion card or the AD12 8 multiplexer Utility Software Utility soft...

Страница 15: ...1 2 5 10 25 50 100 200 500 and 1000 In addition these gains can be software programmed to provide individual gains on a channel by channel basis For thermocouple measurements a cold junction sensor i...

Страница 16: ...ual 5 92 7 5 92 7 287387 7 67 57 7 705 2 17 55837 2 1387 7 7 8 5 7 219 57 5 6 03 5 66 2 8 2 08 21752 7 2 08 7 7 2 6 1 2 1387 23 23 23 23 08 6 7 08 1 6 7 1 1 1 17 55837 9 75 75 2 7 287387 7 287387 2 28...

Страница 17: ...16 P 90 dB when gain 1 125 dB when gain 100 Throughput 35 microseconds maximum Reference Voltage Output Voltage 10 0VDC 0 1VDC at up to 220mA Digital I O Inputs Logic high 2 4 to 5 0 VDC at 0 4mA sour...

Страница 18: ...n CE compliant only CE compliant parts may be used To keep a chassis compliant it must contain only compliant cards and for cards to remain compliant they must be used in compliant chassis Any modific...

Страница 19: ...led A12DRV OBJ All forms of the driver were created using Turbo Assembler by Borland e Sample programs in QuickBASIC B Samples C C Samples and Pascal P Samples f A VisualBASIC Utility driver g A Micro...

Страница 20: ...MPLES Contains the BASIC and QuickBASIC samples as well as the binary and linkable drivers VBWIN Contains the Windows Visual BASIC samples CPPWIN Contains the Windows C samples Configuration File The...

Страница 21: ...ng or as a binary string A decimal string is any string of digits made up of the digits 0 through 9 as follows Decimal format DDDDD e g 768 Hexadecimal strings consist of a string of digits containing...

Страница 22: ...channel is to have automatic gain ranging Note that the AIM 16 gain switches must be set for programmable gain for automatic gain ranging to work properly 0 1 2 3 4 5 6 7 The channel is to be set to t...

Страница 23: ...of a DLL a GBL and a VisualBASIC sample Together these files allow you to access the port and main memory space in a fashion similar to BASIC QuickBASIC Pascal C C Assembly and most other stan dard la...

Страница 24: ...values sent less intuitive All integers in BASIC are signed numbers wherein data are stored in two s complement form All bit patterns must be converted to and from this two s complement form if meanin...

Страница 25: ...TER 1 FUNCTIONAL DESCRIPTION for an understanding of the counter timer configuration and to CHAPTER 8 PROGRAMMABLE INTERVAL TIMER for a description of applications Counter 0 is fully accessible to you...

Страница 26: ...external interrupts The end of conversion interrupt is supported by the AD12 8 software drivers If you desire to use external interrupts then you must supply your own interrupt service routine NOTE T...

Страница 27: ...ing is separate from I O addressing so there is no possible conflict with any add on memory that may be installed in your computer We urge that you carefully review the address assignment table before...

Страница 28: ...be used together addresses overlap H 5DQJH 8VDJH QWHUQDO 6 VWHP 1RW 8VDEOH 7 DUG LVN DPH RQWURO 3DUDOOHO 3RUW 37 XV 0RXVH V QFKURQRXV RPPXQLFDWLRQV 20 V QFKURQRXV RPPXQLFDWLRQV 20 3URWRW SH DUG 7 DUG...

Страница 29: ...ary representation from step 1 3 Note from FIGURE 3 3 that switch position A9 corresponds to the most significant bit in your binary representation For each bit in your binary representation if the bi...

Страница 30: ...ows Calibration and Test All cards are calibrated prior to shipment However periodic calibration of AD12 8 is recom mended to retain full accuracy The calibration interval depends to a large extent on...

Страница 31: ...range These settings are used by the calibration portion of the program 3 Use the arrow key to select option 7 Calibrate A D then press the ENTER key 4 Use the arrow key to select option 1 Adjust Off...

Страница 32: ...r program using the supplied drivers AD12 8 Register Address Map The AD12 8 uses eight consecutive addresses in I O space as follows 5 67 5 5 66 5 81 7 21 5 7 81 7 21 6 5 66 RZ WH ELW LJLWDO 2XWSXW 6...

Страница 33: ...igital output lines whose primary purpose is to select one of eight gains on the AT16 P analog input expansion card Status Register The Status register provides information about the operation of the...

Страница 34: ...AD11 is the most significant bit Base 1 Write A write to this location starts an A D conversion The data written is irrelevant This causes the EOC bit of the status register to go high until the conve...

Страница 35: ...ten first followed by the most significant byte When reading the current count of the counter is read The type of transfer is also set by the control byte Additional information about the type 8253 co...

Страница 36: ...3URJUDP RXQWHU 3URJUDP RXQWHU 5HDG DFN RPPDQG RW0 RW1 These bits select the read write mode of the selected counter 5 5 RXQWHU 5HDG ULWH XQFWLRQ RXQWHU DWFK RPPDQG 5HDG ULWH 6 WH 5HDG ULWH 06 WH 5HDG...

Страница 37: ...es which are defined as follows task The number of the task to perform A reference with a list of tasks for each driver are provided in CHAPTER 5 AD12 8 DRIVER REFERENCE parameters This is an array of...

Страница 38: ...les as desired for the function you wish to perform See CHAPTER 5 DRIVER REFERENCE for details on each task D Make the call to the driver passing the offset of each parameter a12drv FP_OFF task FP_OFF...

Страница 39: ...river globally at the beginning of the program type param_array array 1 5 of integer var params param_array task status integer C Declare the driver function as external in using a prototype declarati...

Страница 40: ...explicitly pass the offset of the array variable CALL A12DRV TASK VARPTR PARAM 1 STAT F To use the program and driver in the environment you must link a Quick Library Perform the following command fro...

Страница 41: ...at offset 0 within the defined segment 40 DRIVER 0 50 BLOAD a12drv bin DRIVER Make your assignment to these variables as desired for the function you wish to perform See CHAPTER 5 DRIVER REFERENCE fo...

Страница 42: ...ample the order could be 15 12 12 11 9 127 1 1 0 etc The order that point addresses are installed in the point list is the order in which you call the driver to install them Each new entry is appended...

Страница 43: ...e buffered TASK 17 Fetch Multiple Points High Performance point list and gains are used but function assignments are not Task Reference Task 0 Initialize This task provides the driver with information...

Страница 44: ...Codes status 0 No error status 1 Invalid task number task 17 or driver not initialized status 2 Invalid base address params 0 0x3f8 or 0x200 status 3 Card does not respond status 15 Voltage range not...

Страница 45: ...not initialized status 3 Card does not respond Example int task params 5 status these are globally declared variables task 1 a12drv FP_OFF task FP_OFF params FP_OFF status call the driver Task 2 Fetc...

Страница 46: ...1 Invalid task number task 17 or driver not initialized status 5 Invalid point address or index Example int task params 5 status these are globally declared variables task 3 params 0 6 fetch point ad...

Страница 47: ...best resolution Input params 0 First point in point address range params 1 Last point in point address range params 2 Gain code to assign Output Data None Error Codes status 0 No error status 1 Inval...

Страница 48: ...int address then the driver will install them in descending order 3 Point addresses that are not on a 16 boundary 0 16 32 48 etc are only meaningful if one or more AT16 Ps or LVDT8 Ps are attached Inp...

Страница 49: ...2 Gain code used ERROR CODES status 0 No error status 1 Invalid task number task 17 or driver not initialized status 3 Card does not respond status 5 Invalid point address or index Example int task pa...

Страница 50: ...t list by TASK 11 SUBTASK 1 2 This task uses two buffers a data buffer and a point gain buffer Both buffers should be integer buffers of the same length The number of conversions must not exceed the l...

Страница 51: ...be reset to the beginning of the point list by TASK 11 2 The initial call to SUBTASK 1 passes a pointer to a data buffer to store he conversion This buffer is used as temporary storage by the driver...

Страница 52: ...s 4 Segment of the packed data buffer address params 5 A D Trigger mode 2 Check for end of interrupt scan 3 Return unpacked data params 1 Offset of data buffer params 2 Offset of point gain buffer par...

Страница 53: ...d counts to be multiplied by 16 if using the bipolar mode and multiplied by 8 if using a unipolar mode 2 Curves are assigned to a point address by calling SUBTASK 2 with the ASCII code of one of the c...

Страница 54: ...sors with 392 alpha and u for sensors with 385 alpha 9 TASK 10 does not initiate any conversions but sets up functions that will be performed automatically whenever conversion are done using tasks 6 7...

Страница 55: ...tus 16 Invalid curve Example int task params 5 status these are globally declared variables task 10 linearize the passed value params 0 1 manual linearization subtask params 1 t for t type thermocoupl...

Страница 56: ...ple and hold settle time Notes 1 SUBTASK 5 is provided to set the sample and hold settle time High speed 80286 80386 and 80486 computers often will start a conversion before the sample and hold has ha...

Страница 57: ...range If a value greater than eight bits is sent the driver will only send the lower eight bits Input params 0 Value to output Output Data None Error Codes status 0 No error status 1 Invalid task num...

Страница 58: ...r Setup Load the given counter timer with a count value and mode Notes 1 For a complete discussion of the counter timers see CHAPTER 8 PROGRAMMABLE INTERVAL TIMER Input params 0 counter number 0 1 or...

Страница 59: ...task 17 or driver not initialized status 8 Invalid counter not 0 1 or 2 Example int task params 5 status these are globally declared variables task 15 params 0 1 counter 1 a12drv FP_OFF task FP_OFF pa...

Страница 60: ...tatus call the driver Task 17 High Speed Conversions Multiple Point Addresses Fetch multiple conversions from the point list using pipelining features of the AD12 8 Notes 1 The point list is used to d...

Страница 61: ...f conversions completed The buffers will contain the conversions and the point gain data respectively Error Codes status 0 No error status 1 Invalid task number task 17 or driver not initialized statu...

Страница 62: ...ter timer number is not 0 1 or 2 9 Invalid mode The counter timer mode does not fall within the range of 0 through 5 10 Interrupt process already set The interrupt process can only be set up once A su...

Страница 63: ...d to use it then use auto configura tion when you initialize the driver All points will be set up for gain and curves and installed in the point list Using the Driver The following are the steps that...

Страница 64: ...return an error if you attempt to convert a point before setting it up with a call to AD128_SetPointConfig Install the desired points into the point list There is a single point list in the system The...

Страница 65: ...fered data acquisition using interrupts AD128_PollScan Performs buffered data acquisition using polling AD128_PostProcess Processes and returns data from a batch process AD128_FetchLastGain Fetches th...

Страница 66: ...ntConfig Function Initializes a range of points for curve scaling gain and units Syntax Visual BASIC AD128_SetPointConfig Byval start as Integer Byval stop as Integer Byval curve as Integer Byval low...

Страница 67: ...than pass zero for the hi and low parameters If a curve is desired then it is recommended that you do not use scaling If values are passed for hi and low then the driver will scale the results after...

Страница 68: ...t up for a given point Syntax Visual BASIC AD128_FetchPointConfig Byval addr as integer curve as Integer low as Single hi as Single units as Integer gain as Integer as Integer C int PASCAL AD128_Fetch...

Страница 69: ...t error AD128_ResetListIndex Function Resets the point list index pointer to the first point in the point list Syntax Visual BASIC AD128_ResetListIndex as Integer C int PASCAL AD128_ResetListIndex Not...

Страница 70: ...ge for the gain used in the preceding conversion the sample and hold circuitry many need extra time to sample This is normally in cases when the gains vary widely from channel to channel Symptoms of a...

Страница 71: ...ed then the fifth entry in the point list is converted Error Codes INVALID_PTR One or more of the return pointers is invalid LIST_ERROR The point location was not found POINT_UNINSTALL The next point...

Страница 72: ...or equal to the values you passed to AD128_IRQScan then the process is complete Error Codes INVALID_PTR One or more of the return pointers is invalid AD128_SUCCESS Operation was performed without erro...

Страница 73: ...n the hWnd parameter than the driver will post a message to that window upon completion of all conversions If you do not wish to use this feature pass a 0 in Visual BASIC or a NULL in C Alternatively...

Страница 74: ...e call to AD128_PostProcess should have identical values for scans convs and index as the call to AD128_ PollScan Error Codes LIST_EMPTY The point list is empty INVALID_CONV The scans and or convs par...

Страница 75: ...CTIVE The card does not respond no EOC AD128_SUCCESS Operation was performed without error AD128_FetchLastGain Function Fetches the last gain code used for a given point Syntax Visual BASIC AD128_Fetc...

Страница 76: ...mmable by jumper selection on the card See CHAPTER THREE HARDWARE CONFIGURATION AND INSTALLATION for details Error Codes INVALID_PTR The gain code pointer is invalid AD128_SUCCESS Operation was perfor...

Страница 77: ...he error decreases for example at 10KHz the error is only 0 3 The frequency range for this function is 0 001 to 100kHz Error Codes AD128_SUCCESS Operation was performed without error INVALID_PTR The p...

Страница 78: ...buffer was empty 16 INVALID_PTR A pointer passed to the driver for returning data was not a valid pointer 17 GAIN_ERROR A gain code passed to the driver was not between zero and eight 18 UNIT_ERROR A...

Страница 79: ...ombination the common mode limit is 10V It s important to understand the difference between input types how to use them effectively and how to avoid ground loops Misuse of inputs is the most common di...

Страница 80: ...area with plated through holes that allow insertion of shunt resistors If an AT16I P multiplexer expansion card is being used pre wired pads are provided on the AT16I P If all the inputs are 4 20mA ra...

Страница 81: ...loose and short to high voltages c Use isolation amplifiers and transformers where necessary There are two types of ground connections on the rear connector of AD12 8 These are called Power Ground and...

Страница 82: ...ter 2 are used to initiate A D conversions if the TMR EXT jumper is in the TMR position Operational Modes The 8253 modes of operation are described in the following paragraphs to familiarize you with...

Страница 83: ...s and decre ments by two for the second part of the wave form Mode 4 Software Triggered Strobe This mode sets the output high and when the count is loaded the counter begins to count down When the cou...

Страница 84: ...HU 3URJUDP RXQWHU 3URJUDP RXQWHU 5HDG DFN RPPDQG RW0 RW1 These bits select the read write mode of the selected counter 5 5 RXQWHU 5HDG ULWH XQFWLRQ RXQWHU DWFK RPPDQG 5HDG ULWH 6 WH 5HDG ULWH 06 WH 5H...

Страница 85: ...ion that you intend to perform You have a choice of loading reading a the high byte of the count or b the low byte of the count or c the low byte followed by the high byte Programming Examples Using C...

Страница 86: ...erval timer is to provide start pulses for periodic sampling The TMR EXT jumper should be in the TMR position You can set up an output frequency by using Task 14 to load Counters 1 and 2 with the requ...

Страница 87: ...The counter is then read and the change in counts is a linear function of the duration of the gate input signal If Counter 0 receives 10 microsecond duration clock pulses 100 KHz the maximum pulse du...

Страница 88: ...mable One Shot except that when the counter is triggered by the gate going high the counter output immediately goes high then goes low for one clock period at timeout producing a negative going strobe...

Страница 89: ...ternal Win32IRQ dll index 1 function DetectIRQ Boolean stdcall external Win32IRQ dll index 2 function SendEOI Boolean stdcall external Win32IRQ dll index 3 In C the library file Win32IRQ lib must firs...

Страница 90: ...ogram needs to continue running while waithing for DetectIRQ a separate thread should be spawned from which to call DetectIRQ The return result is TRUE if an IRQ was successfully detected on the given...

Страница 91: ...OLY and ENTER at the command line The program will then prompt you for the desired order of the polynomial then the number of pairs that you wish to use to generate the polynomial You then enter the d...

Страница 92: ...0 for the negative side and a QUALITY of 0 005131 for the positive side Thus by using two polynomials you have made the positive side very accurate and dramatically improved the negative side Accuracy...

Страница 93: ...W RU RXWSXW 75 287 RXQWHU 2XWSXW 1 RZ HYHO QDORJ URXQG 95 9 P UHIHUHQFH RXWSXW 9 9 3RZHU IURP WKH RPSXWHU XV 75 7 RXQWHU DWH 75 7 RXQWHU DWH 75 287 RXQWHU 2XWSXW 17 QWHUUXSW LQSXW SRVLWLYH HGJH WULJJH...

Страница 94: ...nsigned numbers in the range 32 768 to 65 535 If you wish to input or output an unsigned integer greater than 32 767 then it is necessary to work out what its 2 s complement signed equivalent is For e...

Страница 95: ...995RadiatedRFFieldImmunity EN61000 4 4 1995EFTImmunityforACandI OLines EN 60950 1992 Safety of InformationTechnology Equipment Thetechnicaldocumentationrequiredtodemonstratethisproductmeetstherequirem...

Отзывы: