Applies To
GC5050, GX5050, GX5055, GX5150, GX5280, GX5290, GX5290e, GX5295
Purpose
Saves steps to a DIO file from the specified Master board and its Slaves.
Syntax
DioSaveFile (nMasterHandle, szFileName, dwStart, pdwSize, pnStatus)
Parameters
Name |
Type |
Comments |
nMasterHandle |
SHORT |
Master board handle. |
szFileName |
LPSTR |
The destination file name for the results. The file format used is the DIOEasy3.0 default file format. |
dwStart |
DWORD |
Starting step. |
pdwSize |
PDWORD |
Number of steps to load. When 0 is used, all the memory steps are saved. Upon return, the variable holds the number of steps actually saved to the file. In GX5150 the current step width is used. |
pnStatus |
PSHORT |
Returned status: 0 on success, negative number on failure. |
Comments
This function saves data starting at step dwStart until dwSize steps are saved in file szFileName.
The board(s) must be in the HALT state before calling this function, otherwise the function returns an error.
The default DIOEasy3.0 file format is used by this function. Once the file is saved it can no longer be read by DIOEasy1.x, although version 1.x files can be loaded. After the function is called, the program counter is set to zero.
The function also saves the control memory for each step, as well as the current board setting.
Example
The following example initializes the Master board and its Slaves, loads a DIO file, arms, triggers, and waits until the board state is HALT state, then saves the results to a file:
DWORD dwSize=0;
DioInitialize (0, &nMasterHandle, &nStatus);
DioLoadFileVector (nMasterHandle, “busc.dio”, 0, 0, &dwSize, &nStatus);
DioArm (nMasterHandle, &nStatus);
DioTrig (nMasterHandle, &nStatus);
Do
{ DioReadStatusRegister (nMasterHandle, &wData, &nStatus);
}while (wData &0x1C ==0);
// wait to HALT state
DioSaveFile (nMasterHandle, “busxout.di”, 0, &dwSize, &nStatus);
See Also
DioLoadFile, DioCompareFiles, DioGetErrorString