# serial.readBytes function always return a full length bytes array filled by zero, even no any actual data from device

**URL:** <https://forum.inductiveautomation.com/t/serial-readbytes-function-always-return-a-full-length-bytes-array-filled-by-zero-even-no-any-actual-data-from-device/42599>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [January 26, 2021, 4:26am UTC](https://forum.inductiveautomation.com/t/serial-readbytes-function-always-return-a-full-length-bytes-array-filled-by-zero-even-no-any-actual-data-from-device/42599 "2021-01-26T04:26:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Park](https://avatars.discourse-cdn.com/v4/letter/p/e79b87/32.png) [@Park](https://forum.inductiveautomation.com/u/Park)\
**Post date:** [January 26, 2021, 4:26am UTC](https://forum.inductiveautomation.com/t/serial-readbytes-function-always-return-a-full-length-bytes-array-filled-by-zero-even-no-any-actual-data-from-device/42599/1 "2021-01-26T04:26:22Z")

</div>

I have a vision project to listen com port using function system.serial.readBytes(port,32,1000). it can receive and send data with com port. Question is it always return zero filled bytes, even no any actual data sent from device, how to avoid mixed default zero bytes and actual zero bytes sent from device?  
I had to check array bytes one by one, but this also loss the actual zero data from device.

```auto
				receivedbytes = system.serial.readBytes(port,32,1000)
				started=-1
				print('received length:' + str(len(receivedbytes)))
				for i in range(len(receivedbytes)):
					if receivedbytes[i] <> 0:
						started=i
						break

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 26, 2021, 11:46am UTC](https://forum.inductiveautomation.com/t/serial-readbytes-function-always-return-a-full-length-bytes-array-filled-by-zero-even-no-any-actual-data-from-device/42599/2 "2021-01-26T11:46:02Z")

</div>

Never seen this. May be a regression.

---

<div class="post-metadata">

**Author:** ![Park](https://avatars.discourse-cdn.com/v4/letter/p/e79b87/32.png) [@Park](https://forum.inductiveautomation.com/u/Park)\
**Post date:** [January 27, 2021, 1:03am UTC](https://forum.inductiveautomation.com/t/serial-readbytes-function-always-return-a-full-length-bytes-array-filled-by-zero-even-no-any-actual-data-from-device/42599/3 "2021-01-27T01:03:42Z")

</div>

Did anyone have this problem? I use accessport to test, there is no any returned bytes, but Ignition always had zero bytes. Is there setting about the received buffer? seems readBytes return a prefilled array.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 27, 2021, 1:46am UTC](https://forum.inductiveautomation.com/t/serial-readbytes-function-always-return-a-full-length-bytes-array-filled-by-zero-even-no-any-actual-data-from-device/42599/4 "2021-01-27T01:46:48Z")

</div>

Can you get in contact with support? This would be the first report of a regression in the serial module I’ve seen since we switched the backend over.

---

<div class="post-metadata">

**Author:** ![Park](https://avatars.discourse-cdn.com/v4/letter/p/e79b87/32.png) [@Park](https://forum.inductiveautomation.com/u/Park)\
**Post date:** [January 27, 2021, 2:02am UTC](https://forum.inductiveautomation.com/t/serial-readbytes-function-always-return-a-full-length-bytes-array-filled-by-zero-even-no-any-actual-data-from-device/42599/5 "2021-01-27T02:02:36Z")

</div>

@paul-griffith,thanks your reply. I’m using Ignition 8.1 trial version(serial module ver:6.1.1) to do some test before applying to our production. How do I get in contact with support?

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [January 27, 2021, 3:45am UTC](https://forum.inductiveautomation.com/t/serial-readbytes-function-always-return-a-full-length-bytes-array-filled-by-zero-even-no-any-actual-data-from-device/42599/6 "2021-01-27T03:45:36Z")

</div>

[https://inductiveautomation.com/support/home/](https://inductiveautomation.com/support/home/)  
Or [support@inductiveautomation.com](mailto:support@inductiveautomation.com).
