S7 Strings <CR><LF>

pethoek

Member
Join Date
Apr 2009
Location
Järbo
Posts
105
I have i question regarding Strings in S7 and CR+LF

I'm communicating with 3:rd party device and my program sends text strings to poll data from this module.

Each telegram ends with asc(13)+asc(10) and i have a working program wher i have several telegrams in a DB declared as ARRAY[0..17] of BYTES where every telegram ends with asc(13), asc(10).

It would be more readable for the user if i could declare as STRING[18] instead.

So my question is, how do i write special charachters as <CR><LF> within the textstring.

When monitoring responses from the 3:rd party module in a VAT table i can see that S7 interprets those chars as '$r' and '$l' so i have tested to add thoose text combinations to my strings.

'mystring$r$l'

But the 3:rd party module don't respond to this.

Is there a way to solve this!

I want my string to be like 'mystring' + <CR> + <LF>


/Pethoek
 
I don't really understand what your problem is. If your String is always 18 characters long, then just create a String for 20 characters (or 18, if your 18 characters includes the CR & LF) and "manually" add the ASCII "13" and "10" in the last two locations.

Actually, rereading your post, it seems as if your data (telegram) is already available in the required form, so now I'm even more puzzled as to what your problem really is!
 
The letter A is spelled 'A', the letter j is spelled 'j'

What i was trying to say or ask, is, how do you spell Carriage Return and Line feed within an S7 string.

It works fine with array of chars where i explicitly can put asc(13) and asc(10) in byte pos 16 and 17. But when declared as string how do i put those chars in there (asc(13) and asc(10))

I tried $r and $l , but then my module stopped to respond.

But i found the error, i saw the SF light was red, and a ctrl+D stated that i had forgot to download the DB with the text strings.

Sorry for that. but it's working now.

Best regards
/Pethoek
 

Similar Topics

Hey all, was wondering if it was possible to shift values in an array of strings? I have a database that I am loading up with "Users" in the...
Replies
2
Views
295
hi All I am completely green in Mitsubishi PLC (i used to program siemens) but need kepware to connect to FX3U pls with ENET adp module. Could...
Replies
31
Views
7,078
Hi, I have a list selector which I want to display the recipe found inside a plc-5. The recipe is store in an ascii table with each character...
Replies
4
Views
1,404
I'm fairly new to View Studio SE. I'm trying to do a simple visibility animation, but I would like to do so with a string tag. The tag is one...
Replies
0
Views
1,210
For those of you that like living on the bleeding edge of development, you can do this without the need to resort to In/Outs and dummy references...
Replies
51
Views
25,945
Back
Top Bottom