urdey Posted November 28, 2019 Share Posted November 28, 2019 I have IO=Link device Browser can communicate with device http://192.168.1.250/iolinkmaster/port[4]/iolinkdevice/pdin/getdata and gives Json output {"cid":-1,"data":{"value":"00D1FF00"},"code":200} How I will interface with steps of DAQFACTORY converting value hexadecimal to decimal to be displayed in its page Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted December 3, 2019 Share Posted December 3, 2019 You can use HTTP.Get() to retrieve the output and store it in a string: private string in = HTTP.Get("192.168.1.250", "iolinkmaster/port[4]/iolinkdevice/pdin/getdata") Then I'd just use find() to figure out where it says "value", then get that value. Once you have the hex value as a string, you can prepend 0x in front and use evaluate: private string hex = "00D1FF00" private dec = evaluate("0x" + hex) Quote Link to comment Share on other sites More sharing options...
urdey Posted December 3, 2019 Author Share Posted December 3, 2019 Hi Guru I try to use the sequence as below and begin sequence also command alert message The HTTP error and sequence not running. Thanks Quote Link to comment Share on other sites More sharing options...
urdey Posted December 3, 2019 Author Share Posted December 3, 2019 Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted December 4, 2019 Share Posted December 4, 2019 You didn't follow my example. You don't want http:// in the URL, nor the closing /. It should be just like what I showed, with the IP address alone as the first string parameter, and the path as the second one. Quote Link to comment Share on other sites More sharing options...
urdey Posted December 4, 2019 Author Share Posted December 4, 2019 Hi Guru Thanks for reply HTTP.Get(); private string in = HTTP.Get("192.168.1.250") AL1350.Path ="/iolinkmaster/port[4]/iolinkdevice/pdin/getdata" Find("value","getdata",0) Evaluate("value") private string hex = "value" private dec = evaluate("0x" + hex) How to display value as channel in page since value is temperature in decimal format Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted December 5, 2019 Share Posted December 5, 2019 Don't make "dec" private. Private means the variable is only available inside that script. Instead either make it global, or create a Test D/A channel and set that with the result: myChannel = evaluate("0x" + hex) Quote Link to comment Share on other sites More sharing options...
urdey Posted December 5, 2019 Author Share Posted December 5, 2019 Hi Guru HTTP.Get(); private string in = HTTP.Get("192.168.1.250") AL1350.Path ="/iolinkmaster/port[4]/iolinkdevice/pdin/getdata" Find("value","getdata",0) global string hex = "value" Evaluate("value") myChannel = Evaluate("0x" + hex) while(1) myChannel.query() delay(60) endwhile Command/Alert shows C1040 channel does not have any valid values line 15 uncaught in sequence Temperature values is not updating and showing 0.0000 Regards Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted December 11, 2019 Share Posted December 11, 2019 I'm sorry, but you are still not following my example: private string in = HTTP.Get("192.168.1.250", "iolinkmaster/port[4]/iolinkdevice/pdin/getdata") private index = find(in, "value", 0) if (index != -1) in = mid(in, index + 8, 8 ) myChannel.AddValue(evaluate("0x" + in)) endif That should get you most of the way there, if not all the way. 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.