ikkefc3 Posted September 26, 2018 Share Posted September 26, 2018 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? Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted September 26, 2018 Share Posted September 26, 2018 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. Quote Link to comment Share on other sites More sharing options...
ikkefc3 Posted October 1, 2018 Author Share Posted October 1, 2018 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. Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted October 2, 2018 Share Posted October 2, 2018 Yes, you should, and then you should create a channel with this setVolt I/O type. Finally have the Set To action of your control change the channel you just created. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.