Help with s7 and C# application

emo01

Level-1
Beiträge
1
Reaktionspunkte
0
Zuviel Werbung?
-> Hier kostenlos registrieren
Hi there,

I have to develop simple application which will connect to Simatic 300 and recieve the data from it (Format data block from screen shot in configuration panel is -> DB29 and lenght = 32)

Im using for it library libnodave but Im new in this area of knowlege so I have few questions.

1. I made connection to PLC VIA TCP (.opensocket (102.IP))

2. I recieve simple data using dc.readybytes(daveDB,29,0,32,buffer) but the resoults are like some numbers ( I believe there are bytes). What I need to do with it know ? Im trying to encode it using System.Text.Encoding.ASII.getString(buffe) but there is nothing in there...

3. My application has to work all the time, and in each x minutes has to check if the data are from the PLC, which is the best way to do it ? Using thread and loop while() is good one ?

4. If I want to recieve data from PLC what I need to know ? Do I need to send any information to PLC for start recieve data ??



Please help.

Regards
Emil
 
2. the library have some functions, also the function getbyte or getreal ... you have to know, what type the value have you want to get ...

3. do never use a loop for this stuff. set a timer with 60s ... you will find some help here:

Code:
Timer t1 = [COLOR=#0000FF]new[/COLOR] Timer(); [COLOR=#008000]// make a timer[/COLOR]
t1.Interval = 100; [COLOR=#008000]// set the time, here 100ms[/COLOR]
t1.Tick+=[COLOR=#0000FF]new[/COLOR] EventHandler(t1_Tick); [COLOR=#008000]// set the thread[/COLOR]
t1.Start(); [COLOR=#008000]// start the timer[/COLOR]

[COLOR=#0000FF]void[/COLOR] t1_Tick([COLOR=#0000FF]object[/COLOR] sender, EventArgs e)
{
[COLOR=#008000]// this code will be execute every timer tick[/COLOR]
}

4.you have to open the connection and send (with the right function, s.a. 2., the position) to get the data ...


... the libnodave library involved a .net, i think a c# sample ... just read it
 
Zurück
Oben