User`s manual
10 - 9 10 - 9
MELSEC
10 ERROR CODE
*1: Procedures and sample program for increasing the minimum working set area of the PC
The following provides measures for increasing the minimum working set area of the PC when an error of
error code 77 occurs due to MD function execution, and its sample program.
The PC board driver runs using the minimum working set area in the memory area reserved in the
application program. Some application program may use a large area of the minimum working set area. In
such a case, when the minimum working set area for the PC board driver cannot be reserved, an error
code 77 is returned.
If this situation occurs, increase the minimum working set area in the application program before executing
the MD function. (See the following sample program.)
The minimum working set area of 200KB is reserved at startup of the personal computer.
Sample program
This section gives a processing overview for setting a greater size to the minimum working set and
provides sample programs.
(a) Processing overview of sample program
1) Obtain the application program ID by the GetCurrentProcessID function.
2) Using the ID obtained in step 1), obtain the application program handle by the OpenProcess
function.
3) The current minimum and maximum working set sizes can be obtained by executing the
GetProcessWorkingSetSize function.
4) Set a size greater than the minimum working set obtained in step 3) and execute the
SetProcessWorkingSetSize.
5) Release the application program handle by the CloseHandle function.
(b) Sample program: When setting by VB
(Example of min. working set size 1MB and max. working set size 3MB)
Dim id As Long ‘Application program ID variable
Dim ph As Long ‘Application program handle variable
Dim wkmin As Long ‘Minimum working set variable
Dim wkmax As Long ‘Maximum working set variable
‘Obtain the application program ID
id = GetCurrentProcessID()
‘Open the application program handle
‘PROCESS_SET_QUOTA = 256,PROCESS_QUERY_INFORMATION = 1024
ph = OpenProcess(256 + 1024,False,id)
‘Obtain the maximum working set size and minimum working set size of the application program
bret = GetProcessWorkingSetSize(ph,wkmin,wkmax)
‘Set the minimum working set size to 1MB
wkmin = 1 * 1024 * 1024
‘Set the maximum working set size to 3MB
wkmax = 3 * 1024 * 1024
‘Change the maximum working set size and minimum working set size of the application program
bret = SetProcessWorkingSetSize(ph,wkmin,wkmax)
‘Close the application program handle
bret = CloseHandle(ph)
The set sizes shown here are reference sizes. Adjust the sizes in accordance with your system.