# system.serial.writeBytes and system.serial.write

**URL:** <https://forum.inductiveautomation.com/t/system-serial-writebytes-and-system-serial-write/17410>\
**Category:** Ignition\
**Created:** [March 19, 2018, 8:33am UTC](https://forum.inductiveautomation.com/t/system-serial-writebytes-and-system-serial-write/17410 "2018-03-19T08:33:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![liau.kwongweng](https://avatars.discourse-cdn.com/v4/letter/l/958977/32.png) [@liau.kwongweng](https://forum.inductiveautomation.com/u/liau.kwongweng)\
**Post date:** [March 19, 2018, 8:33am UTC](https://forum.inductiveautomation.com/t/system-serial-writebytes-and-system-serial-write/17410/1 "2018-03-19T08:33:54Z")

</div>

Dear Sir/Ms

I encountered an issue when using system.serial.writeBytes and system.serial.write.

When i write to the hyperterminal, i notice that the first few characters are missing , the maximum characters that it would output to the hyper terminal is only “03-19 16:22:56”, whatever is in front would be chopped off.  
Whereas the two statements { print "today = " , today} before and after the write statement , printed on to the console perfectly.  
It seems that there is some kind of limitation or buffer? Is there any way to increase it?  
I need to send/write a data packet in one write command across the serial port.  
I have no problem reading the similar data packet, it looks something like this in ASCII format:  
“2018-03-19 16:25:13\<\r\>\<\n\>Number=30\<\r\>\<\n\>1,60.0\<\r\>\<\n\>2,0.0\<\r\>\<\n\>”

Would appreciate any advise or help in this .  
Thank you very much

The following is my code tested using date and time only instead of the full data packet:

def serialwrite(today):  
port=“COM1”  
system.serial.configureSerialPort(  
port=“COM1”,  
bitRate=system.serial.BIT\_RATE\_19200,  
dataBits=system.serial.DATA\_BITS\_8,  
handshake=system.serial.HANDSHAKE\_NONE,  
hardwareFlowControl=False,  
parity=system.serial.PARITY\_NONE,  
stopBits=system.serial.STOP\_BITS\_1)  
print " "  
print "START \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*START "  
system.serial.openSerialPort(port)  
today=today+’\r\n’  
print "today = " , today  
system.serial.writeBytes(port, today)  
print "today = " , today  
system.serial.write(port, today)  
system.serial.closeSerialPort(port)

LCcurrentlist=[]  
today1 = system.date.now()  
today= system.date.format(today1, “yyyy-MM-dd HH:mm:ss”)  
print serialwrite(today)

---

<div class="post-metadata">

**Author:** ![liau.kwongweng](https://avatars.discourse-cdn.com/v4/letter/l/958977/32.png) [@liau.kwongweng](https://forum.inductiveautomation.com/u/liau.kwongweng)\
**Post date:** [March 20, 2018, 7:03am UTC](https://forum.inductiveautomation.com/t/system-serial-writebytes-and-system-serial-write/17410/2 "2018-03-20T07:03:21Z")

</div>

Found the issue lies with the hyper terminal limitation(due to an very old version)  
After trying with latest version of hyper terminal, after writing a whole chunk of data packet to the serial port, all the characters are displayed correctly on the hyper terminal  
Thank you

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [March 20, 2018, 11:55am UTC](https://forum.inductiveautomation.com/t/system-serial-writebytes-and-system-serial-write/17410/3 "2018-03-20T11:55:49Z")

</div>

Cool. It seemed suspicious that the messages were being cut off where you were sending the carriage return / line feed combo - more like a display issue in Hyper Terminal than anything in the driver.

---

<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:** [May 21, 2020, 4:21pm UTC](https://forum.inductiveautomation.com/t/system-serial-writebytes-and-system-serial-write/17410/4 "2020-05-21T16:21:23Z")

</div>

A post was split to a new topic: [Question about system.serial functions](https://forum.inductiveautomation.com/t/question-about-system-serial-functions/34948)
