You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old November 12th, 2018, 10:46 AM   #1
Combo
Lifetime Supporting Member
Belgium

Combo is offline
 
Join Date: Jul 2002
Location: Belgium
Posts: 2,672
Making char empty in TIA Portal

Weird problem:

Stringtest:= '';
No problem, this works.

Chartest:= '';
This does not work... while the default value of an empty char is ''...

'' allocation is string format for TIA...

How to make Chars empty without tricks like using '0' or something, we want really empty like the default value of a char...

Kind regards,
Combo
  Reply With Quote
Old November 12th, 2018, 11:26 AM   #2
cardosocea
Member
United Kingdom

cardosocea is offline
 
Join Date: Nov 2016
Location: Fields of corn
Posts: 1,115
does 0, not '0' work? -> It doesn't.

Interestingly, the default for a char seems to be ' ', not ''... which is strange. Have you tried it?

Last edited by cardosocea; November 12th, 2018 at 11:28 AM.
  Reply With Quote
Old November 12th, 2018, 11:54 AM   #3
mk42
Member
United States

mk42 is offline
 
Join Date: Jun 2013
Location: MI
Posts: 1,964
default CHAR is a space. You can't just use '' with nothing between because it needs to always have a length of 1.

HOWEVER, there is an ASCII "null" character of value zero. This can either be entered as decimal or hex 0, or the escape character '$00'.

I've never messed with this before, so I'm not sure if there is unexpected behavior for this in some of the instructions. I know one that I was reading specifically said that it had no special behavior in case of $00, but to me that implies that other instructions might.
  Reply With Quote
Old November 12th, 2018, 12:32 PM   #4
Combo
Lifetime Supporting Member
Belgium

Combo is offline
 
Join Date: Jul 2002
Location: Belgium
Posts: 2,672
00$

Yeah well, you cannot assign 0.
But this works:

Chartest:= Byte_To_Char(0);

Indeed you get 00$

But we changed our program and when clearing an array of chars we do it like that. When counting a length in the chars array we changed the code to work with 00$

Thanks

Quote:
Originally Posted by mk42 View Post
default CHAR is a space. You can't just use '' with nothing between because it needs to always have a length of 1.

HOWEVER, there is an ASCII "null" character of value zero. This can either be entered as decimal or hex 0, or the escape character '$00'.

I've never messed with this before, so I'm not sure if there is unexpected behavior for this in some of the instructions. I know one that I was reading specifically said that it had no special behavior in case of $00, but to me that implies that other instructions might.
  Reply With Quote
Old November 12th, 2018, 12:51 PM   #5
L D[AR2,P#0.0]
Lifetime Supporting Member
United Kingdom

L D[AR2,P#0.0] is offline
 
Join Date: Nov 2006
Location: UK
Posts: 5,581
or this


#chartest := b#16#0;
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
TIA Portal v15 - does it overwrite v14 / v13? uptown47 LIVE PLC Questions And Answers 18 January 15th, 2018 11:28 AM
run Step 7 without TIA Portal dmned64 LIVE PLC Questions And Answers 4 June 7th, 2017 06:39 AM
So Finally, what are your final opinion about TIA Portal? Iner LIVE PLC Questions And Answers 11 January 12th, 2017 06:07 PM
License for TIA Portal ( from S7 to TIA ) Oliver Micka LIVE PLC Questions And Answers 2 November 29th, 2016 07:40 AM
Siemens OP77B Trouble in TIA Portal Tim James LIVE PLC Questions And Answers 4 December 24th, 2012 03:27 PM


All times are GMT -5. The time now is 08:37 AM.


.