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.

cancel
Showing results for 
Search instead for 
Did you mean: 

using PLC DL_WriteNode function block to write a value to datalayer

using PLC DL_WriteNode function block to write a value to datalayer

Jesse
Established Member

I am working on a SFK-4H demo and trying to use the core came with SFK-4H. to communicate with SFK-4H I need to read and write variables between core PLC and SFK. for the same variable I can read the value using DL_ReadNode even there are some other items under the same variable

Jesse_1-1724262780360.png

however for the same variable when I write a value to it the DL_WriteNode deosn't work. I have tried to use string to include all items into the value of DL_WriteNode and it showed function block error. I alse tried to add one item into the NodeName and write a value to it, and it didn't work either. can someone help me on that and show me how to write a value into a json format?

Thanks,

Jesse_0-1724262723065.png

 

5 REPLIES 5

Sgilk
Frequent Contributor

@Jesse ,

The node in your first image is read-only, so that would explain the write error. I am a bit confused what exactly you are trying to accomplish based on the two images provided.

Jesse
Established Member

@Sgilk,

the same variable can be read and written. since the variables in the SFK-4H program I created are only changed through the data layer by the PLC in the core. the same variable is for an error status and is set in the SFK-4H program and PLC reads that. then like a handshaking signal, the PLC needs to reset the variable for PLC logic.  the variable-25 in the state is used in the read node function and if I assign 25 into the "index" of the save-variable of cmd and assign a value to it. when clicking on the write button from the data layer the variable in the SFK-4H changes. however, when I used the DL_WriteNode it didn't work. I need to know how I can use DL_WriteNode to write a value to this variable same as in the data layer.

Thanks,

 

 

Sgilk
Frequent Contributor

If you expand the metadata under the cmd node, can you provide the type? Since it is an object, you may need to retrieve the type in the PLC and write to the components. I'm unfamiliar with the SFK, but maybe this type is available in the PLC library?

Jesse
Established Member

Thank you Sgilk. however, I don't see this data type in the PLC library "types/smartfunctionkit/backend/variables/cmd/store-variable-double-parameters". I did try using uint32 and didn't work. The main issue is using a PLC function block to assign a value to the follow...

 "index": 0,
    "name": "",
    "value": 0,
    "persistent": false

 

.

Jesse_0-1724676706644.png

 

CodeShepherd
Community Moderator
Community Moderator

The flatbuffer objects of the Smart Function Kit for handling are not part of the standard installation of ctrlX PLC Engineering, as is it is not intended to use them from the PLC. You will need a library including the flatbuffer functions/descriptions to get access. You can get in direct contact via our homepage: https://www.boschrexroth.com/en/de/smart-mechatronix/smart-function-kit-for-handling/ in order to discuss your usecase.

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