Support Forums
Zeros in front of serial string

Here is my serial input:

2008 10 03 15 53 56      0      0     -1 255 255   0   0   0   0   0 2119  -3  0   1   0   0   2912       6565     7  71  20   20  32  34  24

Here is my code:

BEGIN"sontek17"
PS=9600,N,8,1
DO{/n/c/u}
RA1SERIAL""
1SERIAL("%d[1CV]")
1SERIAL("%d[2CV]")
1SERIAL("%d[3CV]")
1SERIAL("%d[4CV]")
1SERIAL("%d[5CV]")
1SERIAL("%d[6CV]")
1SERIAL("%d[7CV]")
1SERIAL("%d[8CV]")
1SERIAL("%d[9CV]")
1SERIAL("%d[10CV]")
1SERIAL("%d[11CV]")
1SERIAL("%d[12CV]")
1SERIAL("%d[13CV]")
1SERIAL("%d[14CV]")
1SERIAL("%d[15CV]")
1SERIAL("%d[16CV]")
1SERIAL("%d[17CV]")
1SERIAL("%d[18CV]")
1SERIAL("%d[19CV]")
1SERIAL("%d[20CV]")
1SERIAL("%d[21CV]")
1SERIAL("%d[22CV]")
1SERIAL("%d[23CV]")
1SERIAL("%d[24CV]")
1SERIAL("%d[25CV]")
1SERIAL("%d[26CV]")
1SERIAL("%d[27CV]")
1SERIAL("%d[28CV]")
1SERIAL("%d[29CV]")
1SERIAL("%d[30CV]")
1SERIAL("%d[31CV]\\013\\010",W)
1CV 2CV 3CV 4CV 5CV 6CV 7CV 8CV 9CV 10CV 
11CV 12CV 13CV 14CV 15CV 16CV 17CV 18CV 19CV 20CV 
21CV 22CV 23CV 24CV 25CV 26CV 27CV 28CV 29CV 30CV 
31CV 
LOGONA 
END

How come I see many zeros in front of the serial input in detransfer:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2008.0 10.0 3.0 15.0 53.0 56.0 0.0 0.0 -1.0 255.0 255.0 0.0 0.0 0.0 0.0 0.0 2119.0 -3.0 0.0 1.0 0.0 0.0 2912.0 6565.0 7.0 71.0 20.0 20.0 32.0 34.0 24.0
E89
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2008.0 10.0 3.0 15.0 53.0 56.0 0.0 0.0 -1.0 255.0 255.0 0.0 0.0 0.0 0.0 0.0 2119.0 -3.0 0.0 1.0 0.0 0.0 2912.0 6565.0 7.0 71.0 20.0 20.0 32.0 34.0 24.0
E89
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2008.0 10.0 3.0 15.0 53.0 56.0 0.0 0.0 -1.0 255.0 255.0 0.0 0.0 0.0 0.0 0.0 2119.0 -3.0 0.0 1.0 0.0 0.0 2912.0 6565.0 7.0 71.0 20.0 20.0 32.0 34.0 24.0
E89
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2008.0 10.0 3.0 15.0 53.0 56.0 0.0 0.0 -1.0 255.0 255.0 0.0 0.0 0.0 0.0 0.0 2119.0 -3.0 0.0 1.0 0.0 0.0 2912.0 6565.0 7.0 71.0 20.0 20.0 32.0 34.0 24.0
E89
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2008.0 10.0 3.0 15.0 53.0 56.0 0.0 0.0 -1.0 255.0 255.0 0.0 0.0 0.0 0.0 0.0 2119.0 -3.0 0.0 1.0 0.0 0.0 2912.0 6565.0 7.0 71.0 20.0 20.0 32.0 34.0 24.0
G
E89

Advance thanks.
Orange

Here is my serial input: ```` 2008 10 03 15 53 56 0 0 -1 255 255 0 0 0 0 0 2119 -3 0 1 0 0 2912 6565 7 71 20 20 32 34 24 ```` Here is my code: ```` BEGIN"sontek17" PS=9600,N,8,1 DO{/n/c/u} RA1SERIAL"" 1SERIAL("%d[1CV]") 1SERIAL("%d[2CV]") 1SERIAL("%d[3CV]") 1SERIAL("%d[4CV]") 1SERIAL("%d[5CV]") 1SERIAL("%d[6CV]") 1SERIAL("%d[7CV]") 1SERIAL("%d[8CV]") 1SERIAL("%d[9CV]") 1SERIAL("%d[10CV]") 1SERIAL("%d[11CV]") 1SERIAL("%d[12CV]") 1SERIAL("%d[13CV]") 1SERIAL("%d[14CV]") 1SERIAL("%d[15CV]") 1SERIAL("%d[16CV]") 1SERIAL("%d[17CV]") 1SERIAL("%d[18CV]") 1SERIAL("%d[19CV]") 1SERIAL("%d[20CV]") 1SERIAL("%d[21CV]") 1SERIAL("%d[22CV]") 1SERIAL("%d[23CV]") 1SERIAL("%d[24CV]") 1SERIAL("%d[25CV]") 1SERIAL("%d[26CV]") 1SERIAL("%d[27CV]") 1SERIAL("%d[28CV]") 1SERIAL("%d[29CV]") 1SERIAL("%d[30CV]") 1SERIAL("%d[31CV]\\013\\010",W) 1CV 2CV 3CV 4CV 5CV 6CV 7CV 8CV 9CV 10CV 11CV 12CV 13CV 14CV 15CV 16CV 17CV 18CV 19CV 20CV 21CV 22CV 23CV 24CV 25CV 26CV 27CV 28CV 29CV 30CV 31CV LOGONA END ```` How come I see many zeros in front of the serial input in detransfer: ```` 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2008.0 10.0 3.0 15.0 53.0 56.0 0.0 0.0 -1.0 255.0 255.0 0.0 0.0 0.0 0.0 0.0 2119.0 -3.0 0.0 1.0 0.0 0.0 2912.0 6565.0 7.0 71.0 20.0 20.0 32.0 34.0 24.0 E89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2008.0 10.0 3.0 15.0 53.0 56.0 0.0 0.0 -1.0 255.0 255.0 0.0 0.0 0.0 0.0 0.0 2119.0 -3.0 0.0 1.0 0.0 0.0 2912.0 6565.0 7.0 71.0 20.0 20.0 32.0 34.0 24.0 E89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2008.0 10.0 3.0 15.0 53.0 56.0 0.0 0.0 -1.0 255.0 255.0 0.0 0.0 0.0 0.0 0.0 2119.0 -3.0 0.0 1.0 0.0 0.0 2912.0 6565.0 7.0 71.0 20.0 20.0 32.0 34.0 24.0 E89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2008.0 10.0 3.0 15.0 53.0 56.0 0.0 0.0 -1.0 255.0 255.0 0.0 0.0 0.0 0.0 0.0 2119.0 -3.0 0.0 1.0 0.0 0.0 2912.0 6565.0 7.0 71.0 20.0 20.0 32.0 34.0 24.0 E89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2008.0 10.0 3.0 15.0 53.0 56.0 0.0 0.0 -1.0 255.0 255.0 0.0 0.0 0.0 0.0 0.0 2119.0 -3.0 0.0 1.0 0.0 0.0 2912.0 6565.0 7.0 71.0 20.0 20.0 32.0 34.0 24.0 G E89 ```` Advance thanks. Orange

Good morning Orange,

The parsing string is failing and timing out hence the zeros. We've spent a little time playing with your set up to work out a better way of reading your string.

The only constant characters in your string is the Carriage Return / Line Feed combination at the end of the string. We can use these two chars as the trigger for the schedule we can more accurately lock on to a location in the string and parse out the data we want.

When we set the schedule trigger to trigger on the CR/LF, (RA1SERIAL"\013\010") the data before the trigger is left in the input buffer so we can read it out. But if there is a partial string then the first parsing will not work correctly but subsequent ones will.

Try this code.

BEGIN"sontek17"
PS=9600,N,8,1
DO{/n/c/u}
RA1SERIAL"\\013\\010"
1SERIAL("\\013\\010%d[1CV]%d[2CV]%d[3CV]%d[4CV]%d[5CV]%d[6CV]%d[7CV]%d[8CV]%d[9CV]%d[10CV]%d[11CV]%d[12CV]%d[13CV]%d[14CV]%d[15CV]",w)
1serial("%d[16CV]%d[17CV]%d[18CV]%d[19CV]%d[20CV]%d[21CV]%d[22CV]%d[23CV]%d[24CV]%d[25CV]%d[26CV]%d[27CV]%d[28CV]%d[29CV]%d[30CV]%d[31CV]",w)
1..31CV 
END

Cheers,
Roger

Good morning Orange, The parsing string is failing and timing out hence the zeros. We've spent a little time playing with your set up to work out a better way of reading your string. The only constant characters in your string is the Carriage Return / Line Feed combination at the end of the string. We can use these two chars as the trigger for the schedule we can more accurately lock on to a location in the string and parse out the data we want. When we set the schedule trigger to trigger on the CR/LF, _(RA1SERIAL"\\013\\010")_ the data before the trigger is left in the input buffer so we can read it out. But if there is a partial string then the first parsing will not work correctly but subsequent ones will. Try this code. ```` BEGIN"sontek17" PS=9600,N,8,1 DO{/n/c/u} RA1SERIAL"\\013\\010" 1SERIAL("\\013\\010%d[1CV]%d[2CV]%d[3CV]%d[4CV]%d[5CV]%d[6CV]%d[7CV]%d[8CV]%d[9CV]%d[10CV]%d[11CV]%d[12CV]%d[13CV]%d[14CV]%d[15CV]",w) 1serial("%d[16CV]%d[17CV]%d[18CV]%d[19CV]%d[20CV]%d[21CV]%d[22CV]%d[23CV]%d[24CV]%d[25CV]%d[26CV]%d[27CV]%d[28CV]%d[29CV]%d[30CV]%d[31CV]",w) 1..31CV END ```` Cheers, Roger
25
2
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft