<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to How to write multiple coils (Modbus FC15)</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/47304d14ad/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/47304d14ad/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/47304d14ad/</id><updated>2024-11-17T17:48:34.220000Z</updated><subtitle>Recent posts to How to write multiple coils (Modbus FC15)</subtitle><entry><title>How to write multiple coils (Modbus FC15)</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/47304d14ad/?limit=25#cf58" rel="alternate"/><published>2024-11-17T17:48:34.220000Z</published><updated>2024-11-17T17:48:34.220000Z</updated><author><name>ben1</name><uri>https://forge.codesys.com/u/ben1/</uri></author><id>https://forge.codesys.com21aa5aaaef7a950c181fb47b61eaf300038ff952</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Yeah that is odd - sometimes you have to do what you have to do unfortunately.&lt;br/&gt;
Have you tried sending consecutive bits in the word instead - ie. instead of &lt;span&gt;[0]&lt;/span&gt;.0. &lt;a class="alink" href="/forge/talk-ru/1/"&gt;[1]&lt;/a&gt;.0, &lt;a class="alink" href="/forge/talk-ru/2/"&gt;[2]&lt;/a&gt;.0 etc, send &lt;span&gt;[0]&lt;/span&gt;.0,&lt;span&gt;[0]&lt;/span&gt;.1, &lt;span&gt;[0]&lt;/span&gt;.2 etc. ?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>How to write multiple coils (Modbus FC15)</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/47304d14ad/?limit=25#10b3/9af6" rel="alternate"/><published>2024-11-17T11:52:50.022000Z</published><updated>2024-11-17T11:52:50.022000Z</updated><author><name>garrian</name><uri>https://forge.codesys.com/u/garrian/</uri></author><id>https://forge.codesys.com2c32241b7022a9548641c074b6198a4c71c18d55</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thanks! As far as I can see, the client can only send words. And on the server side there are an array for each of the functions: bool for coil and discrete, word for holding and input registers.&lt;/p&gt;
&lt;p&gt;I assume I can use holding register, then use bit mapping on the words instead of coils. But I really want to use the FC15/coils. &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>How to write multiple coils (Modbus FC15)</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/47304d14ad/?limit=25#10b3" rel="alternate"/><published>2024-11-17T10:02:04.732000Z</published><updated>2024-11-17T10:02:04.732000Z</updated><author><name>ben1</name><uri>https://forge.codesys.com/u/ben1/</uri></author><id>https://forge.codesys.comd9bd703dd32cfdcd0dc0d1147af5837f3cb42d87</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;If I am understanding what you are saying, then yes that would be your problem. I would create an array of bools on the client side for the transfer and then unpack to words if necessary and try that. Or if client can't be changed then write words as Function 16 on server.&lt;/p&gt;
&lt;p&gt;But I am not sure if you or I are mis interpreting but it sounds a bit jumbled. I don't know what you have control of, but, if you are turning  on BITS in the client, you should write to BITS in the server with a Function 15. If you are writing to WORDS in the client, you should write to WORDS in the server with a Function 16.&lt;br/&gt;
And be sure you are trying to READ the data? Which would require a Function 1 or 3 - the reason I say this is because you mentioned setting client side 1,2,3 TRUE and not seeing on server side but you shouldn't unless you are reading the data. If your write function is working then 2  3 should turn back off on client because server overwrites them.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>How to write multiple coils (Modbus FC15)</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/47304d14ad/?limit=25#0fa4/bbda" rel="alternate"/><published>2024-11-17T09:02:05.016000Z</published><updated>2024-11-17T09:02:05.016000Z</updated><author><name>garrian</name><uri>https://forge.codesys.com/u/garrian/</uri></author><id>https://forge.codesys.com27ec4a88452db67cae872c017eced2bcbbc4f922</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thanks for your reply. I belive it is contiguous, I'm writing to adress 0 to 4. Or, do you mean something else?&lt;/p&gt;
&lt;p&gt;Well, something is happening. If I on the client set adress 1,2,3 to true, only 1 is set to true on the server side.&lt;/p&gt;
&lt;p&gt;On the client side, the data is array of word. But on the server side, the coils are array of bool. Holding register is array of word on server side. Can this be a problem?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>How to write multiple coils (Modbus FC15)</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/47304d14ad/?limit=25#0fa4" rel="alternate"/><published>2024-11-17T07:32:02.737000Z</published><updated>2024-11-17T07:32:02.737000Z</updated><author><name>ben1</name><uri>https://forge.codesys.com/u/ben1/</uri></author><id>https://forge.codesys.com79fdc1db7826733b1fd2d31ebf92c39525ddc744</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;When you say it does not work, does nothing happen or do you get an error?&lt;/p&gt;
&lt;p&gt;I have not used this function in codesys but from my past experience with Modbus I believe the coils need to be contiguous, which may be why yours is failing?&lt;/p&gt;
&lt;p&gt;Have you tried using Write Registers (16) to do the job? Or is their data in-between you do not want to edit in the transaction?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>How to write multiple coils (Modbus FC15)</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/47304d14ad/?limit=25#0bf1" rel="alternate"/><published>2024-11-16T19:31:55.780000Z</published><updated>2024-11-16T19:31:55.780000Z</updated><author><name>garrian</name><uri>https://forge.codesys.com/u/garrian/</uri></author><id>https://forge.codesys.comc93c133ef93ebd2f98b52afec7cd60d76782b131</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi there!&lt;/p&gt;
&lt;p&gt;I'm testing out modbus TCP/IP for my home brewery, using Wago PFC200 as both slave and master. I'm using Wago library WagoAppPlcModbus.&lt;/p&gt;
&lt;p&gt;Holding registers, input registers' and discrete inputs works fine, but when trying to write multiple coils, it doesn't work. Any idea what I'm doing wrong here?&lt;/p&gt;
&lt;p&gt;Attached is a screenshot of my code. I tried both using bit mapping and without. If I change to FC05, and write only 1 coil at the time, it works fine. But I want to write all at the same time..&lt;/p&gt;
&lt;p&gt;Any help is very appreciated :)&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>