2 3 123
11 20 27

: object Pascal (Delphi)

  1. #11

    Oct 2010
    Athens, , Greece.
    :
    1,632


    ?
    ..

    Arduino . ..
    yagi 2,4....

    wifi .

    laptop repeater mode .
    , laptop, psp ..

    ...
    http://seventhgate.codeplex.com/



    sorry post....
    arduino object pascal?



    Burn baby, burn

  2. #12

    Mar 2012
    Athens, , Greece.
    :
    99
    quote: ?
    ,
    :
        arduino   object pascal?
    project Delphi modbus over TCP/Ip slave PLC S1200. h/w.

    E C. assembly . Zortech C compiler 1989. Borland C/C++ (386 instructions, code optimizations).
    M$oft .

  3. #13

    Oct 2010
    Athens, , Greece.
    :
    1,632
    , modbus slave arduinia..
    ..
    , master.
    , .

    object pascal
    windows? ..

    windows ...

    android based...


    Burn baby, burn

  4. #14

    Mar 2012
    Athens, , Greece.
    :
    99
    quote: windows ...
    , winda . .
    reboot "".

    (user interface) Jobs Standford .

    quote: object pascal windows? ..
    windows service, .

    1. UDP data 1,5k.
    http://www.cyberciti.biz/tips/linux-...-tutorial.html

    2. (shared) Win32 outputdebugstring http://www.codeproject.com/Articles/...putDebugString
    (debugview)
    http://technet.microsoft.com/en-us/s.../bb842059.aspx

    3. (publisher) TCP/IP .

    4. database .

    quote:
    android based...
    Mobile + core linux + Open Source + Java FPC + Java GUI API
    optoisolated I/O .
    APIs ..

    latop/desktop ? ?

  5. #15

    Oct 2010
    Athens, , Greece.
    :
    1,632
    data cloud .
    clueless..
    5-6 backup .
    cloud, happy...
    .
    , .
    , .


    din rail ethernet switch wifi access point .
    ( manual , , pdf wifi...) , .
    .)


    .
    , ...
    , ,
    .
    multitasking os, tcp/ip stack
    web server based .
    databases, , textu .

    laptop .
    netbook, tablet mainstream.
    .
    cloud.
    cloud ?
    .

    linux desktop. .
    , hardware. . , drivers. linux desktop

    computing .
    , flash, , , on steroids...
    windows office...

    Microsoft Novell. .

    Apple cloud computing ( ) . android .

    Microsoft . 25 .
    .

    Apple , .
    .

    .
    ..

    . , .

    , ...

    . [8D]

    Burn baby, burn

  6. #16

    Mar 2012
    Athens, , Greece.
    :
    99
    quote: , ...
    ...


    (Processes) (Threads)

    (CPU) 8 bits 64Bytes. (registers) (Instruction Pointer) . / . 2 16 bits (0..64535) .
    (interrupts).

    10 0..9. 9 ( 0 ). 16 0..9,A,B,C,D,E,F 8 0..7 2 0..1 ( / )

    Dipoli.
    There are only 10 types of people in the world: Those who understand binary, and those who don't.

    .

    BIOS.
    , (, floppy disk, hard disk, ) .

    RAM . .

    /, .
    (windows, linux) , .

    (/) (slices) .
    / (processes) , /, ( mouse) dlls.

    menu. . ( ). (thread) , process.

    (main thread) ( ). , button, . .
    thread. / threads .

    .

    threads , , 1 . -
    :
    move variable, accum, 
    Add  accum,1
    move accum, variable
    . 1 thread 2 thread. 2 1.

    .
    :
    Lock                 //    
    Load accum, variable //     
    Inc accum,1          //        1 
    Save accum, variable //     
    Unlock               //    
    .


  7. #17

    Mar 2012
    Athens, , Greece.
    :
    99
    Threads

    TMyThread TThread (override) execute.

    .
    thread Execute. thread.

    TMyThread constructor TMyThread. Create(CreateSuspended: Boolean). TThread.Create(true), Thread Resume .

    :
      TFileCopy = class(TThread)
       private
        FsrcFNames,
        FdstFnames:TStrings;
       protected
        procedure Execute; override;
       public
        constructor CopyFiles(const srcFNames,dstFnames:TStrings);
        procedure   Stop;
      end;
    
    
    
    procedure TFileCopy.Execute;
    ...
    begin
    ...
      while not Terminated do
       begin
    
    //    try/finally   objects
    
        fsrc:=nil;
        fdst:=nil;
        try
    
    //    exceptions   
    //     thread
    
         try
    
    //       
          PostMessage(UIHandle, COPY_EVENT, 1, fsrc.Size); 
    
         Except
    
    //         strings
          debug(Exception(ExceptObject).Message);
          PostMessage(UIHandle, COPY_EVENT, 0, 0);
    
         end;
    
        finally
         fdst.free;
         fsrc.Free;
        end;
    
       end;
    thread

    :
    procedure TFileCopy.Stop;
     begin
      Terminate;
      WaitFor;
     end;
    strings.

    :
      TMainFrm = class(TForm)
       
        procedure LogEvent(var Msg: TMessage); message LOG_EVENT;
       
       end;
    
    procedure TMainFrm.LogEvent(var Msg: TMessage);
     begin
      Log(pchar(msg.wParam));
      StrDispose(pchar(msg.wParam));
     end;
    
    procedure TMainFrm.FormCreate(Sender: TObject);
    begin
    ....
     UIHandle:=Handle;
    end;
    
    procedure Debug(const msg:string);
     var p:pchar;
     begin
      if UIHandle=INVALID_HANDLE_VALUE then
       outputdebugstring(pchar(msg))
      else begin
       p:=strNew(pchar(msg));
       PostMessage(UIHandle,LOG_EVENT,integer(p),0)
      end;
     end;
    strings reference counted record. record Fillchar. ( procedure Finalize)

    http://www.filefactory.com/file/6zop.../Example01.rar source & exe .

  8. #18

    Mar 2012
    Athens, , Greece.
    :
    99
    threads Sockets

    , , . , .

    /, , (working Threads). , (cores).

    (www.monachos.gr) . (/forum/) , ( ). . ( ) Sockets HTTP 1.0/1.1

    Sockets ()

    Socket 2 / (server & client) .

    , , .

    , (client socket) . , (listening socket) . , 2 , (server socket) 2 .

    http://www.inetdaemon.com/tutorials/...andshake.shtml

    SiteGrab

    . , . ( /) . , , .

    object .


    (TBasicWorkObject) .



    :
    TBasicWorkObject=class
       public
        procedure doWork; virtual; abstract;
       end;
    TGrabUrl TBasicWorkObject .

    :
      TGrabUrl=class(TBasicWorkObject)
       private
        FClientSocket: TClientSocket;
    ..
       public
        procedure   doWork; override;
        constructor Create(const aSite,aUrl:string;aDepth:integer); overload;
    ..
        property    Stream:TMemoryStream read FStream;
        property    Depth:integer read FDepth;
      end;
    TGrabUrl.doWork

    :
      postmessage(UIHandle,WORK_DONE,integer(self),0);
    .

    .



    , .
    , .

    :
      TThreadsMngr=class(TThread)
       private
        FPeriod:integer;
        FThreads,
        FWorkQ :TObjectList;
       ...
       public
        constructor Create(WorkThreadClass:TWorkThreadClass;
                           DefThreadCount:integer=10);
        ...
        procedure   QueueWork(work:TBasicWorkObject);
      end;


    2 (events) . , TBasicWorkObject.doWork .

    :
      TWorkThread=class(TThread)
       private
        FWorkObj   : TBasicWorkObject;
        ...
       public
        constructor Create(aId:integer;aHandle:THandle);
        procedure  Work(aWorkObj:TBasicWorkObject);
        ...
       end;
    
    procedure TWorkThread.Work(aWorkObj:TBasicWorkObject);
     begin
      FWorkObj:=aWorkObj;
      FWorkEvent.SetEvent;
      if Suspended then Resume; // FWorkEvent will signal imediatelly
     end;
    
    procedure TWorkThread.Execute;
    begin
      H[0] := FStopEvent.Handle;
      H[1] := FWorkEvent.Handle;
    
      while not Terminated do
       case WaitForMultipleObjects(2, @H, False, INFINITE) of
        WAIT_OBJECT_0     : Terminate; // StopEvent Signaled
        WAIT_OBJECT_0 + 1 : begin // WorkEvent Signaled
                             try
                              FWorkObj.doWork;
                             except
                             end;
                             FWorkEvent.ResetEvent; // Lower WorkEvent
                            end;
       end
    
     end;
    /forum/ (www.monachos.gr ) ( http://www.monachos.gr/forum/topic.asp? TOPIC_ID=3931) 1 .

    c:\temp\forum\default.htm

    source example02.rar
    http://www.filefactory.com/file/1pjn.../Example02_rar


    There always be one more bug.

  9. #19

    Mar 2012
    Athens, , Greece.
    :
    99
    TCP Sockets modbus

    H Borland, Embarcadero, socket components Open Source Indy components.

    client server . (blocking) . listening socket . Indy .

    (blocking) ( ) .

    TCP/IP
    http://synapse.ararat.cz/doku.php
    http://lnet.wordpress.com/

    sockets

    :
                  TCustomWinSocket (abstract)
              |              |                 |                
    TClientWinSocket  TServerClientWinSocket TServerWinSocket
    (client socket) : TClientWinSocket
    (listening socket) : TServerWinSocket
    (server socket): TServerClientWinSocket

    Components ( Object inspector). TCustomWinSocket

    :
                 
               TAbstractSocket (abstract)
                        |
                  TCustomSocket (abstract)
                    |         |
         TClientSocket   TCustomServerSocket (abstract)
                                 |
                            TServerSocket
    TWinSocketStream socket .

    ModBus

    . / ( ) .

    http://www.prosoft-technology.com/kb..._modbustcp.pdf
    http://www.modbus.org/tech.php

    2 (master-slave). master slave. slave master.

    Indy componets, ModBusTCP (http://sourceforge.net/projects/delphimodbus/) modbus TCP/IP.

    slave PLC . modbus master function codes 3 PLC ( ) .

    master modbus client socket.
    slave modbus tcp/ip server 502 .

    :
    |Modbus Application Protocol (MBAP) Header | Protocol Data Unit (PDU)|
    |------------------------------------------+-------------------------|
    |Transaction |Protocol  | Length  | Unit   | Function   |   Data     |
    |Identifier  |Identifier| Field   | ID     | Code       |            |
    |--------------------------------------------------------------------|
    | (2 bytes)  |(2 bytes) |(2 bytes)|(1 byte)|(1 byte)    |   |
    |------------------------------------------+-------------------------|
    source ModbusMaster.rar

    http://www.filefactory.com/file/6skb...dbusMaster_rar

    Modbus PLC Simulator
    http://www.plcsimulator.org/



    H $AA 4001 +0 leds M100.0 .. M100.7
    H float32 4001 +1 & 4001 +2 .
    3 bits 4001+3 leds M106.0 .. M106.2

    high byte 4001 +0.

    Theres always one more bug.

  10. #20

    Mar 2012
    Athens, , Greece.
    :
    99


    Modbus & big endian vs little endian

    16 bit 0x1234.

    ?.

    0, 1 KME (CPU) intel 34 12 (little endian) KME Motorola (o 68000) 12 34 (big endian).

    . , .

    modbus big endian .

    alarm (bit 0) 0x0001 simulator 0100 0001.

    ...

  • You may not post new threads
  • You may not post attachments
  •