I have a project where i need to split a string and send it in ascii code to an Domino Printer.
Concept: i get an String from an Zebra scanner looking like this : " R002043;5410761402862;Oil Plus 2C Comp.A - Gris Belge;1286193824;"
To start is the ";" the seperator. i found some functions to delete the ";" in a string. this is okay but now i want to convert each digit in the string into ascii like this:
R=82
0=48
0=48
2=50
0=48
...
This because the printer wants to receive a string like this:
<esc>OQ001TE 82 48 48 50 48 ...<eot></eot></esc>
Anyone who can help me with setting me on the right track with some advice?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
A standard string is actually a list of bytes that represent the ASCII code for each character.
The following part of code will give you the ASCII code of one of the characters in the string:
byChar:=sInput[i];
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Good afternoon,
I have a project where i need to split a string and send it in ascii code to an Domino Printer.
Concept: i get an String from an Zebra scanner looking like this : " R002043;5410761402862;Oil Plus 2C Comp.A - Gris Belge;1286193824;"
To start is the ";" the seperator. i found some functions to delete the ";" in a string. this is okay but now i want to convert each digit in the string into ascii like this:
R=82
0=48
0=48
2=50
0=48
...
This because the printer wants to receive a string like this:
<esc>OQ001TE 82 48 48 50 48 ...<eot></eot></esc>
Nice puzzle for a Saturday afternoon :-). Here my suggestion:
So the printer wants an ASCII conversion of the hex equivalent of ASCII characters??
They don't make it easy for us
@TimvH, Thank you, i think this way i can seperate the complete string to characters.
Next part of the topic is converting the characters to an ASCII code. Is there an standerd function in Codesys for this?
I alredy searched a few hours for it on the internet. no succes.
A standard string is actually a list of bytes that represent the ASCII code for each character.
The following part of code will give you the ASCII code of one of the characters in the string: