Making char empty in TIA Portal

userxyz

Member
Join Date
May 2002
Location
any
Posts
2,768
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
 
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:
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.
 
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

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.
 

Similar Topics

Hi, I have seen a few post with similar topics and I have tried contacting the authors however I have not had any luck so I am posting this new...
Replies
14
Views
939
Hi everyone I've created an FC that includes the blocks TCON, TDISCON, TSEND and TRCV. This block has to be as generic as possible across...
Replies
15
Views
1,410
Hi all, I have been working on a tool for my company that handles a specific task our company runs into often related to PLC's. This is a tool I...
Replies
15
Views
2,854
Hi, i need to make: 1- A PLC Program on Omron PLC CP2E-N using high speed counter E6C3-AG5B 360P/R 2M(Absolute) ,to Reject bottles on Conveyor...
Replies
4
Views
831
I was taught to go to Combined > Make Change > go to Offline > will prompt to save > Save > Exit out of program > will prompt to save again >...
Replies
0
Views
663
Back
Top Bottom