<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Struc</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/02cc76cec1/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/02cc76cec1/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/02cc76cec1/</id><updated>2021-10-04T14:24:07.205000Z</updated><subtitle>Recent posts to Struc</subtitle><entry><title>Struc</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/02cc76cec1/?limit=250#0d62/060b" rel="alternate"/><published>2021-10-04T14:24:07.205000Z</published><updated>2021-10-04T14:24:07.205000Z</updated><author><name>dFx</name><uri>https://forge.codesys.com/u/dfx/</uri></author><id>https://forge.codesys.comd3863211f286df72d248fc04a88d4c5ceb031090</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Feels like endiantness issue between your 2 systems. Try word swaping and/or byte swaping.&lt;/p&gt;
&lt;p&gt;With A=15,B=8E,C=41,D=00&lt;br/&gt;
Result shown by your screenshot is Little Endian, DCBA.&lt;br/&gt;
I bet you expect 8.005262, which is Mid-Little Endian, CDAB.&lt;/p&gt;
&lt;p&gt;More tries here :&lt;br/&gt;
&lt;a href="https://www.scadacore.com/tools/programming-calculators/online-hex-converter/" rel="nofollow"&gt;https://www.scadacore.com/tools/programming-calculators/online-hex-converter/&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Struc</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/02cc76cec1/?limit=25#bd73" rel="alternate"/><published>2021-10-04T12:14:20.308000Z</published><updated>2021-10-04T12:14:20.308000Z</updated><author><name>timvh</name><uri>https://forge.codesys.com/u/timvh/</uri></author><id>https://forge.codesys.coma00106206d9f5059b6cf46796d0957ed66c227bb</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Maybe the pack mode of the structure can help. See the following help topic on the standard behavior and also how you can set it specifically for your structure:&lt;br/&gt;
&lt;a href="https://help.codesys.com/webapp/_cds_pragma_attribute_pack_mode;product=codesys;version=3.5.17.0" rel="nofollow"&gt;https://help.codesys.com/webapp/_cds_pragma_attribute_pack_mode;product=codesys;version=3.5.17.0&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Struc</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/02cc76cec1/?limit=25#0d62" rel="alternate"/><published>2021-09-16T05:26:31.795000Z</published><updated>2021-09-16T05:26:31.795000Z</updated><author><name>Reinier Geers</name><uri>https://forge.codesys.com/u/reinier-geers/</uri></author><id>https://forge.codesys.com6057e722caf1958f4c3f090c0bf52ea7f17bc1dd</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;System version is 9.2&lt;br/&gt;
I recieve by RS232 a array of data&lt;br/&gt;
&lt;img src="./attachment/attachment.png" width="50%"/&gt;&lt;/p&gt;
&lt;p&gt;When i copy byte 4-7 into an array of bytes and then syscpy to a real ive got the right value.&lt;br/&gt;
&lt;img src="./attachment/attachment.png" width="50%"/&gt;&lt;/p&gt;
&lt;p&gt;when i copy it strait to a structure where the position of byte 4-7 is a real.  Then the value is moved.  I put in a Union struc so you can also see it as an array of byte. witch shows the movement.&lt;br/&gt;
&lt;img src="./attachment/attachment.png" width="50%"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Struc</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/02cc76cec1/?limit=25#55c8" rel="alternate"/><published>2021-09-15T15:01:37.566000Z</published><updated>2021-09-15T15:01:37.566000Z</updated><author><name>i-campbell</name><uri>https://forge.codesys.com/u/i-campbell/</uri></author><id>https://forge.codesys.com6dbbd60f68a1542001f3f89d601ced8c16a33eb9</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;In ARM, REALs MUST be aligned to 4byte addresses.&lt;br/&gt;
In other architectures, they are more efficient went aligned, so they are aligned.&lt;br/&gt;
You could change the sendor of the byte array, to add a padding byte to your serialized data, or do as you say, a memcpy.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Struc</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/02cc76cec1/?limit=250#da6d" rel="alternate"/><published>2021-09-15T13:46:52.031000Z</published><updated>2021-09-15T13:46:52.031000Z</updated><author><name>aliazzz</name><uri>https://forge.codesys.com/u/aliazzz/</uri></author><id>https://forge.codesys.comb5c3971a925749e3f7a147ca3c6c1600caf362ea</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;*I copy an array into a strucure but somehowe it moves a byte. *&lt;/p&gt;
&lt;p&gt;I think you have byte alignment issues. Maybe a UNION of the DUT (STRUCT) and ARRAY will help you. Otherwise you could try to use SysMemCopy to copy data from the ARRAY to the STRUCT and VICE VERSA.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Struc</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/02cc76cec1/?limit=250#41ff/6b31" rel="alternate"/><published>2021-09-15T13:42:29.248000Z</published><updated>2021-09-15T13:42:29.248000Z</updated><author><name>aliazzz</name><uri>https://forge.codesys.com/u/aliazzz/</uri></author><id>https://forge.codesys.comfe8481a1942ff6d209cb20388f3de37b847328d1</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I am very sorry that I do not understand your explanation, here are some hints to help you describe your issue in a clear and concise way so we (the audience) can help you way better =)&lt;/p&gt;
&lt;p&gt;1) Describe your problem in a concise way &lt;strong&gt;without&lt;/strong&gt; referring to previous posts. So prevent stuff like "Both are the same" .. Remember that we, the audience, need context.&lt;br/&gt;
2) Provide IDE and system versions, &lt;br/&gt;
3) Provide &lt;strong&gt;actual&lt;/strong&gt; outcome,&lt;br/&gt;
4) Provide &lt;strong&gt;expected&lt;/strong&gt; outcome.&lt;/p&gt;
&lt;p&gt;I hope the above hints help you write posts which people can immediately anwser in a meaningful way :-)&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Struc</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/02cc76cec1/?limit=25#41ff" rel="alternate"/><published>2021-09-15T13:25:32.771000Z</published><updated>2021-09-15T13:25:32.771000Z</updated><author><name>Reinier Geers</name><uri>https://forge.codesys.com/u/reinier-geers/</uri></author><id>https://forge.codesys.comdeb32c5f5858631f013d051997f0b6666f687bf9</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Both are the same. rMeasure_value_1 starts at byte 4.  but is not the right value.   If i memcpy Byte 4-7 to real ive got the right value. So why not as a struc .  It looks likes it moves a byte&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Struc</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/02cc76cec1/?limit=250#022a" rel="alternate"/><published>2021-09-15T13:07:54.736000Z</published><updated>2021-09-15T13:07:54.736000Z</updated><author><name>aliazzz</name><uri>https://forge.codesys.com/u/aliazzz/</uri></author><id>https://forge.codesys.comcd91988ad3ab31e616af587a8236ca1d79796a49</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;What exactly is your question?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Struc</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/02cc76cec1/?limit=25#0f0c" rel="alternate"/><published>2021-09-15T12:08:01.721000Z</published><updated>2021-09-15T12:08:01.721000Z</updated><author><name>Reinier Geers</name><uri>https://forge.codesys.com/u/reinier-geers/</uri></author><id>https://forge.codesys.com5ee646a7927ee21d0106310ea72dc1dd9452c306</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;img src="./attachment/attachment.png" width="50%"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Struc</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/02cc76cec1/?limit=25#22ab" rel="alternate"/><published>2021-09-15T11:59:05.238000Z</published><updated>2021-09-15T11:59:05.238000Z</updated><author><name>Reinier Geers</name><uri>https://forge.codesys.com/u/reinier-geers/</uri></author><id>https://forge.codesys.com4222cfb95bfab4847af6bdebb7f1f645f55023da</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I copy an array into a strucure but somehowe it moves a byte. Why  36 54 7a 41 schould be 15.46  but it is 6.0.139E-39 witch is 54 7a 41 00&lt;br/&gt;
&lt;img src="./attachment/array.PNG" width="50%"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="./attachment/struc.PNG" width="50%"/&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>