IO-Link interfacing


Recommended Posts

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

Link to comment
Share on other sites

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)

 

Link to comment
Share on other sites

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


 

Link to comment
Share on other sites

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

 

 

 

Link to comment
Share on other sites

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.

 

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.