The Modbus Application Protocol which defines the data model and functions and a Network. A MODBUS communication stack requires two layers. MODBUS is a popular network protocol in the industrial manufacturing environment. FreeMODBUS is a free implementation of the popular MODBUS protocol specially targeted for embedded systems.
![]() ![]() Delphi Modbus Trial Manufacturing EnvironmentReleasing the output checkbox, is registered, the program executes the corresponding procedure and passes - depending on whether the checkbox is set or not - the structure SetBit filled with the appropriate values to the Web-IO.Procedure Twebio_binary_client.cb_outputMouseUp(Sender: TObject Button: TMouseButton Shift: TShiftState X, Y: Integer) SendBuffer := RawToBytes(SetBits, SetBits.EADriver.StructLength) The user can request the status of the outputs and inputs by clicking on the corresponding button.Procedure Twebio_binary_client.bt_outputs_readClick(Sender: TObject) SendBuffer := RawToBytes(EADriver, EADriver.StructLength) By sending the structure RegisterRequest the switching states of inputs and outputs are requested. For this the program uses the MouseUP event of this object. Setting the outputsThe user sets the outputs by using the two check boxes cb_output x. DisconnectingThe connection remains open until it is ended by the user clicking on the Disconnect button, or the Web-IO ends the connection.Procedure Twebio_ascii_client.bt_disconnectClick(Sender: TObject) Here again the ClientSocket control element invokes a corresponding procedure.Procedure Twebio_ascii_client.ClientSocketDisconnected(Sender: TObject) Operation and communication from the client sideAs soon as a connection is opened to the Web-IO, the user can use the corresponding program elements to send binary structures to the Web-IO. Therefore each individual structure must be converted before sending using RawToBytes into a byte array. The status line indicates that the connection has been established, the control elements are enabled for use and the Disconnect button is active again.By sending the structure Options to the Web-IO, the latter is instructed to send the changed state when an output is set, using the structure RegisterState.Procedure Twebio_binary_client.bt_disconnectClick(Sender: TObject) Procedure Twebio_binary_client.ClientSocketConnected(Sender: TObject) StatusBar1.SimpleText := ’Connected to ’ + ed_ip.Text SendBuffer := RawToBytes(Options, Options.EADriver.StructLength) ClientSocket.IOHandler.Write(SendBuffer) The Indy TIdTCPClient control element cannot directly send structures. Burnout paradise android apk downloadThe Web-IO replies with the structure AllCounter.Procedure Twebio_binary_client.bt_counter_readallClick(Sender: TObject) Procedure Twebio_binary_client.bt_counter_clearallClick(Sender: TObject) Receiving data from the Web-IO Process and display the received dataThe Web-IO returns the appropriate structure depending on the query or triggering event. The Web-IO replies with the structure Counter.Procedure Twebio_binary_client.bt_counter_readClick(Sender: TObject) ReadCounter.EADriver.StructLength := $0A If sender = bt_counter_read0 then ReadCounter.CounterIndex := 0 If sender = bt_counter_read1 then ReadCounter.CounterIndex := 1 SendBuffer := RawToBytes(ReadCounter, ReadCounter.EADriver.StructLength) Procedure Twebio_binary_client.bt_counter_clearClick(Sender: TObject) If sender = bt_counter_clear0 then ReadCounter.CounterIndex := 0 If sender = bt_counter_clear1 then ReadCounter.CounterIndex := 1 The structure type RegisterState ReadAllCounter or ReadClearAllCounter can be used to read or clear all the counters at the same time. Here the structure ReadCounter or ReadClearCounter is sent, whereby CounterIndex is used to send the number of the counter. Here the structure ReadRegister is sent, to which the Web-IO replies with the structure WriteRegister.Procedure Twebio_binary_client.bt_inputs_readClick(Sender: TObject) You can also query or clear the counter states of the input counters.
0 Comments
Leave a Reply. |
AuthorSharon ArchivesCategories |