Applies To
File.
Purpose
Creates or opens a DIO file and returns a handle to access the file.
Syntax
DioFileOpen (szFilename, nMode, pnBoardType, phFile, pnStatus)
Parameters
Name |
Type |
Comments |
szFilename |
LPCSTR |
Pointer to a null-terminated string that specifies the name of the DIO file to create or open. |
nMode |
SHORT |
Specifies the type of access requested for the file, as follows: 0 Read only. If the file does not exist or cannot be found the function call fails. 1 Read and Write. The file must exist. 2 Create, opens an empty file for both reading and writing (see Comments). |
pnBoardType |
PSHORT |
Returns the board type if nMode was set to 0 or 1. If nMode was set to 2, sets the new file to one of the following board types: GX5150 0x20 GC5050 0x30 GX5152 0x40 GX5050 0x50 GX5055 0x55 GX5280 0x60 GX5290 0x70 GX5290e 0x75 GX5295 0x7A |
phFile |
PSHORT |
Returns a handle for later reference with this file (0 for error). The handle is the Master file board. |
pnStatus |
PSHORT |
Returned status: 0 on success, negative number on failure. |
Comments
If the type of access (nMode) is 2 and the given file exists, a “_” will be added in order not to overwrite it. For example, if the file name was “NewFile.dio” its name will be changed to “NewFile_.dio”.
Creating a new file creates a DIO file using the DIOEasy2.0 format, on success (returned status is 0) the file will have the default header information as follows:
● Board Type: GX5150
● Number of Steps: Number of steps. All files have the same number of steps. Default is 16384.
● Number of Channels: Total number of channels for all the boards. Default is 32.
The file will also have a subdirectory with one Master Board (board number 0) and all the default information that comes with it as follows:
Width: |
32 channels |
TriggerMask: |
0xFFFF |
Frequency: |
5e6 |
DEvent: |
0 |
B Clcck: |
5e6 |
DMask: |
0xFFFF |
ExtFrequency: |
2e6 |
PauseEvent: |
0 |
Clock: |
Internal |
PauseMask: |
0xFFFF |
Strobe source: |
Internal |
StrobeTiming: |
10 nSec |
TriggerMode: |
Disabled |
XEvent: |
0xFFFF |
TriggerEvent: |
0 |
XSource: |
External |
GX5150: |
|
||
Direction: |
Input |
|
|
RegisterA: |
0 |
|
|
RegisterB: |
0 |
|
|
Example
The following example creates a DIO file, adds a board and sets the number of steps in the board to 100,000:
SHORT nStatus, hFile, hFileBoard;
DioFileOpen (szfilename, 1, &hFile, &nStatus);
if (hFile!=0 && nStatus==0)
{ DioFileInsertBoard (hFile, 1, &hFileBoard, &nStatus);
DioFileSetNumberOfSteps (hFile, 100000, &nStatus);
}
See Also
DioFileSetNumberOfSteps, DioFileGetNumberOfSteps, DioGetErrorString