I have changed brands of a weigh scale with RS-232 output that is used in a program. I notice that the string length alternates between 18 and 19 characters (there seems to be a leading . present in the 19-character message). My settings are: baud=9600,parity=n,data=8,stop=1
I tried changing parity to even and odd but that did not help.
Any suggestions as to why the string length changes from 18 to 19 characters and what I can adjust to correct this?
here is a video captured using another program (value on scale is 15.80 lbs)
Thanks for the suggestions. Inspecting the output in hexadecimal shows that the leading . character is actually 00 in hexadecimal which is the NULL Character, whereas the hexadecimal representation of the . character (period or full stop) is 2E.
So now the question becomes why is there a leading NULL character, and the manual mentions nothing of that.
I can indeed do as @Colin or @krambriw suggested and handle it that way. My feeling was that there could / should be a technical reason why I could not get a steady 18-character message repeatedly, but maybe there is some setting deep in the scale that I am not aware of and I’m hunting a ghost.
I'll have some more time on Monday to explore the scale settings and I may come across something useful.
0x00 if often the end terminator in a low level C type buffer or string... so I suspect what is happening is that the scale is actually sending it on the end of the line of text - but as you are (probably) splitting on the carriage return character - that is then left in the (Node-RED) buffer until the next CR - so appear on the front of the next report. So yes I would just "wait for" the & char and not worry about it....
Though you could depending if you only wanted one of those weights just "wait for" N then split on L , or "wait for" L and split on \ .