Hi all,
Would you please give me an example, how I can read data from 3(three) PLC DL 06 simultaneously using RS232 and write it in 3 text files.
Eg.
0,1,0,0,0,1,0
0,0,1,1,0,0,0
1,1,0,0,1,0,1
Thanks in advance.
Triphon.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Danatas GerviPosted Nov 9, 2009, 12:53 PM
Ok, if you already have got your data,
And keep it in byte array (as example)
You want to save this data to text file?
This is the Pease of cake in .NET!
byte[] DataFromPLC = new byte[] { 1, 0, 2, 3, 4, 5, 1, 222, 1 }; // - anything
StringBuilder resultData = new StringBuilder(); // let say that we will recive a lot
//of data - so it better vay to work with long strings
foreach (byte oneByte in DataFromPLC)
{
resultData.Append(oneByte);
resultData.Append(","); // separator
}
System.IO.File.WriteAllText("c:\\test.txt", resultData.ToString());
Trifon DinevPosted Nov 9, 2009, 11:28 AM
If so, I have no problems, because I know how to do this, but if it is needed anything more then I need a help. That's why I want something which will guide me, may be not 100%.
Regards,
Triphon.
Danatas GerviPosted Nov 9, 2009, 10:36 AM
The information how to get data from PLC should be in this PLC manual…
I want to say that it is few chances, that on this forum somebody has the code exactly for your PLC DL 06…
I, for example, was working with Unitronics OPLC, so it was a message, array of bytes, with header, footer, data section etc…
But my code is useless for your case.
Could you ask more concentrated? What exactly you don't understand?