LOG IN
Help
Search
Browse
Talk

gised-link

no license defined!!!
  • Profile
  • Statistics
  • Activity
  • Blog
  • Home

Activity for gised-link

  • 4 years ago

    gised-link gised-link modified a comment on discussion Runtime πŸ‡¬πŸ‡§

    (for the future me: DO NOT SPAM THE POST BUTTON)

  • 4 years ago

    gised-link gised-link modified a comment on discussion Runtime πŸ‡¬πŸ‡§

    About the MEMCMP/cast in the Compare function: Yes of course a byte per byte comparison is stupid for REAL and also on other types. I was so excited that I forget to remove this commented line of code of my example... shame on me. We aren't far enough πŸ˜…... insertion sort is not that bad but merge sort or quick sort will be really more effective. I am looking to adapt the sort provided in the OSCAT lib to run using a pointer (PVOID) instead of a POINTER TO ARRAY[1..32000] OF REAL. I have some issue...

  • 4 years ago

    gised-link gised-link modified a comment on discussion Runtime πŸ‡¬πŸ‡§

    (for the next me: DO NOT SPAM THE POST BUTTON)

  • 4 years ago

    gised-link gised-link posted a comment on discussion Runtime πŸ‡¬πŸ‡§

    About the MEMCPY/cast in the Compare function: Yes of course a byte per byte comparison is stupid for REAL and also on other types. I was so excited that I forget to remove this commented line of code of my example... shame on me. We aren't far enough πŸ˜…... insertion sort is not that bad but merge sort or quick sort will be really more effective. I am looking to adapt the sort provided in the OSCAT lib to run using a pointer (PVOID) instead of a POINTER TO ARRAY[1..32000] OF REAL. I have some issue...

  • 4 years ago

    gised-link gised-link posted a comment on discussion Runtime πŸ‡¬πŸ‡§

    About the MEMCPY/cast in the Compare function: Yes of course a byte per byte comparison is stupid for REAL and also on other types. I was so excited that I forget to remove this commented line of code of my example... shame on me. We aren't far enough πŸ˜…... insertion sort is not that bad but merge sort or quick sort will be really more effective. I am looking to adapt the sort provided in the OSCAT lib to run using a pointer (PVOID) instead of a POINTER TO ARRAY[1..32000] OF REAL. I have some issue...

  • 4 years ago

    gised-link gised-link modified a comment on discussion Runtime πŸ‡¬πŸ‡§

    Hi everyone, I have taken a look of your examples. In other languages we pass a comparison function as a parameter of the sorting function. This is not (or it is?) possible using ST language. A way to do it may be to create an ABSTRACT FUNCTION_BLOCK FB_Sort with a private Compare and final Sort method. Then in your code you have to create your own FB_Sort_blablabla (example: FB_Sort_REAL) which derivate (EXTENDS) from the abstract FB_Sort. Then you override the Compare method to fit your needs (like...

  • 4 years ago

    gised-link gised-link modified a comment on discussion Runtime πŸ‡¬πŸ‡§

    Hi everyone, I have taken a look of your examples. In other languages we pass a comparison function as a parameter of the sorting function. This is not (or it is?) possible using ST language. A way to do it may be to create an ABSTRACT FUNCTION_BLOCK FB_Sort with a private Compare and final Sort method. Then in your code you have to create your own FB_Sort_blablabla (example: FB_Sort_REAL) which derivate (EXTENDS) from the abstract FB_Sort. Then you override the Compare method to fit your needs (like...

  • 4 years ago

    gised-link gised-link modified a comment on discussion Runtime πŸ‡¬πŸ‡§

    Hi everyone, I have taken a look of your examples. In other languages we pass a comparison function as a parameter of the sorting function. This is not (or it is?) possible using ST language. A way to do it may be to create an ABSTRACT FUNCTION_BLOCK FB_Sort with a private Compare and final Sort method. Then in your code you have to create your own FB_Sort_blablabla (example: FB_Sort_REAL) which derivate (EXTENDS) from the abstract FB_Sort. Then you override the Compare method to fit your needs (like...

  • 4 years ago

    gised-link gised-link modified a comment on discussion Runtime πŸ‡¬πŸ‡§

    Hi everyone, I have taken a look of your examples. In other languages we pass a comparison function as a parameter of the sorting function. This is not (or it is?) possible using ST language. A way to do it may be to create an ABSTRACT FUNCTION_BLOCK FB_Sort with a private Compare and final Sort method. Then in your code you have to create your own FB_Sort_blablabla (example: FB_Sort_REAL) which derivate (EXTENDS) from the abstract FB_Sort. Then you override the Compare method to fit your needs (like...

  • 4 years ago

    gised-link gised-link modified a comment on discussion Runtime πŸ‡¬πŸ‡§

    Hi everyone, I have taken a look of your examples. In other languages we pass a comparison function as a parameter of the sorting function. This is not (or it is?) possible using ST language. A way to do it may be to create an ABSTRACT FUNCTION_BLOCK FB_Sort with a private Compare and final Sort method. Then in your code you have to create your own FB_Sort_blablabla (example: FB_Sort_REAL) which derivate from the abstract FB_Sort. Then you override the Compare method to fit your needs (like comparing...

  • 4 years ago

    gised-link gised-link modified a comment on discussion Runtime πŸ‡¬πŸ‡§

    Hi everyone, I have taken a look of your examples. In other languages we pass a comparison function as a parameter of the sorting function. This is not (or it is?) possible using ST language. A way to do it may be to create an ABSTRACT FUNCTION_BLOCK FB_Sort with a private Compare and final Sort method. Then in your code you have to create your own FB_Sort_blablabla (example: FB_Sort_REAL) which derivate from the abstract FB_Sort. Then you override the Compare method to fit your needs (like comparing...

  • 4 years ago

    gised-link gised-link posted a comment on discussion Runtime πŸ‡¬πŸ‡§

    Hi everyone, I have taken a look of your examples. In other languages we pass a comparison function as a parameter of the sorting function. This is not (or it is?) possible using ST language. A way to do it may be to create an ABSTRACT FUNCTION_BLOCK FB_Sort with a private Compare and final Sort method. Then in your code you have to create your own FB_Sort_blablabla (example: FB_Sort_REAL) which derivate from the abstract FB_Sort. Then you override the Compare method to fit your needs (like comparing...

  • 4 years ago

    gised-link gised-link modified a comment on discussion Engineering πŸ‡¬πŸ‡§

    Float is 32 bit or 4 bytes and is called REAL in the PLC world. Double is 64 bit or 8 bytes and is calle LREAL in PLC world. with your Value size is too small for a Double, so I'm assuming you will send a float/REAL instead. Simply do: MEMCPY(ADR(Clinet_Tx1[8]), ADR(my_REAL_type_value), SIZEOF(my_REAL_type_value)); /// Going deeper on the topic /// With what I see, instead of an array, the best to do is to create a STRUCT type with all your needed fields in it. Like this (create a new DUT file with...

  • 4 years ago

    gised-link gised-link modified a comment on discussion Engineering πŸ‡¬πŸ‡§

    Float is 32 bit or 4 bytes and is called REAL in the PLC world. Double is 64 bit or 8 bytes and is calle LREAL in PLC world. with your Value size is too small for a Double, so I'm assuming you will send a float/REAL instead. Simply do: MEMCPY(ADR(Clinet_Tx1[8]), ADR(my_REAL_type_value), SIZEOF(my_REAL_type_value)); /// Going deeper on the topic /// With what I see, instead of an array, the best to do is to create a STRUCT type with all your needed fields in it. Like this (create a new DUT file with...

  • 4 years ago

    gised-link gised-link posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    Float is 32 bit or 4 bytes and is called REAL in the PLC world. Double is 64 bit or 8 bytes and is calle LREAL in PLC world. with your Value size is too small for a Double, so I'm assuming you will send a float/REAL instead. Simply do: MEMCPY(ADR(Clinet_Tx1[8]), ADR(my_REAL_type_value), SIZEOF(my_REAL_type_value)); /// Going deeper on the topic /// With what I see, instead of an array, the best to do is to create a STRUCT type with all your needed fields in it. Like this (create a new DUT file with...

  • 4 years ago

    gised-link gised-link posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    Arf good point. C programer habbits... I have edited my post

  • 4 years ago

    gised-link gised-link modified a comment on discussion Engineering πŸ‡¬πŸ‡§

    Hi, The simpliest method is to consider your 12 bytes value as "not null terminated" string. When this case appears to me, I declare a byte array of the needed size (in your case 12 bytes) this way: my_arr_value : ARRAY[0..11] OF BYTE; // some array Then when I will write/copy to/from this array, I simply use MEMCPY(dest, source, n) standard function: // copy TCP_Write_0 in my_arr_value // in this case, SIZEOF(TCP_Write_0) must be greater or equal than SIZEOF(my_arr_value) MEMCPY(ADR(my_arr_value),...

  • 4 years ago

    gised-link gised-link modified a comment on discussion Runtime πŸ‡¬πŸ‡§

    Hi, First, do you have a logic analyser (may be integrated inside your oscilloscope)? Such a tool is a game changer when it comes to debug UART/I2C/SPI/... signals. If you can provide some pictures of the SPI signals, this will be perfect. As documented in page 7 of your datasheet, MOSI information are valid/read on the rising edge of the CLK signal. Be sure to "output" some signals with the correct timing (you can do it without slave connected). instead of Mode 0, try another mode just to see what...

  • 4 years ago

    gised-link gised-link posted a comment on discussion Runtime πŸ‡¬πŸ‡§

    Hi, First, do you have a logic analyser (may be integrated inside your oscilloscope)? Such a tool is a game changer when it comes to debug UART/I2C/SPI/... signals. If you can provide some pictures off the SPI signals, this will be perfect. As documented in page 7 of your datasheet, MOSI information are valid/read on the rising edge of the CLK signal. Be sure to "output" some signals with the correct timing (you can do it without slave connected). instead of Mode 0, try another mode just to see what...

  • 4 years ago

    gised-link gised-link modified a comment on discussion Engineering πŸ‡¬πŸ‡§

    Hi, The simpliest method is to consider your 12 bytes value as "not null terminated" string. When this case appears to me, I declare a byte array of the needed size (in your case 12 bytes) this way: my_arr_value : ARRAY[0..11] OF BYTE; // some array Then when I will write/copy to/from this array, I simply use MEMCPY(dest, source, n) standard function: // copy TCP_Write_0 in my_arr_value // in this case, SIZEOF(TCP_Write_0) must be greater or equal than SIZEOF(my_arr_value) MEMCPY(my_arr_value, TCP_Write_0,...

  • 4 years ago

    gised-link gised-link posted a comment on discussion Engineering πŸ‡¬πŸ‡§

    Hi, I don't know what you will do with this 12 bytes number. The simpliest method is to consider your 12 bytes value as "not null terminated" string. When this case appears to me, I declare a byte array of the needed size (in your case 12 bytes) this way: my_arr_value : ARRAY[0..11] OF BYTE; // some array Then when I will write/copy to/from this array, I simply use MEMCPY(dest, source, n) standard function: // copy TCP_Write_0 in my_arr_value // in this case, SIZEOF(TCP_Write_0) must be greater or...

1
CODESYS Group | We software Automation.
The CODESYS Group is the manufacturer of CODESYS, the leading hardware-independent IEC 61131-3 automation software for developing and engineering controller applications. CODESYS GmbH
A member of the CODESYS Group
Memminger Straße 151, 87439 Kempten
Germany
Tel.: +49-831-54031-0
info@codesys.com
  • Imprint
  • Terms of Service
  • Privacy Policy
© 2025 CODESYS GmbH | A member of the CODESYS Group