Skip to content

kmu2030/PrintLib

Repository files navigation

PrintLib

PrintLib provides print functions that can be used in simulations with OMRON's Sysmac Studio. When print functions are executed in a program running on the simulator, the string is output to the specified file in the virtual SD card. You can also monitor the output in real time by tailing the specified file with PowerShell's Get-Content cmdlet.

If you run the sample program and monitor it in the PowerShell terminal, you will see the following.

Print output example

You can monitor the print output by running the following in the PowerShell terminal.

Get-Content -Path C:\OMRON\Data\SimulatorData\CARD\Memory001\dev\print -wait -tail 0 -Encoding UTF8

The media file can be created and cleared by executing the following.

New-Item -Path C:\OMRON\Data\SimulatorData\CARD\Memory001\dev -Name print -ItemType "File" -Force

Usage environment

The following environment is required to use this project

Sysmac Studio I always recommend the latest version.
PowerShell I always recommend the latest LTS version.

Built environment

This project was built in the following environment.

Sysmac Studio Ver.1.62
Target CPU NX1-9000 Ver.1.50
PowwerShell v7.5.0

The Target CPU can be changed by changing the CPU in PrintLib.smc2 and creating a library. No POUs with restrictions are used.

Usage steps

The print function is used in the following steps.

  1. Reference related libraries in your project
    Reference lib/LogStreamLib.slr and PrintLib.slr in your project.
  2. Registering a singleton variable as a global variable
    Register gPrintSingleton: stfreakjp\develop\PrintContext.
  3. Register the output program to the task
    Register POU/Program/DefaultPrintRunner to the task.

About PrintLib.smc2

PrintLib.smc2 is a project for developing PrintLib. This project will build PrintLib.slr.

About PrintLib.slr

PrintLib.slr is a library for using the print function. To use it, you must also reference the dependent libraries under lib/.

About PrintLibExample.smc2

This is an example of using PrintLib. It can be run as is because it bundles related libraries.

About

Print functions in Sysmac Studio.

Topics

Resources

License

Stars

Watchers

Forks