![]() ![]() ![]() ![]() ![]() ![]() |
||
![]() |
||
![]() ![]() ![]() ![]() This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc. |
||
![]() |
![]() |
#1 |
Member
![]() ![]() Join Date: Aug 2002
Location: Aveiro
Posts: 11
|
MPI comunication
Hi there
I need to implement comunication between VB applications and VIPA/Siemens PLCs throug the MPI port. Does any one have any ActiveX or DLL, examples and description of how to use them in a Visual Basic program? The solution with an OPC server/client is very expensive since I have to buy a licence for each PC. Step 7 has a DLL (W95_S7.DLL) for this comunication. Does any one know how to use it?
__________________
Manuel Raposo Last edited by Manuel Raposo; January 7th, 2004 at 11:23 AM. |
![]() |
![]() |
#2 |
Member
![]() ![]() Join Date: Dec 2003
Posts: 61
|
Hi Manuel,
I don't see a need to go for OPC Client/Server if you're planning to use VB or C to communicate with the PLC through MPI. When you install Step7, dll files will be generated so that you add them to your VB application and use them to communicate with the PLC. These dll files are komfort.dll and w95_s7m.dll. Attached please find the manual on how to write your VB/C application to communicate with the PLC.
__________________
Best Regards, Naser |
![]() |
![]() |
#3 |
Member
![]() ![]() Join Date: Aug 2002
Location: Aveiro
Posts: 11
|
![]()
Hi Naser,
I have the Step7 (ver. 5.1) instaled in my computer but I can't find those DLLs. Do I need to install any option? I also couldn't find your attachment.
__________________
Manuel Raposo |
![]() |
![]() |
#4 |
Member
![]() ![]() Join Date: Dec 2003
Posts: 61
|
What's your e-mail address?
__________________
Best Regards, Naser |
![]() |
![]() |
#5 |
Member
![]() ![]() Join Date: Aug 2002
Location: Aveiro
Posts: 11
|
![]() |
![]() |
![]() |
#6 |
Member
![]() ![]() Join Date: Dec 2003
Posts: 61
|
Manuel,
I received an e-mail from you and I replied to it with an attachment. Please let me know if you haven't got them yet.
__________________
Best Regards, Naser |
![]() |
![]() |
#7 |
Member
![]() ![]() Join Date: Jan 2004
Posts: 1
|
Hi,
I'm also interested in VB applications. Could someone send me this information also? Thanks, Gert tregje@hotmail.com |
![]() |
![]() |
#8 |
Guest
Posts: n/a
|
Uh, me too
|
![]() |
![]() |
#9 |
Member
![]() ![]() Join Date: Dec 2003
Posts: 61
|
Free Web site hosting - Freeservers.com • Web Hosting - GlobalServers.com
PRODAVE S7 Toolbox for MS-DOS and WINDOWS 3.11/95/NT Applications for a Data Link of PGs/PCs to SIMATIC S7 via MPI Interface and PC/MPI Cable -------------------------------------------------------------------------------- 1. Introduction Due to their constantly increasing performance and vast availability of PC applications for the manufacturing process, the Personal Computer is being used more and more on the factory shop floor in addition to the programming unit. This, however, poses the problem to you as the user how to combine the variety of programs for handling of process data (e.g. data banks, statistical evaluation) with your existing PLC systems. In order to make PLC data available for the PC application you will need a working and cost effective data link between PLC and PC. This is where the software package PRODAVE S7 will offer the solution. PRODAVE S7 offers tried and tested functions (tools) in a DLL (Dynamic Link Library) or LIB (Library) which you can combine for each of your applications. The combination of the tools is carried out in programming languages for Windows NT, Windows 95, Windows 3.11 or MS-DOS. Via these combined functions the process data traffic between PLC and PG/PC is established by PRODAVE S7 using the MPI interface of the PLC. The data now available can be translated into a format suitable for PCs and can be processed by your own application or any standard application. This will enable you to create a data link between PLC and PG/PC without having detailed knowledge, and all your development activities can be concentrated on specific processing of your data. PRODAVE S7 enables you to not only evaluate and monitor but to influence your process as well inasmuch that you can have several functions available to you to enable you to write data to the PLC from the PG/PC. PRODAVE S7 runs under MS-DOS or Windows 3.11 and Windows 95/98/NT on PG 7xx and on Pcs which are compatible to Industrial Standard in conjunction with MPI interfaces (CP5411, CP5511, CP5611) or PC/MPI cables. The PRODAVE functions can be divided into 3 basic types: 1.1 Basic Functions - initialize and de-initialize system (load_tool, unload_tool). - activate connection (new_ss). 1.1.1 Functions for Data Transfer to S7 300/400 - read output bytes from PLC (a_field_read) - write output bytes (a_field_write) - read input bytes from PLC (e_field_read) - read data bytes from a block DB (d_field_read) - write data bytes to a block DB (d_field_write) - read flag bytes from PLC (m_field_read) - write to flag bytes in PLC (m_field_write) - status test of a flag (mb_bittest) - set and reset flag (mb_setbit, mb_resetbit). - read timer words from PLC (t_field_read). - read counter words from PLC (z_field_read). - overwrite counter words in PLC (z_field_write). - read mixed data (mix_read). - write mixed data (mix_write). 1.1.2 Functions for Data Transfer to S7 200 - read output bytes from PLC (as200_a_field_read). - write output bytes (as200_a_field_write). - read input bytes from PLC (as200_e_field_read). - read data bytes from variable memory (as200_vs_field_read). - write data bytes to variable memory (as200_vs_field_write). - read flag bytes from PLC (as200_m_field_read). - write to flag bytes in PLC (as200_m_field_write). - read special flag bytes from PLC (as200_sm_field_read). - write to special flag bytes in PLC (as200_sm_field_write). - status test of a flag (as200_mb_bittest). - set and reset flag (as200_mb_setbit, as200_mb_resetbit). - read timer words from PLC (as200_t_field_read). - read counter words from PLC (as200_z_field_read). - overwrite counter words in PLC (as200_z_field_write). - read mixed data (as200_mix_read). - write mixed data (as200_mix_write). 2. Description 2.1 Operating Mode of PRODAVE Using the programming package PRODAVE S7 you can read data from a programmable logic controller (PLC) and write data to a PLC under Windows95, Windows NT, Windows 3.11 or MS-DOS via several CPUs from the S7-series. PRODAVE S7 consists basically of two parts: - driver for Windows 95 and Windows NT or Windows 3.11 and MS-DOS - high language adaptor PRODAVE S7 offers the adaptor for Windows 95/NT in the form of a 32-Bit-DLL (Dynamic Link Library) created in VC++ Version 5.0, for Windows 3.11 in the form of a 16-Bit-DLL created in BC Version 3.1. The adaptors for MS-DOS are available as MSC-/ and BC-Libraries in the Large-Model. If you wish to read data from the PLC or write data to the PLC using a high language, you will only require the adaptor and its functions. 2.2 Use of the High Language Adaptor A detailed description of the available functions for the various programming languages of this manual can be found in Chapter 4 "Description of the PRODAVE Functions". 2.3 Pre-requisites PRODAVE S7 operates with the following PLC types: S7-200, S7-300, S7-400, M7 and C7 from the S7 series. Software-Prerequisites: Operating System MS-DOS, Windows 3.11, Windows 95 or Windows NT V4.x. Hardware-Prerequisites: PRODAVE S7 DOS/WFWPG 7xx or AT compatible Industrial-PC with 8MB main memory and MPI-ISA-interface, PC/MPI-cable or PC/PPI-cable. 2.4 Connection of PG/PC to PLC 2.4.1 Driver under Windows 95/NT The PG/PC may be connected to the PLC by means of the following components: o CP 5611 PCI-Card o CP 5511 PCMCIA-Card o CP 5411 ISA-Card o MPI-ISA-Card or MPI-ISA on Board (PG 720/740/760, PC RI45,25,FI25) o COM 1/2 via PC-Adapter Installation and set-up of the required hardware is carried out via the STEP7-Tool PG/PC interface parameterization, which is available in the system after successful installation. 3 Working with PRODAVE The user program is written in a high language and the function calls are used in the form listed in Para. 4 "Description of PRODAVE Functions". 3.3.1 Notes on S7-200 When creating a data link to S7-200 it is not allowed to have more than one connection parameterised in the load_tool function. The connection is initialised by means of the load_tool function. This is followed by the user specific part, where you may only call the as200_...... functions from the adaptor (see also Para. 4.1.2 “Basic Functions for Data Transfer S7-200 “). When you wish to end your program, it is required to de-initialise the connections by means of the unload_tool function. 3.3.2 Notes on AS300/400 The obligatory start of each user program is the initialisation of the connections by calling the function load_tool. This is followed by the user specific part, where you can call any amount of PRODAVE functions (with the exception of the as200_.... functions) from the adaptor. When you wish to end your program, it is required to de-initialise the connections by means of the unload_tool function. When carrying out the development of your program, the following points should be noted to avoid data loss or a system crash: - Prior to leaving the program, the connections must be de-initialised by calling the adaptor function unload_tool! - When reading data from the PLC, the fields into which data is to be transferred, must be big enough to receive this data as the adaptor does not carry out a field check! - The error text file must be located in the same directory as the developed program as otherwise the adaptor will not be able to read the error texts! - In order to avoid a repeated “check if it exists” of the error text file, you can call the function error_message at the start of the program to enable you to output an appropriate message in the event of an error. This error text file is loaded when calling this function for the first time. - Prior to starting the PRODAVE application under MS-DOS it is required to activate the drivers for the used interface. 3.4 Differences between S5 and S7 The main difference between S5-PLCs and S7-PLCs is the management of data blocks. S5 data blocks are processed word by word, whereas the S7 data blocks are processed byte by byte. When using the d_field_read function, the data block is accessed byte by byte such as, for instance, applies to the flag area. When you read 3 data words using the db_read function, the PLC transfers DBW0 - DBW5. I.e. three 16bit words are available for processing in the PG/PC, which the PLC addresses via DBW0, DBW2 and DBW4, by the PG/PC, however, they are addressed via DW0, DW1 and DW2. 3.5 Linking to Standard Tools
__________________
Best Regards, Naser |
![]() |
![]() |
#10 |
Member
![]() ![]() Join Date: Dec 2003
Posts: 61
|
3.5 Linking to Standard Tools
3.5.1 PRODAVE under Delphi (32-Bit) Example To enable you to use the PRODAVE functions under Delphi, they must be declared as follows: function Load_tool ( no:Byte; name: {pointer} PChar; adr:{pointer} PChar):Integer; stdcall external 'w95_s7.dll' name 'load_tool'; function DB_read ( dbno:Integer; dwno:Integer; var amount:Integer; var buffer):Integer stdcall; external 'w95_s7.dll' name 'db_read'; function Unload_tool:Integer; stdcall; external 'w95_s7.dll' name 'unload_tool' Example: var plc_adr_table : array [0..15] of byte; name:array[0..255] of char; res ,amount: integer; buffer : array[0..255] of word; begin ..... plc_adr_table[0] := 2; {address} plc_adr_table[1] := 0; {segment id} plc_adr_table[2] := 2; {slotno} plc_adr_table[3] := 0; {rackno} plc_adr_table[4] := 0; strcopy(name,'S7ONLINE'); res := Load_tool(1,addr(name),addr(plc_adr_table[0])); res := DB_read(10,0,amount,buffer); res := Unload_tool; .... end; 4.1 Functions load_tool This function initialises the adaptor, checks if the driver is loaded, initialises the parameterised addresses and switches the selected interface to active. Under MS-DOS and Windows 3.11 it is possible to parameterise a maximum of 4 connections, under Windows 95 a maximum of 16. C-Adapter int load_tool (int nr,char* device,char* adr_table); unload_tool This function deinitialises the connections and the adaptor and must be re-called prior to leaving the application! If there were no errors, the function supplies 0 as the return value otherwise an error message which can be evaluated in accordance with the error table (see error_message). C-Adapter int unload_tool(void); a_field_read The function a_field_read reads “amount” of output bytes from the PLC starting from "no" and stores the read value into variable field of the PG/PC. If there were no errors, the function supplies 0 as the return value, otherwise an error message which can be evaluated in accordance with the error table (see error_message). C-Adapter int a_field_read (int no,int anzahl,void * buffer); a_field_write The function a_field_write writes "amount" of bytes from the specified storage area into the PLC starting from output byte "no". If there were no errors, the function supplies 0 as the return value, otherwise an error message which can be evaluated in accordance with the error table (see error_message). C-Adapter int a_field_write (int no,int anzahl,void* buffer); ag_zustand This function reads the PLC status (RUN or STOP) from the PLC and stores the data in a storage area of the PG/PC. buffer[0] = 0 _ AG is in RUN buffer[0] = 1 _ AG is in STOP buffer[0] = 1 _ AG is in RESTART C-Adapter int ag_zustand (void * buffer) db_read The function db_read reads an “amount“ of data words from a data block in the PLC and transfers them into a variable field of the PG/PC. If the data block does not exist, this is indicated by a return value = error number. If the data which is being read, exceeds the amount available in the data block, the " amount” is corrected and error message 303 hex is returned. Important! The data words are stored in the "buffer" not in accordance with Intel-Notation (low byte - high byte) but in STEP5-Notation (high byte - low byte). This is important if the data is processed further. If there were no errors, the function supplies 0 as the return value otherwise an error message which can be evaluated in accordance with the error table (see error_message). C-Adapter int db_read (int dbno, int dwno, int* anzahl, void* buffer); db_write The function db_write writes an amount of data words from a variable field of the PG/PC into the PLC.If the data block does not exist this is indicated by a return value = error number. If the data which is being written, exceeds the amount available in the data block, the " amount” is corrected and error message 303 hex is returned. Important! The data words must be stored in "buffer" in accordance with STEP5-Notation (high byte - low byte). C-Adapter int db_write (int dbno,int dwno, int* anzahl, void* buffer); DELPHI 32 - Unit S7_DLL by omarzucchiatti@libero.it {************************************************* ****************** PLC S7 - PC Interface Communication Version : 1.6 Unit : S7_DLL.PAS Author : omarzucchiatti@libero.it ************************************************** ******************} Unit S7_DLL; Interface Uses SysUtils, Dialogs; function Connect ( no:Byte; name: {pointer} PChar; adr:{pointer} PChar) :Integer; stdcall; external 'w95_s7.dll' name 'load_tool'; {This function initialises the adaptor, checks if the driver is loaded, initialises the parameterised addresses and switches the selected interface to active. Under MS-DOS and Windows 3.11 it is possible to parameterise a maximum of 4 connections, under Windows 95 a maximum of 16. The following 3 parameters are transferred to this function: no - number of active connection (1..4). device - device name (zero terminated) of the used driver e.g. S7ONLINE for the MPI driver or ZERO (default). adr_table - pointer to address list of the connected party. In this instance adr = 0 is interpreted as the end identifier of the list. Example: VAR Plc_Addr_Table : Array [0..15] of Byte; S7_Name : Array [0..255] of Char; res, Amount : Integer; Buffer : Array [0..255] of Word; Plc_Addr_Table[0] := 2; //address Plc_Addr_Table[1] := 0; //segment id Plc_Addr_Table[2] := 2; //slotno Plc_Addr_Table[3] := 0; //rackno Plc_Addr_Table[4] := 0; Strcopy(S7_Name,'S7ONLINE'); res := Connect(1,Addr(S7_Name),Addr(Plc_Addr_Table[0])); }
__________________
Best Regards, Naser |
![]() |
![]() |
#11 |
Member
![]() ![]() Join Date: Dec 2003
Posts: 61
|
function DB_read ( dbno:Integer; dwno:Integer; var amount:Integer; var buffer)
:Integer stdcall; external 'w95_s7.dll' name 'db_read'; {The function db_read reads an ôamountô of data words from a data block in the PLC and transfers them into a variable field of the PG/PC. If the data block does not exist, this is indicated by a return value = error number. If the data which is being read, exceeds the amount available in the data block, the " amountö is corrected and error message 303 hex is returned. Important! The data words are stored in the "buffer" not in accordance with Intel-Notation (low byte - high byte) but in STEP5-Notation (high byte - low byte). This is important if the data is processed further.} function DB_Write( dbno:Integer; dwno:Integer; var amount:Integer; var buffer) :Integer stdcall; external 'w95_s7.dll' name 'db_write'; {The function db_write writes an amount of data words from a variable field of the PG/PC into the PLC. If the data block does not exist this is indicated by a return value = error number. If the data which is being written, exceeds the amount available in the data block, the " amountö is corrected and error message 303 hex is returned. Important! The data words must be stored in "buffer" in accordance with STEP5-Notation (high byte - low byte).} function PLC_Status(var buffer) :Integer stdcall; external 'w95_s7.dll' name 'ag_zustand'; {This function reads the PLC status (RUN or STOP) from the PLC and stores the data in a storage area of the PG/PC. buffer[0] = 0 - AG is in RUN buffer[0] = 1 - AG is in STOP buffer[0] = 1 - AG is in RESTART} function Error_Message( Res:Integer ):STRING; {This function supplies the approprioate error text relating to an error message in the form of a zero terminated character string.} function Disconnect :Integer; stdcall; external 'w95_s7.dll' name 'unload_tool'; {This function deinitialises the connections and the adaptor and must be re-called prior to leaving the application! ---------------------------------------- MOTOROLA and INTEL byte order conversion ---------------------------------------- Be aware that in SIMATIC the LSB/MSB bytes order is reversed: SIMATIC: 15..............0 BYTE 0 BYTE 1 INTEL: 15..............0 BYTE 1 BYTE 0 To obtain the correct integer value of a dataword on INTEL processors, the user must therefore: - swap the received bytes and - swap the bytes before sending them to the PLC} function ReadInt(Word_: Word):Integer; procedure WriteInt(IntNr:Integer; var Word_: Word); function ReadDInt(Low_Word: Word; High_Word: Word):Longint; procedure WriteDInt(LongNr:Longint; var Low_Word: Word; var High_Word: Word); function ReadReal(Low_Word: Word; High_Word: Word):Single; procedure WriteReal(FloatNr:Single; var Low_Word: Word; var High_Word: Word); implementation function Error_Message( Res:Integer ):STRING; BEGIN IF Res<>0 THEN BEGIN Result := 'ERROR: ' + Format('%x',[Res]); CASE Res OF $00CA : Result := Result + (' No resources available'); $00CB : Result := Result + (' Configuration error'); $00CD : Result := Result + (' Illegal call'); $00CE : Result := Result + (' Module not found'); $00CF : Result := Result + (' Driver not loaded'); $00D0 : Result := Result + (' Hardware fault'); $00D1 : Result := Result + (' Software fault'); $00D2 : Result := Result + (' Memory fault'); $00D7 : Result := Result + (' No message'); $00D8 : Result := Result + (' Storage fault'); $00DB : Result := Result + (' Internal timeout'); $00E1 : Result := Result + (' Too many channels open'); $00E2 : Result := Result + (' Internal fault'); $00E7 : Result := Result + (' Hardware fault'); $00E9 : Result := Result + (' Sin_serv.exe not started'); $00EA : Result := Result + (' Protected'); $00F0 : Result := Result + (' Scp db file does not exist'); $00F1 : Result := Result + (' No global dos storage available'); $00F2 : Result := Result + (' Error during transmission'); $00F3 : Result := Result + (' Error during reception'); $00F4 : Result := Result + (' Device does not exist'); $00F5 : Result := Result + (' Incorrect sub system'); $00F6 : Result := Result + (' Unknown code'); $00F7 : Result := Result + (' Buffer too small'); $00F8 : Result := Result + (' Buffer too small'); $00F9 : Result := Result + (' Incorrect protocol'); $00FB : Result := Result + (' Reception error'); $00FC : Result := Result + (' Licence error'); $0101 : Result := Result + (' Connection not established / parameterised'); $010A : Result := Result + (' Negative acknowledgement received / timeout error'); $010C : Result := Result + (' Data does not exist or disabled'); $012A : Result := Result + (' System storage no longer available'); $012E : Result := Result + (' Incorrect parameter'); $0132 : Result := Result + (' No memory in DPRAM'); $0201 : Result := Result + (' Incorrect interface specified'); $0202 : Result := Result + (' Maximum amount of interfaces exceeded'); $0203 : Result := Result + (' PRODAVE already initialised'); $0204 : Result := Result + (' Wrong parameter list'); $0205 : Result := Result + (' PRODAVE not initialised'); $0206 : Result := Result + (' Handle cannot be set'); $0207 : Result := Result + (' Data segment cannot be disabled'); $0300 : Result := Result + (' Initialisiation error'); $0301 : Result := Result + (' Initialisiation error'); $0302 : Result := Result + (' Block too small, DW does not exist'); $0303 : Result := Result + (' Block limit exceeded, correct amount'); $0310 : Result := Result + (' No HW found'); $0311 : Result := Result + (' HW defective'); $0312 : Result := Result + (' Incorrect config param'); $0313 : Result := Result + (' Incorrect baud rate / interrupt vector'); $0314 : Result := Result + (' HSA parameterised incorrectly'); $0315 : Result := Result + (' MPI address error'); $0316 : Result := Result + (' HW device already allocated'); $0317 : Result := Result + (' Interrupt not available'); $0318 : Result := Result + (' Interrupt occupied'); $0319 : Result := Result + (' Sap not occupied'); $031A : Result := Result + (' No remote station found'); $031B : Result := Result + (' Internal error'); $031C : Result := Result + (' System error'); $031D : Result := Result + (' Error buffer size'); $0320 : Result := Result + (' Hardware fault'); $0321 : Result := Result + (' DLL function error'); $0330 : Result := Result + (' Version conflict'); $0331 : Result := Result + (' Error COM config'); $0332 : Result := Result + (' Hardware fault'); $0333 : Result := Result + (' COM Port not configured'); $0334 : Result := Result + (' COM Port not available'); $0335 : Result := Result + (' Serial drv in use'); $0336 : Result := Result + (' No connection'); $0337 : Result := Result + (' Job rejected'); $0380 : Result := Result + (' Internal error'); $0381 : Result := Result + (' Hardware fault'); $0382 : Result := Result + (' No driver or device found'); $0384 : Result := Result + (' No driver or device found'); $03FF : Result := Result + (' System fault'); $0800 : Result := Result + (' Toolbox occupied'); $4001 : Result := Result + (' Connection not known'); $4002 : Result := Result + (' Connection not established'); $4003 : Result := Result + (' Connection is being established'); $4004 : Result := Result + (' Connection broken down'); $8000 : Result := Result + (' Function already actively occupied'); $8001 : Result := Result + (' Not allowed in this operating status'); $8101 : Result := Result + (' Hardware fault'); $8103 : Result := Result + (' Object access not allowed'); $8104 : Result := Result + (' Context is not supported'); $8105 : Result := Result + (' Invalid address'); $8106 : Result := Result + (' Type (data type) not supported'); $8107 : Result := Result + (' Type (data type) not consistent'); $810A : Result := Result + (' Object does not exist'); $8301 : Result := Result + (' Memory slot on CPU not sufficient'); $8404 : Result := Result + (' Grave error'); $8500 : Result := Result + (' Incorrect PDU size'); $8702 : Result := Result + (' Address invalid'); $D201 : Result := Result + (' Syntax error block name'); $D202 : Result := Result + (' Syntax error function parameter'); $D203 : Result := Result + (' Syntax error block type'); $D204 : Result := Result + (' No linked block in storage medium'); $D205 : Result := Result + (' Object already exists'); $D206 : Result := Result + (' Object already exists'); $D207 : Result := Result + (' Block exists in EPROM'); $D209 : Result := Result + (' Block does not exist'); $D20E : Result := Result + (' No block available'); $D210 : Result := Result + (' Block number too big'); $D241 : Result := Result + (' Protection level of function not sufficient'); $D406 : Result := Result + (' Information not available'); $EF01 : Result := Result + (' Incorrect ID2'); $FFFB : Result := Result + (' TeleService Library not found'); $FFFE : Result := Result + (' Unknown error FFFE hex'); $FFFF : Result := Result + (' Timeout error. Check interface'); END;
__________________
Best Regards, Naser |
![]() |
![]() |
#12 |
Member
![]() ![]() Join Date: Dec 2003
Posts: 61
|
ShowMessage(Result);
END; END; function ReadInt(Word_: Word):Integer; begin IF Swap(Word_)< 32767 THEN Result := Swap(Word_) ELSE Result := Swap(Word_)- 65536; end; procedure WriteInt(IntNr:Integer; var Word_: Word); begin Word_ := Swap(IntNr); end; function ReadDInt(Low_Word: Word; High_Word: Word):Longint; var Rec: array [0..1] of Word; begin try Rec[0] := Swap(High_Word); Rec[1] := Swap(Low_Word) ; Move(Rec,Result,SizeOf(Result)); except Result := 0; end; end; procedure WriteDInt(LongNr:Longint; var Low_Word: Word; var High_Word: Word); var Rec: array [0..1] of Word; begin try Move(LongNr,Rec,SizeOf(LongNr)); Low_Word := Swap(Rec[1]); High_Word := Swap(Rec[0]); except Low_Word := 0; High_Word := 0; end; end; function ReadReal(Low_Word: Word; High_Word: Word):Single; var Rec: array [0..1] of Word; begin try Rec[0] := Swap(High_Word); Rec[1] := Swap(Low_Word) ; Move(Rec,Result,SizeOf(Result)); except Result := 0; end; end; procedure WriteReal(FloatNr:Single; var Low_Word: Word; var High_Word: Word); var Rec: array [0..1] of Word; begin try Move(FloatNr,Rec,SizeOf(FloatNr)); Low_Word := Swap(Rec[1]); High_Word := Swap(Rec[0]); except Low_Word := 0; High_Word := 0; end; end; begin end. Important! If you need more information about Prodave download the PDF Manual from here. -------------------------------------------------------------------------------- omarzucchiatti@libero.it
__________________
Best Regards, Naser |
![]() |
![]() |
#13 |
Member
![]() ![]() Join Date: May 2004
Posts: 1
|
Hello
now I am about to solve the same problem you discussed here. i.e. comunication between VB applications and Siemens PLCs throug the MPI port. Could you help me not to waste too much time & money? Thanks |
![]() |
![]() |
#14 |
Member
![]() ![]() Join Date: Dec 2003
Posts: 61
|
Hi Nemo,
Are you writing your application in VB or VB.NET? If it's gonna be in VB then install Step7, reference the dll files and follow the procedure above. If you're writing your application in VB.NET, then I'd recommed that you go for an OPC Server and OPC .NET Client. Best regards, Naser
__________________
Best Regards, Naser |
![]() |
![]() |
#15 |
Member
|
Visual Basic and MPI
Hi,
I'm looking for the way to communicate my VB aplication with Siemen S7 Could someone send me this information also? Thanks, Duy duyvo1979@yahoo.com |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Schematics for S7 MPI cable | jvdcande | LIVE PLC Questions And Answers | 16 | March 28th, 2010 08:06 AM |
S7 - MPI communication fails after modifying DP Bus addresses | RMA | LIVE PLC Questions And Answers | 5 | February 3rd, 2005 11:45 AM |
Communication between PG and S7 CPU3xx MPI frozen | RMA | LIVE PLC Questions And Answers | 1 | January 20th, 2005 04:19 AM |
Problems with S7 MPI communication | RMA | LIVE PLC Questions And Answers | 15 | November 19th, 2004 08:40 AM |
Technical doc about MPI protocol | Volkan | LIVE PLC Questions And Answers | 1 | July 11th, 2002 02:39 AM |