B
I am writing a serial DF1 protocol for home use. It works for the most part - CRC calc is fine, writing to B3 is fine, writing to N7 is fine. But reading from N7 is giving me a slight headache, mainly because of the double transmission of chr$(16) when a 16 is in the data string.
If the protocol did NOT do this, it's trivial to calculate how many bytes I should receive, parse the data, then move on to other things. But how does one handle getting back 4 words of data from N7 when the data is actual numbers such as:
4112 - represented as 16 16 16 16
4112 - represented as 16 16 16 16
784 - represented as 16 16 3
1206 - respresented as 16 16 5
How does one know if the string from the PLC is finished? All the redundant 16's destroy any chance of me using any accurate string length comparison. I cant look for the end of string (16 - 3) because that's part of 784. I cant look for the many 16 - 5's I get from the PLC because that is part of 1206.
I dont want to use a timer and assume the data gets to me in x seconds. (Perhaps I need to?)
Too bad they had to do it this way (I know they did it for a reason, unknown to me though).
Maybe there is a way to turn off the double transmission?
Thanks for any tips!
If the protocol did NOT do this, it's trivial to calculate how many bytes I should receive, parse the data, then move on to other things. But how does one handle getting back 4 words of data from N7 when the data is actual numbers such as:
4112 - represented as 16 16 16 16
4112 - represented as 16 16 16 16
784 - represented as 16 16 3
1206 - respresented as 16 16 5
How does one know if the string from the PLC is finished? All the redundant 16's destroy any chance of me using any accurate string length comparison. I cant look for the end of string (16 - 3) because that's part of 784. I cant look for the many 16 - 5's I get from the PLC because that is part of 1206.
I dont want to use a timer and assume the data gets to me in x seconds. (Perhaps I need to?)
Too bad they had to do it this way (I know they did it for a reason, unknown to me though).
Maybe there is a way to turn off the double transmission?
Thanks for any tips!