Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: sgsims on April 19, 2024, 05:33:18 PM

Title: Streamin Instruction - Delimiter
Post by: sgsims on April 19, 2024, 05:33:18 PM
Hello:

I know this isn't a C# forum but I was wondering if this C# method and variable looks like it would succesfully send the delimter I need to have the streamin instruction result in a "Success"  Right now it is going into an "Error" and the only think I can figure is the delimiter.  Attached is a screenshot of how I have the streamin instruction configured.

This is the code that the Middleware is using to send the string to our serial port on the PLC.  <serialPortB.WriteLine(globeStatus)>  They tell me that the globeStatus parameter is a string variable type.  And they setting the globeStatus variable to "False".  And they tell me that the WriteLine method atomatically adds a newline delimiter to the end of the string.

I can see that the $SERIO_000A_B.InQueue is being popluated with data so it tells me data is succesfully getting to the PLC Serial Port but for some reason the streamin instruction is going to error.  They only thing I can think of is the delimeter being automatically added by the WriteLine method is somehow not being recoginzed by the StreamIn instruction.

The PLC program has been working without issue for years with a diffreent host.  They just changed their host (ERP) and now we are having issues.

Scott

Title: Re: Streamin Instruction - Delimiter
Post by: Greg on April 26, 2024, 03:25:58 PM
...the streamin instruction result in a "Success"  Right now it is going into an "Error" and the only think I can figure is the delimiter.

It would not be because the STREAMIN doesn't recognize the delimiter. Instead, it would be that the requirements you have configured for the STREAMIN are not met before the "Network Timeout" occurs. For instance, I noticed that you said this:

...And they tell me that the WriteLine method atomatically adds a newline delimiter to the end of the string.

A "newline delimiter" would be carriage return (0x0d) and line feed (0x0a), and usually in that order. Your STREAMIN instruction is, however, configured for "Any one delimiter(s)." Why not try "Exact sequence" setting and see. Also, perhaps uncheck "Trim Delimiter(s) from Output String" just as a test. And if that doesn't work, change the order from 0x0d, 0x0a, to 0x0a, 0x0d and see what happens.

Honestly, it's usually something this simple. You can test this by having the onboard serial port send a string to your SERIO module, or have your B port send something to your A port, and vice versa. This would prove it to you that the STREAMIN is doing what it is supposed to do.

I'm also no C# expert by any means.  :-\ Franji1 and BobO certainly are.  8)
Title: Re: Streamin Instruction - Delimiter
Post by: sgsims on April 26, 2024, 04:05:42 PM
Thanks Greg...interestin about the streamin not recognizing the delimiter...so is something outside the streamin instruction recognizing the requreiments,  ie delimiter and or data byte length and if those conditions set in the streamin instruction or met then the streamin instruction then gets passed the data for processing to the specifiied memory location...I know that has nothing ot do with my original inquiry but just curious.

Yes,  I think in the end I need to setup a test enviornment as you sugested...I will do that.

The delimiter paramter in the streamin is presented in Hex but is it accurate to say that what ver is send the delimiter to the serial port is just sending a bit pattern....ie for (CR) (0x0d) hex would be a binary bit pattern of (1101) ?
Title: Re: Streamin Instruction - Delimiter
Post by: Greg on April 26, 2024, 04:39:20 PM
It is a "bit pattern," yes, and defined by where you put it. Carriage return is 0x0d, or in binary 0000 1101. If that byte ended up in, say, N0, or some other integer memory, then it would be 13. All these have the same "bit pattern" but are interpreted in different ways.
Title: Re: Streamin Instruction - Delimiter
Post by: sgsims on April 26, 2024, 04:44:38 PM
Thanks...I was hoping I had that part right....I think that is what confuses many people...even so called programmers.