PLCnext on LinkedInPLCnext on Instagram  PLCnext on YouTube Github PLCnext CommunityStore PLCnext Community

  1. Sidnei Marcondes
  2. PLCnext Technology & PLCnext Controls
  3. Tuesday, 24 March 2020

Hello,

I am developing a project based in the SampleRuntime project.

I have used the example of SampleRuntime to read Port Variables from the PLC (SubscriptionService). It is working very well.

But now I would like to write in InPort Variables. 

How is the easy way to write in InPort Variable ? Is there any example ?

Is it possible to use the Subscription Service to write in Variables ?

Thank you 

Sidnei 

 

 

 

Martin PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo

Hi Sidnei,

No, it is not possible to write data using the Subscription service - that service is only for reading data.

You can write (and also read) variables using the Data Access service. The "WriteSingle" method is the simplest way to write to an IN Port variable, but this only writes to one IN port variable on each call. The "Write" method is a little more tricky to use, but it is more flexible.

The following thread discusses some advanced topics around reading and writing GDS port variables from C++:

https://www.plcnext-community.net/en/discussions-2-offcanvas/how-to-access-a-whole-aaa.html

You can ignore the parts of the discussion dealing with Arrays (unless that interests you), but in most examples in that thread I have included read or write operation on a simple Integer variable, so hopefully this will give you an idea of how this can be done.

~ Martin.

Phoenix Contact Electronics Headquarters - PLCnext Runtime Product Management and Support

Sidnei Marcondes Accepted Answer Pending Moderation
0
Votes
Undo

Hi Martin,

I will try this.

Thank you,

Sidnei

  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.