hassanayoub85
Member
Dear,
My problem is how to read special variables (pressure, temperature, ...) from tcp raw data stream generated each 100 milliseconds and use them.
And in details:
I have an arduino board whih is sending datas: pressure, airspeed, internal temperature, external temperature as (p: 1.1111, a: 2.2222, i: 3.3333, e: 4.4444) each 100 milli seconds through tcp/ip.
From terminal, i connect to arduino iport, ansd i see the data, each data on a new line.
From my PLC S7-1200, I am trying to read the dataand parse them using T_RCV ladder block.
The data are comming to the datablock db1.data (string), but the problem is that the data each time is refreshed it get randomly part of the data like:
1- p: 1.11
2- 33, e: 4.444
3- 1.111, a: 2.222, i:
and so on.
1- How can I make the data come like in terminal exactly?
So always, the db1.data
[0] = p
[1] = :
[2] = {space}
[3] = 1 (or other number generated by arduino)
etc...?
2- How can I control the refresh time of the T-RCV?
3- can I make T_RCV start recieve data on special charactyer till another special character? or an exact amount of characters like 33?
4- How can I put the recieved data of pressure (1.1111) which are on db1.data[3] to db1.data[8] in a plc tag?
5- after putting the datas (1.1111) on a tag, how to convert it to float again, to be able to multiply by a number?
Thanks in advaanced.
My problem is how to read special variables (pressure, temperature, ...) from tcp raw data stream generated each 100 milliseconds and use them.
And in details:
I have an arduino board whih is sending datas: pressure, airspeed, internal temperature, external temperature as (p: 1.1111, a: 2.2222, i: 3.3333, e: 4.4444) each 100 milli seconds through tcp/ip.
From terminal, i connect to arduino iport, ansd i see the data, each data on a new line.
From my PLC S7-1200, I am trying to read the dataand parse them using T_RCV ladder block.
The data are comming to the datablock db1.data (string), but the problem is that the data each time is refreshed it get randomly part of the data like:
1- p: 1.11
2- 33, e: 4.444
3- 1.111, a: 2.222, i:
and so on.
1- How can I make the data come like in terminal exactly?
So always, the db1.data
[0] = p
[1] = :
[2] = {space}
[3] = 1 (or other number generated by arduino)
etc...?
2- How can I control the refresh time of the T-RCV?
3- can I make T_RCV start recieve data on special charactyer till another special character? or an exact amount of characters like 33?
4- How can I put the recieved data of pressure (1.1111) which are on db1.data[3] to db1.data[8] in a plc tag?
5- after putting the datas (1.1111) on a tag, how to convert it to float again, to be able to multiply by a number?
Thanks in advaanced.