# WAGOAppPLCModbus Write Multiple Coils

**URL:** https://www.wago.community/t/wagoappplcmodbus-write-multiple-coils/1377
**Category:** CODESYS
**Tags:** pfc200
**Created:** [November 26, 2024, 10:19pm UTC](https://www.wago.community/t/wagoappplcmodbus-write-multiple-coils/1377 "2024-11-26T22:19:24Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![rckalex](https://sea2.discourse-cdn.com/flex016/user_avatar/www.wago.community/rckalex/32/767_2.png) [@rckalex](https://www.wago.community/u/rckalex)
#### Post date: [November 26, 2024, 10:19pm UTC](https://www.wago.community/t/wagoappplcmodbus-write-multiple-coils/1377/1 "2024-11-26T22:19:24Z")

</div>

Has anyone been able to successfully write more than 8 coils (function code 15, Modbus RTU) using the WAGOAppPLCModbus library? In my implementation it appears that the first word of the awWriteData gets passed to the modbus slave but subsequent elements of the awWriteData do not.

```
	utQuery.bUnitId := NodeID;
	utQuery.bFunctionCode	:= 15; 		
	utQuery.uiWriteAddress	:= 0;
	utQuery.uiWriteQuantity	:= 512;
	
	
	FOR i:= 0 TO 124 DO				
			utQuery.uiWriteAddress	:= 0;
			utQuery.awWriteData[i]	:= gvl.arCoilsForTransmission[i+1];
	END_FOR
	
	xTrigger := TRUE;

```
