The memory card is inserted by default after the startup of the PLC Simulator.
On a real Modicon M340 CPU, the memory card is separated in 2 parts:
-
A part for the OS, where the application is stored persistent (backup/restore mechanism).
-
A part for the application, where the application can store data by using data storage function blocks.
NOTE: The simulator does not simulate the backup/restore part of the memory card.
Not Simulated Features of a Memory Card
The following features of a real memory card are not supported:
Simulated Features of a Memory Card
The following features of a memory card can be simulated for the Modicon M340 CPU:
File Management Function Blocks
The simulator supports the file management function blocks and simulates the generation of the files on the PC.
A directory on the PC simulates the file management part of the memory card. In this directory, the files created by the user application are stored.
The directory used for memory card simulation is either the default one (C:\Documents and Settings\USERNAME\Local Settings\Temp\DataStorage) or the directory used during the last simulation. The last used directory is stored persistent in the registry.
The files written by the application can be accessed by normal tools like an editor or Office tools.
The simulator never deletes the application written files. If an application needs to have a blank empty memory card, the system word %SW93 (Memory Card File System Erasing) has to be used in STOP state of the CPU.
NOTE: There is no tracking of the size and number of files written into the memory card.
Limitations for File Management Function Blocks
-
Error codes generated by these functions/function blocks may be different between PLC simulator and a real CPU.
-
With the PLC simulator, it is not possible to delete a file that is opened (neither with the DELETE_FILE function, nor by FTP command).
It is mandatory to close the file before deleting it, in order to delete the file descriptor.
Trying to delete a file that is opened generates a general error code (-1).
-
The SET_FILE_ATTRIBUTES function is not supported by the PLC simulator.
Trying to call this function generates a general error (-1).
For detailed information about the file management functions/function blocks please refer to the System Block Library documentation.
By default the memory card is inserted at simulator start.
The procedure for removing the memory card is as follows:
Step
|
Action
|
1
|
Set the system bit %S65 (CARDIS).
Result: After a potential card access has finished the Card Acc LED goes out.
|
2
|
Open the context menu by clicking the memory card with the right mouse button.
|
3
|
Select Remove Memory Card....
Result: The virtual front plate shows an empty memory card slot and the CARDERR LED is on.
|
NOTE: Removing the memory card has no influence on the used directory and the files, but the access to the files is disabled inside the simulator.
The procedure for inserting the memory card is as follows:
Step
|
Action
|
1
|
Open the context menu by clicking the memory card with the right mouse button.
|
2
|
Select Insert Memory Card....
Result: A Windows standard file selection dialog opens. The selection is pre-initialized with the last used memory card directory.
Note: The file selection box also has a Write protected check box to insert a write protected virtual memory card.
|
3
|
Proceed with one of the 2 following possibilities:
-
Use the preinitialized directory.
Result: The last removed memory card is inserted.
-
Select another directory.
Result: Another memory card (for example different in content or empty) is inserted.
Result: The CARDERR LED turns off.
|
4
|
Reset the system bit %S65 (CARDIS).
Result: The virtual front plate shows a memory card and the Card Acc LED goes on.
|
Since a directory and its content represent the memory card, exchanging the content of the directory can simulate the exchange of a memory card. This can be done by normal Windows means (cut/copy/paste of files or renaming/moving folders).
By default the memory card is not full at simulator start.
Since there is no size tracking, at any time it is possible to simulate that the memory card is full.
This is done by opening the context menu (right-click the memory card) and selecting the menu command Memory Card Full.
After this menu command is selected:
-
New data writing is not possible.
-
Read accesses are possible.
-
Overwrite actions are possible.
This state is indicated by the check mark in the context menu command.
By default the memory card is not write protected at simulator start.
At any time, it is possible to simulate that the memory card is write protected.
This is done by opening the context menu (right-click the memory card) and selecting the menu command Write Protection.
After this menu command is selected:
This state is indicated by the check mark in the context menu command.
Control Expert adds some restrictions linked with the memory card (for example program modification is forbidden if the card is write protected). The simulator supports these restrictions too.
To simulate the write protection feature the following system bits and words are supported by the simulator:
-
%S65 (CARDIS)
-
%S96 (BACKUPPROGOK)
-
%SW97 (CARDSTS)
NOTE: It is not possible to access the files via an FTP client through the simulator since the files are directly accessible by Windows features.