Accesing variable value from protcol


ikkefc3
 Share

Recommended Posts

Hi all,

I want to use a variable value component to write a command and a (voltage) value to my serial device.

I mad a new protocol for that. Sending static values in the command string from the protocol works ok, but I of course want to send the variable value from the component.

At the action tab of the component I have set "action" to the Set To mode.

My question is: How can I acces this "Set To" value in my device protocol? What is the variable name (or handle) it sends when you click the variable value component and change the value?

Link to comment
Share on other sites

Did you create an actual protocol driver, or just write a sequence?  It is often easier to just create a sequence unless you plan on reusing the code across many applications.  If you did a protocol driver,  probably the easiest thing to do is put that code into an output I/O type, then create a channel with that I/O type.  Then you can use the SetToValue variable in your script to set the appropriate value.  In the screen component you would set the Set To Channel to a channel you created with that I/O type.  See section 15.2.2 in the user's guide.  Feel free to post or email what you have so I can give a more detailed answer.

Link to comment
Share on other sites

On 9/26/2018 at 6:57 PM, AzeoTech said:

Did you create an actual protocol driver, or just write a sequence?  It is often easier to just create a sequence unless you plan on reusing the code across many applications.  If you did a protocol driver,  probably the easiest thing to do is put that code into an output I/O type, then create a channel with that I/O type.  Then you can use the SetToValue variable in your script to set the appropriate value.  In the screen component you would set the Set To Channel to a channel you created with that I/O type.  See section 15.2.2 in the user's guide.  Feel free to post or email what you have so I can give a more detailed answer.

Firstly, thank you for replying so quickly!

I created a new ddp file for this. It has an I/O type in it called setVolt, which is a numeric output.
In the function I have:

private string dataout = "VSET1:" + DoubleToStr(VoltValue)
private string datain = Poll(dataout,10)
return(StrToDouble(datain))

I want have a variable value-field on my dashboard with an action set to.

My question is: how do I get the "Action -> Set to" value into VoltValue in the code above? As I understand from your answer, I should name VoltValue in my code SetToValue

I must admit that I solved it in the meantime by creating seqeunces, but I think making a protocol would be nicer.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share