Michael Walsh

MrPLC Admin
  • Content count

    1801
  • Joined

  • Last visited

Posts posted by Michael Walsh


  1. In response to your point #1: Sysmac Platform = NJ/NX controllers.  So, yes it was mentioned that the FBs only work with the newer controllers.

    My comment was not meant as an attack on your solution, just a note for others that might read this: there are options that Omron offers with the newest platform that do not require adding a PC with custom software to the mix.


  2. From the author:

    The print statement is printing raw bytes as that is the response from the PLC. By default Python’s print will format any printable characters as ASCII, which you can detect by the fact that they are not preceded by the \x statement indicating they are hex. With this in mind the % character is ASCII value hex \x25 and U is ASCII value hex \x55, which leads me to believe it is a process value and the least significant byte is noise (hence the 55 vs 57 difference from the memory table). Normally the programmer would slice the bytes that they read off the response and format them the way that the intend to use them (FINS doesn’t know if that hex value is an integer, unsigned integer, real, etc.). If you always want the response in hex, you can use the binascii.hexlify library.


  3. 20 hours ago, MasterConnection said:

    I ended up going this route. Thanks guys. Guess I have found the difference between platforms. Siemens and Rockwell is real simple to achieve this. Wish at least there was a way to write comments in the union array bools.

    You can comment on the bits.  I cannot attach the picture of this as there is something wrong with the website. Go into the global variables after you have created the union and then created the variable of that union type.  Double click in the comment field and a little gray button will show up.  You can then comment the DWORD and all the BOOLS.

    1 person likes this

  4. I received a reply from the author of the library (his email is also in the source code and on the contact page at the link provided above):

    It is all hex according to the memory address designation of FINS so 1234 would be \x04\xd2 and since it is a DM, the bit designation is \x00, so it would be:

     

    mem_area_dm_word = fins_instance.memory_area_read(FinsPLCMemoryAreas().DATA_MEMORY_WORD,b'\x04\xd2\x00')

    print(mem_area_dm_word)


  5. A union will do exactly what you want.  

    I cannot post an image to illustrate it for you (something is wrong with the site), but you can create a Union that looks like this:

    Name                           Base Type

    TestUnion                     UNION

         DWordLevel            DWORD

         BitLevel                   ARRAY[0..31] OF BOOL

     

    Then create a variable (lets call it MyVar) that is of type TestUnion in your global variables.

     

    Then you can do a move DWORD#16#F into MyVar.DWordLevel

    The bits can then be monitored on contacts or coils as MyVar.BitLevel[0] as an example.

     


  6. I am not clear on what you are trying to do here..... is this some kind of custom number format that you are trying to use?  I think what you would need to do with a custom format like this is to create a union.  The union will allow you to look at individual bits as well as a WORD or DWORD value.