Menu

Some questions

Help
2006-12-18
2013-05-09
  • Nobody/Anonymous

    Hello!

    I just downloaded libnodave and think it is great, I´m playing around trying to use it for communication with a 315-2 pn/dp.

    A have a question about the delphi demo app. The app connects and reads data from a DB. But if I change the data in the DB (from the PLC)while reading from the demo app, this is not updated in the PC. (I can se no change in value from the PC).

    I also made a small app myself where I used a timer instead of the built in readingthread and just do:
    ReadBytes(
    Getword(

    in the timer event, then everything works.
    But when using "onread" (readingthread) I don´t see the change in data.

    I´m using delphi2005.

    What am I´m doing wrong?

    Then the next question is how to implement this.

    loop
    read from Db
    Write To DB
    sleep(milisecond)
    .

    If I use a timer the software stops responding if I ex. removes the networkcable, until timeout, this is not wanted..
    If i use a seperate thread that both calls read and write I get syncronization problems..
    How can this be implemeted?

    Excuse my bad english and knowledge about delphiprogramming =)

    Thanks!

     
    • afk

      afk - 2006-12-18

      The missing Update in the Delphi-Demo and in the reading-thread is caused by an bug in the method TNoDaveReadThread.Execute, which will be fixed in the next release, thus there is nothing you're doing wrong.

      To fix this by yourself, you must change the line

      "NoDave.DoReadBytes(NoDave.Area, NoDave.DBNumber, NoDave.BufOffs, NoDave.BufLen);"

      to

      "NoDave.ReadBytes;"

      in that method, and then recompile the component and the demo-program.

      When your Software is reading/writing data from/to the PLC within the main thread, then it's anways not responding while waiting for a timeout after the network-connection was lost. You can avoid this by using at least on separate thread, but then you should use critical sections to prevent the syncronisation problems.

      Axel

       

Anonymous
Anonymous

Add attachments
Cancel