Posted 4 Mar 2021 Using sysmac studio, i get 4bytes binary data Data[24], Data[25], Data[26], Data[27] like this, the problem is that the 4bytes data represent my float data what can i do with that 4bytes lol If u see below images you can understand my problem.... thank you all, Share this post Link to post Share on other sites
Posted 4 Mar 2021 Have a look at "AryByteTo" instruction. 1 person likes this Share this post Link to post Share on other sites
Posted 4 Mar 2021 Thanks for reply :) if arrbyteto function exist, it would be easy lol Share this post Link to post Share on other sites
Posted 4 Mar 2021 7 minutes ago, Codepark said: if arrbyteto function exist, it would be easy lol It does exist. What controller are you using? What is the Keyence device? Is this EtherNet/IP? 1 person likes this Share this post Link to post Share on other sites
Posted 4 Mar 2021 (edited) 38 minutes ago, IO_Rack said: It does exist. What controller are you using? What is the Keyence device? Is this EtherNet/IP? thanks million again god bless the america actually i am new in this company for the freelancer job and i am used to web/app development lol dealing with this machine friendly code make me come back school lab haha... last, respect for the knowledge of this old-fashion, neccessary-evil language, hard to draw idea AryByteTo Keyence Device : lj-x8000e controller : nx blabla? and yes its EtherNet/ip connection using modem https://www.manualslib.com/manual/1206594/Omron-Nj501-1500.html?page=506 gosh this make me feeeel soooo comfort.... thanks millionnnnn do u have any problem doing some work or other part lol will help u whatever i can do... thanks again!! ah can u recommend some ways to study dealing with sysmac studio with stl language? Edited 4 Mar 2021 by Codepark Share this post Link to post Share on other sites
Posted 4 Mar 2021 (edited) 4 hours ago, Codepark said: can u recommend some ways to study dealing with sysmac studio with stl language? I have found the help menu in Sysmac Studio to be quite thorough. If you are trying to work out how to code a particular function/function block, find it in the help menu, and have a look at the structured text examples for that function/function block. If you are referring to some sort of reference material for ST coding generally, I haven't found anything comprehensive yet. If I have a specific problem that I can't find in the help menu, I normally check the forums and/or contact my Omron tech. Edited 4 Mar 2021 by BE Spelling 1 person likes this Share this post Link to post Share on other sites
Posted 4 Mar 2021 www.omronlearning.com for some basic intro to Sysmac classes... Omron also offers in person and virtual training classes. 1 person likes this Share this post Link to post Share on other sites
Posted 4 Mar 2021 its been really long time since i had access to Omron but... there may be (should be) option to use union. basically it is a special construct that has more than one variable type of same size. so in this case you could create one with 32bit data exposed as both integer and float. then you can write the integer (4 bytes) and read other (float) or the other way around. it is really just bit-by-bit copy but with different data type. 1 person likes this Share this post Link to post Share on other sites
Posted 5 Mar 2021 Union only works with BIT, BYTE, WORD, DWORD, LWORD. Not Integer or Float. 1 person likes this Share this post Link to post Share on other sites
Posted 5 Mar 2021 You're better off looking at the Ethernet IP manual for the device you are communicating with and creating a structure that matches it and using that as your EIP variable. a byte array is a good way to test comms quickly and check that you are getting data from the EIP device but it is much easier to make a structure than convert every byte(s) into the necessary data you're trying to work with. Programming -> Data -> Data Types -> Structures Create a new one that matches the instance you are reading, should be well documented in the manual for the target device 1 person likes this Share this post Link to post Share on other sites