Modbus /Codesys question

diarant
2012-03-14
2012-03-16
  • diarant - 2012-03-14

    Iam in dead end. Any help would be appreciated greatly.
    Iam new with Codesys and also with modbus so forgive me if this is stupid question.
    I have wago controller and iam trying to move 32 bit signed floating number to panel with modbus connection. If i understand correctly modbus only supports 16 bit words. I think my panel can read automatically four bytes and combine 32 float out of it. Now i need to know how to transform it in codesys.
    Do i have to split float into two words? Is there any samples or libraries or block to do this?
    I guess then i just write those into two following %QW258 and %qw260 or not...

     
  • ndzied1 - 2012-03-14

    If possible, the transforming should be done in the panel, not the PLC. Hopefully the panel has controls for swapping bytes in words and double words for the Modbus driver.

    In the PLC write the value to a double word such as %QD260 (you can't use 258 because it is not divisible by 4). If you. Des to access the individual bytes, use %QB260, %QB261, %QB262 & %QB263.

    If you need to do swapping you can use the overlapping byte addresses to your advantage or look onthe Oscat library for the function you need.

     
  • diarant - 2012-03-14

    Thanks for answer. I need to clear out couple things.
    I can not put anything into %QD. Or i can put i can not seem to read it. So i guess i have to use words.

    About Oscat. i very confused overall how Codesys is working with libraries.
    I did download oscat builning and put it in libraries folder under oscat folder. After that i get many error in Codesys although i have not even use any of this new library items? It is saying something about variables etc. Can you tell me how this libraries work on codesys?
    Another thing is i only found basic Oscat liabrary for s7, twincat and pcworks. Although it says it is tested with Wago and codesys 2.3. I did tried to download basic library 3.3.3 for codesys 3. And when i try to add libraryr to Codesys it says not a valid library use project options.... So do i have wrong version or how can i get Oscat to work with this Wago Codesys 2.3...?
    I found that in this liblary there is blocks that could help me but like i said i did not manage to install it.

     
  • shooter - 2012-03-15

    find yourself on oscat the text version 3.3.3 and you can always use blocks (yes i do realize the functions will give errors.
    you use oscat basic codesys/twincat please.
    it is rather big but should be possible to load.

     
  • diarant - 2012-03-16

    Ok Now i got it. As soon i got Oscat loaded i got easily those blocks working also na dcommunication is now working also.

    Still remains some mystery about Codesys Librarys... Earlier i got that same problem. If i insert library my project gets lots of errors. Although iam not using any elements of that library yet. In other programming environments like Siemens if you just bring library in it doesnt mean you are using it and so it should not effect on anything.
    Does anybody understand what i mean? Any ideas what iam doing wrong?

     
  • shooter - 2012-03-16

    all libraries are compiled
    If any function has same name you have a problem,
    same for variables etc.

    As oscat is very big i mostly use the text version (i know it gives problems as i have to insert a lot of subfunctions) but this way i know exactly what is happening in my program.
    You can cut a lot out of oscat when running but it is more work as the txt version.

     

Log in to post a comment.