<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to how to read the data from array</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/767d870ab4/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/767d870ab4/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/767d870ab4/</id><updated>2020-02-27T20:09:33.393000Z</updated><subtitle>Recent posts to how to read the data from array</subtitle><entry><title>how to read the data from array</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/767d870ab4/?limit=25#d122" rel="alternate"/><published>2020-02-27T20:09:33.393000Z</published><updated>2020-02-27T20:09:33.393000Z</updated><author><name>t.lundahl</name><uri>https://forge.codesys.com/u/t-lundahl/</uri></author><id>https://forge.codesys.comed6c4e6e99a3770b75db8707fafc3d7955f61e57</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I don't think so. Usually your are dealying with non dynamic variables in PLC's.&lt;br/&gt;
I don't know how it is the Codesys 3 with C/C++ code.&lt;/p&gt;
&lt;p&gt;/Torbjörn&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>how to read the data from array</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/767d870ab4/?limit=25#2612" rel="alternate"/><published>2020-02-27T20:09:29.695000Z</published><updated>2020-02-27T20:09:29.695000Z</updated><author><name>parthi1980</name><uri>https://forge.codesys.com/u/parthi1980/</uri></author><id>https://forge.codesys.com946ba045b35bfe6dad3efdfe31b445ecc34fce70</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Is that any option to Insert / delete the element from Array?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>how to read the data from array</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/767d870ab4/?limit=25#7f7a" rel="alternate"/><published>2020-02-27T20:09:28.350000Z</published><updated>2020-02-27T20:09:28.350000Z</updated><author><name>spfeif</name><uri>https://forge.codesys.com/u/spfeif/</uri></author><id>https://forge.codesys.comf3f1b1c3c864dba426f5981e89c22d10d0a251bf</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Since you are that new I would like to be clear. It appears that you said you want to read the data then you would do the following:&lt;/p&gt;
&lt;p&gt;Byte0 := CanDataRec&lt;span&gt;[0]&lt;/span&gt;;&lt;br/&gt;
Byte1 := CanDataRec&lt;span&gt;[1]&lt;/span&gt;;&lt;br/&gt;
Byte2 := CanDataRec&lt;span&gt;[2]&lt;/span&gt;;&lt;br/&gt;
Byte3 := CanDataRec&lt;span&gt;[3]&lt;/span&gt;;&lt;br/&gt;
Byte4 := CanDataRec&lt;span&gt;[4]&lt;/span&gt;;&lt;br/&gt;
Byte5 := CanDataRec&lt;span&gt;[5]&lt;/span&gt;;&lt;br/&gt;
Byte6 := CanDataRec&lt;span&gt;[6]&lt;/span&gt;;&lt;br/&gt;
Byte7 := CanDataRec&lt;span&gt;[7]&lt;/span&gt;;&lt;/p&gt;
&lt;p&gt;Now a few things: You don't need to add them to anther variable you already have them in the array but from my experience you will want to know how to read a 16 bit variable and 32 bit variable from your data array:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;FUNCTION&lt;/span&gt; &lt;span class="n"&gt;IO_BYTES_To_WORD&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;WORD&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="n"&gt;IN0&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;LSB&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="n"&gt;IN1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;MSB&lt;/span&gt;
&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;VAR_INPUT&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="n"&gt;In0&lt;/span&gt;&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt;  &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;BYTE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="n"&gt;In1&lt;/span&gt;&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt;  &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;BYTE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_VAR&lt;/span&gt;
&lt;span class="n"&gt;VAR&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="n"&gt;wTemp&lt;/span&gt;&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;WORD&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_VAR&lt;/span&gt;
&lt;span class="n"&gt;wTemp&lt;/span&gt;&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;In1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;wTemp&lt;/span&gt;&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;SHL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;wTemp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;OR&lt;/span&gt; &lt;span class="n"&gt;In0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;IO_BYTES_To_WORD&lt;/span&gt;&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;wTemp&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;So if you did the following:&lt;/p&gt;
&lt;p&gt;word1 := IO_BYTES_TO_WORD(IN0:= Byte0, IN1:= Byte1); (&lt;em&gt; this will give you a word / int 16 bit from your two data bytes &lt;/em&gt;)&lt;/p&gt;
&lt;p&gt;Follow the same logic for getting a DWORD 32bit from 4 bytes.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>how to read the data from array</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/767d870ab4/?limit=25#a2f1" rel="alternate"/><published>2020-02-27T20:09:24.656000Z</published><updated>2020-02-27T20:09:24.656000Z</updated><author><name>peterchowhe</name><uri>https://forge.codesys.com/u/peterchowhe/</uri></author><id>https://forge.codesys.com8f688024fd74cf070d5bb44e2702b37ce50512bd</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;thank you very much!&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>how to read the data from array</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/767d870ab4/?limit=25#3921" rel="alternate"/><published>2020-02-27T20:09:23.341000Z</published><updated>2020-02-27T20:09:23.341000Z</updated><author><name>t.lundahl</name><uri>https://forge.codesys.com/u/t-lundahl/</uri></author><id>https://forge.codesys.com37936621c61e8689d2384472359c8c431466b21e</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;Is it this you need?&lt;br/&gt;
Your arrCAN probably have from &lt;span&gt;[0]&lt;/span&gt;-&lt;span&gt;[7]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;arrCANbus&lt;span&gt;[0]&lt;/span&gt; = byte 1&lt;br/&gt;
arrCANbus&lt;span&gt;[1]&lt;/span&gt; = byte 2&lt;br/&gt;
arrCANbus[x] = anybyte in the range see above.&lt;/p&gt;
&lt;p&gt;/Torbjörn&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>how to read the data from array</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/767d870ab4/?limit=25#a2f1" rel="alternate"/><published>2020-02-27T20:09:22.007000Z</published><updated>2020-02-27T20:09:22.007000Z</updated><author><name>peterchowhe</name><uri>https://forge.codesys.com/u/peterchowhe/</uri></author><id>https://forge.codesys.comcc423a53808936406525c6fbceadf0f4172e916f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi, all, i am starter for codesys system.&lt;/p&gt;
&lt;p&gt;Now i have read the 8 bytes array from canbus.&lt;/p&gt;
&lt;p&gt;but i need the data byte1 and 2, &lt;/p&gt;
&lt;p&gt;i have no idea how to get these data. please help.&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>