Hi there
Good day
Wondering if there is a buffer size limit to the Ignition Serial module ? Is it possible to increase it?
What is the maximum number of bytes that can read using system.serial.readBytesAsString ? Is it possible to increase it?
https://docs.inductiveautomation.com/display/DOC79/system.serial.readBytesAsString
Because when a string of lines(ASCII format) is sent from one pc via the hyperterminal through RS422 serial COM port to the other pc with Ignition application running the following code to read from the serial port,
the string of lines(ASCII format) was broken up into 4 different parts. Had tried sending for every second the same amount of lines - and to read it.
I tried running the script as client timer script. Also i tried running it as a thread from a button click and keep running to read the serial port.
Both methods yield the same result - what was read was broken into 4 parts.
import jarray, traceback
from java.lang import String, Thread
from java.util import Date
import system
import sys
import time
import re
port="COM1"
system.serial.configureSerialPort(\
port="COM1",\
bitRate=system.serial.BIT_RATE_4800,\
dataBits=system.serial.DATA_BITS_8,\
handshake=system.serial.HANDSHAKE_NONE,\
hardwareFlowControl=False,\
parity=system.serial.PARITY_NONE,\
stopBits=system.serial.STOP_BITS_1)
system.serial.openSerialPort(port)
readstring = system.serial.readBytesAsString(port, 500, 1000)
print readstring
The few lines of sentences sent are as follows:
$GPRTE,,,,,*78
$GPDTM,W84,,00.0000,N,00.0000,E,,W84*41
$GPGGA,032014.00,0118.7595,N,10401.3918,E,1,11,1.6,29,M,,M,,*55
$GPDTM,W84,,00.0000,N,00.0000,E,,W84*41
$GPGLL,0118.7595,N,10401.3918,E,032014.00,A,A*6C
$GPDTM,W84,,00.0000,N,00.0000,E,,W84*41
$GPRMC,032014.00,A,0118.7595,N,10401.3918,E,0.0,284.8,200718,0.2,E,A*38
$GPVTG,284.8,T,284.6,M,0.0,N,0.0,K,A*2D
$GPZDA,032014.00,20,07,2018,-08,00*49
But what was read/printed onto the output console is as follows
$GPRTE,,,,,*78
$GPDTM,W84,,00.0000,N,00.0000,E,,W84*41
$GPGGA,032014.00,0118.7595,N,10401.3918,E,1,11,1.6,29,M,,M,,*55
$GPDTM,W84,,00.0000,N,00.0000,E,,W84*41
$GPGLL,0118.7595,N,10401.3918,E,032014.00,A,A*6C
$GPDTM,W84,,00.0000,N,00.00
00,E,,W84*41
$GPRMC,032014.00,A,0118.7595,N,10401.3918,E,0.0,284.8,200718,0.2,E,A*38
$GPVTG,284.8,T,284.6,M,0.0,N,0.0,
K,A*2D
$GPZDA,032014.00,20,07,2018,-08,00*49
In the script, after the code system.serial.readBytesAsString, i added another line of code
print “Completed read”
So the result became very obvious that is it split into 4 parts.
$GPRTE,,,,,*78
$GPDTM,W84,,00.0000,N,00.0000,E,,W84*41
$GPGGA,032014.00,0118.7595,N,10401.3918,E,1,11,1.6,29,M,,M,,*55
Completed read
$GPDTM,W84,,00.0000,N,00.0000,E,,W84*41
$GPGLL,0118.7595,N,10401.3918,E,032014.00,A,A*6C
$GPDTM,W84,,00.0000,N,00.00
Completed read
00,E,,W84*41
$GPRMC,032014.00,A,0118.7595,N,10401.3918,E,0.0,284.8,200718,0.2,E,A*38
$GPVTG,284.8,T,284.6,M,0.0,N,0.0,
Completed read
K,A*2D
$GPZDA,032014.00,20,07,2018,-08,00*49
Completed read
But i check that usually for windows , the serial buffer is 4096 bytes.
Also I checked that the above original string, the number of bytes is around 463.
Had tried changing to
readstring = system.serial.readBytesAsString(port, 1000, 1000) but it is still the same
Thus wonder what could be the reason that after receiving/read from the serial port, the chunk of sentences is split into 4 parts?
Wonder where is the limitation? Or what is the cause ?
How is it possible to increase or set the buffer size?
Thank you very very much for any advises or reply