Menu

NoDaveComponent for Delphi

Help
2006-06-07
2013-05-09
  • Nobody/Anonymous

    Hello,

    Really, it's very interesting as forum, Thanks for all.

    I tried the nodavedemo (for Delphi) with S7-200 and it's well.
    What I notice that the connection with LPC is maintained only during the reading or writing process.
    I need a help for the following, please:
    I have to make a continous connection with S7-200, in other words I have to read some datas each 8/10sec and somtimes to write on it.
    How I can configure the nodave component parametres for this?

    Thank you for your help
    Regards
    Nour3

     
    • afk

      afk - 2006-06-07

      If the complete data is found in one continuous block inside the PLC, it's very easy:

      Set up the Protocol and the parameters for the protocol (IPAddress/IPPort or COMPort/COMSpeed and/or MPILocal, MPIRemote, MPISpeed), the CPURack and CPUSlot, the Area of the data to read, the BufLen (size of data in bytes), the BufOffs (start-address of the data within the area) and finally the Interval for the cyclic reading (in ms). Assign a method to the OnRead-event, and call the Connect-method of the component in your program-startup. After that, the OnRead-event is thrown after each read with the given Interval and you can use the Get...-methods of the component in your event-method to access the data.

      To write data into the PLC you can use the Write...-methods of the component, while the connection is active.

      Hope this helps

      Axel

       
    • Nobody/Anonymous

      Well, thanks for your quick replly.

      This is the problem,unfortunately the data is not in one continuous block inside the PLC.
      I have to read some datas from daveDB, others from Outputs, Inputs and Timer200.

      So, how I can proced in this case?
      Thanks
      Nour3

       
      • afk

        afk - 2006-06-07

        In this case you can't use the internal cyclic reading of the component. You must implement the read-cycle in your code, for example with a TTimer-component or in an own thread. Set up the connection-specific properties in the way I've written. In your read-method you have the choice between two ways to read the data data from the PLC:

        1. You can set up the properties Area, BufLen, BufOffs and DBNumber and call the method ReadBytes without any parameters for each block you want to read from the PLC. Then you can read the values from the internal buffer wit the Get...-methods and after that you can continue with the same procedure for the next block.

        2. You can allocate your own buffer-memory and call the ReadBytes-method with the parameters Area, DB, Start, Size and Buffer. Then your buffer is used and you must also pass the parameters Buffer (your buffer), BufOffs (Start-address), BufLen (Size of the buffer) as parameter to the Get...-methods.

        But if your data is fragmented in the PLC, avoid reading many short blocks from the PLC if it is also possible to read the same data in one larger block. It doesn't matter if there are some unused bytes between the data you want to read. I think you can read up to ~200 bytes with nearly the same speed as 2 bytes.

        Another way (only for reading) would be to copy the data in the PLC to one continuous block and read only this block with the TNoDave-component.

        Axel

         
    • Nobody/Anonymous

      Really, it is a big help for me from your side and that is appropriate to me perfectly.
      Just I would like to know if the following proposal is OK:
      If for each blocks of data which I need to read, I create a NoDave component instead of having several TTimer Components.
      Is it that ok?

      Nour3

       
      • afk

        afk - 2006-06-07

        It is possible to use multiple instances of TNoDave, but each instance uses its own connection, and the connections are limited on the PLC-side.  I use multiple instances of TNoDave only for different connections to different PLCs.

        I would use one TTimer instead and in the OnTimer-event I would sequentially read all the blocks in the way I've described.

        Axel

         
    • Nobody/Anonymous

      When I read a full datablock and I want just some non continous bytes, I should make many call of Get...-methods to go to the desired bytes or word.
      Look, I have the following situation:
      using ReadBytes Methode:
      - Area(Start, Size) = daveDB(25, 1)
      - Area(Start, Size) = daveDB(30, 4)
      - Area(Start, Size) = daveDB(42, 4)
      - Area(Start, Size) = daveDB(54, 4)
      - Area(Start, Size) = daveDB(90, 8)
      - Area(Start, Size) = daveOutputs(0, 5)
      - Area(Start, Size) = daveInputs(3, 3)
      and using ReadBits Methode:
      - Area(Start, Size) = daveTimer200(200, 1)
      - Area(Start, Size) = daveTimer200(201, 1)
      - Area(Start, Size) = daveTimer200(202, 1)
      Could you please me a short description how I can proced?

      If we change the NoDave parametres (Area of the data to read, BufLen, BufOffs...) the NoDave property Active must be False or not?
      In other words we can make a parametres changes on connecting Mode?

      Could you please give an exemple of the 2 choices that are mentioned above?
      Thanks for your help.
      Nour3

       
      • afk

        afk - 2006-06-09

        You can do the following:

        - TNoDave.ReadBytes(daveDB, 1, 25, 75)
        - TNoDave.GetByte(25)
        - TNoDave.GetDWord(30);
        - TNoDave.GetDWord(42);
        ...
        - TNoDave.ReadBytes(daveOutputs, 0, 0, 5)
        - TNoDave.GetByte(0)
        - TNoDave.GetByte(1)
        ...
        - TNoDave.ReadBytes(daveInputs, 0, 3, 3)
        - TNoDave.GetByte(3)
        - TNoDave.GetByte(4)
        ...
        - TNoDave.ReadBytes(daveInputs, 0, 3, 3)
        - TNoDave.GetByte(3)
        - TNoDave.GetByte(4)
        ...
        - TNoDave.ReadBytes(daveTimer200, 0, 25, 1)
        - TNoDave.GetBit(25, 0)
        - TNoDave.GetBit(25, 1)
        ...
        (This may be wrong, I don't know anything about addressing Timers in S7-200 PLCs)

        As I already mentioned, you can set the Interval-property of the component to zero and call the TNoDave.ReadBytes-method in an OnTimer-event, passing the parameters to this method. If you don't pass your own buffer to this method, the component uses an internal buffer. After that, you can read out the values with the Get...-methods in the way I described above. You shouldn't always change the properties of the component, because it's easier and faster to pass the parameters to the GetBytes-method.

        Axel

         

Anonymous
Anonymous

Add attachments
Cancel