Guide to Setup WinCon Drivers
for PCI DAS1200, DDA08/12 under Windows 2000

Rong Zhang

Last updated: 01/18/2002

1. Installation Guide

1) Copy files

Download the drivers in a zip file from http://mr-roboto.me.uiuc.edu/evps/archive/codes/pci_w2k.zip

  Source Folder =>  => Destination Folder Description Notes
pci*.dll matlab\rtw\devices matlab\rtw\c\dos\devices .DLL files for the S-functions in the Simulink blocks  
pci*.tlc matlab\rtw\devices matlab\rtw\c\dos\devices .TLC target files for Target Language Compiler to assist the conversion from Simulink models into C codes by Real Time Workshop  
winlib.mdl matlab\rtw\toolbox matlab\toolbox\rtw Simulink Library file containing the blocks for the boards  
pci*.h wincon3\include wincon\server\include Header files for the generated C Codes  
eg_*.mdl wincon3\example_2k any folder of your choice Example simulink .mdl files to test the boards  

2) Fine tunes

(1) How to change the input option of PCI-DAS1200 from 8 differential channels into 16 single-ended channels?

File Name Line Change from.. ==> ==> ...into Notes
pci12tad.h 106 PCI1200_ADC_SWCONVERT_DIFF5 PCI1200_ADC_SWCONVERT_SINGLE5 Other modes are also available in pci1200.h
pci12tad.h 118 for (i=0;i<8;i++) for (i=0;i<16;i++)   

(2) How to change the range of Sensor Signal (+/-Xss V) and of Conditioned Signal(+/- Xcs V)?
(when different signal conditioners are used.)

A "Block Diagram" in pure text:
(Sensor Signal +/-10V )-->[Signal Conditioner]-->(Conditioned Signal +/-5V)-->[PCI-DAS1200,ADC]
-->(Digital Value 0~0xFFF)-->[Function PCI12_adcInputToVoltage]--> (Voltage Result +/-10V)

The ADC input option should be +/-5(V) for the conditioned signal range:
File: pci12tad.h, line 106, "PCI1200_ADC_SWCONVERT_DIFF5", use Xcs of the conditioned signal.

However, the represented voltage range should be that of the sensor signal (+/-10V) instead the conditioned signal(+/-5V):
File: pci1200.h, line50-51
#define PCI1200_ADC_MIN_VOLT (-10.0)            //-Xss, the minimum value of the Sensor Signal range
#define PCI1200_ADC_MAX_VOLT (+10.0)            //Xss, the maximum value of the Sensor Signal range

2. Overview of Files

Windows 2000 System: MATLAB6, VC6, WinCon3.2, 

- Simulink Library: winlib.mdl {

     PCI-DAS1200 Blocks{
        TAD block: Timer and Analog-to-Digital Conversion{
            -S-function: pci12tad{calling pci12tad.dll}
                - compiled* from pci12tad.c {#include pci12tad.h {#include pci1200pp.h, pci1200.h} }
            -RTW target file: pci12tad.tlc {
                 #include "pci12tad.h" {#include pci12pp.h, pci1200.h}
            }
   
     }
        DA block: Digital-to-Analog{
            -S-function: pci12da: pci12da.dll
                - compiled* from pci12da.c {#include pci12da.h {#include pci1200pp.h, pci1200.h} }
            -.RTW target file: pci12da.tlc{
                 #include "pci12da.h" {#include pci12pp.h, pci1200.h}
            }
        }
/* The Digital-Input block below is yet to be developed....    */
        DI block: Digital Input{
            -S-function: pci12di: pci12di.dll
                - compiled* from pci12di.c {#include pci12di.h {#include pci12pp.h, pci1200.h} }
            -.RTW target file: pci12di.tlc{
                 #include "pci12di.h" {#include pci12pp.h, pci1200.h}
            }
       
}

   
}
    PCI-DDA08/12 Blocks{
        - DA block
            -S-function: pci08da {calling pci08da.dll}
                - pci08da.dll compiled from pci08da.c {#include pci08da.h {#include pci08pp.h} }
            -.RTW target file: pci08da.tlc{
                 #include "pci08da.h" {#include pci08pp.h}
            }
    }

}

3. Notes:

Steps to write a driver

1. Prepare pci*.c, pci*.h, pci*pp.h, pci*da.h, pci*ad.h, pci*di.h, pci*do.h
    - use the "scanbus.exe" under RTX DSK\samples\ to find out the VENDOR_ID, DEVICE_ID and modify the corresponding Plug-And-Play hearder file pci*pp.h.
2. Use the existent block as a template to add blocks for the new board in winlib.mdl. Rename the S-function name.
3. Compile the pci*.c into .dll for the S-Function;
4. Prepare target files pci*da.tlc, pci*ad.tlc, pci*di.tlc, pci*do.tlc for the RTW build process.

About Specifications

- PCI-DAS1200: max 330kHz is for single channel (T_convert = 3ms). for 16 channels, max f_sample ~= 20 kHz

Tricks

- How to add the "tab completion" feature to the command window in W2k? 
Run "regedit'; go to "HKEY_Local_Machine\SOFTWARE\Microsoft\Command Processor\", change the "CompletionChar" to "9".

4. References

- PCI Manuals from ComputerBoards: PCI-DAS1200, PCI-DDA08/12
- WinCon Manuals: 3.02a

5. Appendix

1) Driver files for Windows 95 System: MATLAB5.2, WinCon3.02a, VC5

- Simulink Library: winlib.mdl {

     PCI-DAS1200 Blocks{
        TAD block: Timer and Analog-to-Digital Conversion{
            -S-function: pci12tad{calling pci12tad.dll}
                - compiled* from pci12tad.c {#include pci12tad.h {#include pci1200pp.h, pci1200.h} }
            -RTW target file: pci12tad.tlc {
                 #include "pci12tad.h" {#include pci12pp.h, pci1200.h}
            }
   
     }
        DA block: Digital-to-Analog{
            -S-function: pci12da: pci12da.dll
                - compiled* from pci12da.c {#include pci12da.h {#include pci1200pp.h, pci1200.h} }
            -.RTW target file: pci12da.tlc{
                 #include "pci12da.h" {#include pci12pp.h, pci1200.h}
            }
        }
        DI block: Digital Input{
            -S-function: pci12di: pci12di.dll
                - compiled* from pci12di.c {#include pci12di.h {#include pci12pp.h, pci1200.h} }
            -.RTW target file: pci12di.tlc{
                 #include "pci12di.h" {#include pci12pp.h, pci1200.h}
            }
       
}
   
}
    PCI-DDA08/12 Blocks{
        - DA block: Digital-to-Analog Conversion
            -S-function: pci08da {calling pci08da.dll}
                - pci08da.dll compiled from pci08da.c {#include pci08da.h {#include pci08pp.h} }
            -.RTW target file: pci08da.tlc{
                 #include "pci08da.h" {#include pci08pp.h}
            }
    }

}

- Files needed by RTW build{
    - Target Files: danstime.tlc, danswncn.tlc
    - Template Make File: w95_pci.tmf{
        SYSTEM_TARGET_FILE=danswncn.tlc{
            %include "danstime.tlc"
        }
        CAUTION: Directories Setup
        USER_INCLUDES = "/Ie:\ddk\inc32"
        [ ] danwraps.clb
}

- How to compile? Use a MEX batch file:{
    danmex50.bat{ calling danopts50.bat}
}

[ ] ??? Wincon Library file: danwraps.clb

2) Comparison of W95 and W2k

  Windows 95 Windows 2000
Timer counters on DAS1200 based on a 82C54 chip RTX??
Template Make File w95_pci.tmf nt_msvc.tmf (we don't need to modify it)
System Target File danswncn.tlc wincon.tlc (we don't need to modify it)