Dear Community User! We have started the migration process.
This community is now in READ ONLY mode.
Read more: Important information on the platform change.

MauroRiboniMX_0-1704716096486.png

ctrlX Data Layer NRT: read and write basic data using the PLC functions

MauroRiboniMX
Contributor
Disclaimer

We are going to see the basic steps that we need to perform, read and write ctrlX Data Layer NRT variables with the PLC app.

Prerequisites and equipment used
  • Having a ctrlX CORE or ctrlX COREVIRTUAL with version 2.0+
  • PLC app and ctrlX WORKS installed 
  • Basic CODESYS knowledge 
Procedure
Step 1: Open a new PLC project and create some "shared NRT nodes" 

This is pretty standard and has been covered by many guides. The steps are the following: Set up a ctrlX PLC project to publish variables to the ctrlX Data Layer.
Here is the variable which is available in the datalayer and set to number 23 manually.

Easy Variable DatalayerEasy Variable Datalayer

Step 2: Add the right library, setup the project, see the examples

Just for laziness, I create two new PRGs in order to be able to use the examples without changing the variables names: 

Program ConfigurationProgram Configuration 

Now we have to add the right library in the system which is really simple. We just need to:

  1. Go to the Library Manager.
  2. Click on "Add Library".
  3. Select the "CXA_Datalayer" library.
  4. Press OK.

Add the library stepsAdd the library steps

 The library comes with already a lot of examples ready to use. What we need to do is:

  1. Select the library.
  2. Go in "Datalayer_NRT".
  3. Select "_Examples".
  4. Select the needed example and copy the content inside a program to be executed.

Nothing more easy 😎

Find the ExamplesFind the Examples

Step 3: Read and Write Example

Lets start from the read example. I have manually set my variable to 23 using the front-end, just in order to be able to read something!

23 is the number23 is the number

 We have to modify some parts:

  1. First we set the right path.
  2. We are reading a Float32  and the "Value" variable should be declared as a REAL;.
  3. The method to be used should be changed accordingly.
  4. We set the execute to true in order to trigger the function any cycle.

ModificationsModifications

 The Program, once loaded, is able to read the variable.

ResultResult

The same changes have been made to the Write example. 

Write ExampleWrite Example

 

Have Fun 😎

MauroRiboniMX
MauroRiboniMX
Hello, I am Mauro a ctrlX DEVELOPR at night and a̶n̶ A̶p̶p̶l̶i̶c̶a̶t̶i̶o̶n̶ E̶n̶g̶i̶n̶e̶e̶r̶ Product Manager during the day 😎 . Ask me anything about ctrlX AUTOMATION but my best topics are IoT, AI, SDK and Communication!
Must Read
Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist