基本信息
源码名称:Prodave6联接程序源码
源码大小:0.46M
文件格式:.rar
开发语言:C#
更新时间:2019-10-13
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 5 元×
微信扫码支付:5 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Prodave6_CS; using System.Runtime.InteropServices; namespace ProDave6Test { class Test { static void Main(string[] args) { //以下测试LoadConnection_ex6 short ConNr= 63; // First connection;(0 ... 63);(max. 64 connections). string AccessPoint = "S7ONLINE"; // Default access point——S7ONLINE Prodave6_CS.Prodave6.CON_TABLE_TYPE ConTable ;// Connection table int ConTableLen = System.Runtime.InteropServices.Marshal.SizeOf(typeof(Prodave6_CS.Prodave6.CON_TABLE_TYPE)) ;// Length of the connection table int RetValue; ConTable.Adr=new byte[]{192,168,1,200,0,0}; ConTable.AdrType = 2; // Type of address: MPI/PB (1), IP (2), MAC (3) ConTable.SlotNr = 2; // 插槽号 ConTable.RackNr = 0; // 机架号 RetValue = Prodave6.LoadConnection_ex6(ConNr, AccessPoint, ConTableLen,ref ConTable); //以下测试SetActiveConnection_ex6 UInt16 UConNr = (UInt16)ConNr; RetValue = Prodave6.SetActiveConnection_ex6(UConNr); //以下测试db_write_ex6 UInt16 BlkNr = 4;//data block号 Prodave6.DatType DType = Prodave6.DatType.BYTE;//要读取的数据类型 UInt16 StartNr = 0;//起始地址号 UInt32 pAmount = 20;//需要读取类型的数量 UInt32 BufLen = 20;//缓冲区长度(字节为单位) //参数:data block号、要写入的数据类型、起始地址号、需要写入类型的数量、缓冲区长度(字节为单位)、缓冲区 byte[] pWriteBuffer = new byte[20]; for (int i = 0; i < pWriteBuffer.Length; i ) pWriteBuffer[i] = (byte)(i 1); RetValue = Prodave6.db_write_ex6(BlkNr, DType, StartNr, ref pAmount, BufLen, pWriteBuffer); //以下测试db_read_ex6 //参数:data block号、要读取的数据类型、起始地址号、需要读取类型的数量、缓冲区长度(字节为单位)、 //缓冲区、缓冲区数据交互的长度 byte[] pReadBuffer = new byte[20]; UInt32 pDatLen = 0; RetValue = Prodave6.db_read_ex6(BlkNr, DType, StartNr, ref pAmount, BufLen, pReadBuffer, ref pDatLen); //以下测试field_read_ex6(测试DB区) //参数:data block号、要读取的数据类型、起始地址号、需要读取类型的数量、缓冲区长度(字节为单位)、 //缓冲区、缓冲区数据交互的长度 Prodave6.FieldType FType = Prodave6.FieldType.D; for (int i = 0; i < pWriteBuffer.Length; i ) pWriteBuffer[i] = (byte)(i); RetValue = Prodave6.field_write_ex6(FType, BlkNr, StartNr, pAmount, BufLen, pWriteBuffer); //以下测试field_read_ex6(测试DB区) //参数:data block号、要读取的数据类型、起始地址号、需要读取类型的数量、缓冲区长度(字节为单位)、 //缓冲区、缓冲区数据交互的长度 byte[] pReadBuffer2 = new byte[20]; RetValue = Prodave6.field_read_ex6(FType, BlkNr, StartNr, pAmount, BufLen,pReadBuffer2, ref pDatLen); //以下测试field_read_ex6(测试M区) //参数:data block号、要读取的数据类型、起始地址号、需要读取类型的数量、缓冲区长度(字节为单位)、 //缓冲区、缓冲区数据交互的长度 Prodave6.FieldType FTypeM = Prodave6.FieldType.M; byte []pWriteBufferM = {2}; RetValue = Prodave6.field_write_ex6(FTypeM, 0, 100, 1, 1, pWriteBufferM); //以下测试field_read_ex6(测试M区) //参数:data block号、要读取的数据类型、起始地址号、需要读取类型的数量、缓冲区长度(字节为单位)、 //缓冲区、缓冲区数据交互的长度 byte[] pReadBufferM2 = new byte[1]; RetValue = Prodave6.field_read_ex6(FTypeM, 0, 100, 1, 1, pReadBufferM2, ref pDatLen); //以下测试mb_setbit_ex6 UInt16 MbNr = 100;//mb block号 UInt16 BitNr = 0;//位号 byte Value = 1;//0、1 RetValue = Prodave6.mb_setbit_ex6(MbNr,BitNr, Value); //以下测试mb_bittset_ex6(测试DB区) int pValue = 0; RetValue = Prodave6.mb_bittest_ex6(MbNr, BitNr, ref pValue); //以下测试GetLoadedConnections_ex6 BufLen = 64; int[] pBufferI = new int[64]; Prodave6.GetLoadedConnections_ex6(BufLen, pBufferI); //以下测试UnloadConnection_ex6 RetValue = Prodave6.UnloadConnection_ex6(UConNr); //以下测试GetErrorMessage_ex6 int ErrorNr = 0x7040; // Block boundary exceeded, correct the number StringBuilder Buffer = new StringBuilder(300); // Transfer buffer for error text BufLen = (UInt32)Buffer.Capacity; // Buffer length RetValue = Prodave6.GetErrorMessage_ex6(ErrorNr, BufLen, Buffer); //以下测试float_2_gp_ex6 float ieee = 1.2F; UInt32 gp=0; float pieee=0; RetValue = Prodave6.float_2_gp_ex6(ieee, ref gp); RetValue = Prodave6.gp_2_float_ex6(gp,ref pieee); //以下测试gp_2_float_ex6 RetValue = Prodave6.testbit_ex6(7, 0); RetValue = Prodave6.testbit_ex6(7, 1); RetValue = Prodave6.testbit_ex6(7, 2); RetValue = Prodave6.testbit_ex6(7, 3); RetValue = Prodave6.testbit_ex6(7, 4); RetValue = Prodave6.testbit_ex6(7, 5); RetValue = Prodave6.testbit_ex6(7, 6); RetValue = Prodave6.testbit_ex6(7, 7); //以下测试byte_2_bool_ex6 int [] boolValue=new int[8]; Prodave6.byte_2_bool_ex6(255, boolValue); //以下测试bool_2_byte_ex6 byte byteValue; byteValue=Prodave6.bool_2_byte_ex6(boolValue); //以下测试kf_2_integer_ex6和kf_2_long_ex6 UInt16 u16=25600;UInt16 u16_; u16_=Prodave6.kf_2_integer_ex6(u16); UInt32 u32 = 1677721600; UInt32 u32_; u32_=Prodave6.kf_2_long_ex6(u32); //以下测试swab_buffer_ex6(byte[] pBuffer, UInt32 Amount) byte[] pBuffer=new byte[11]; UInt32 Amount=(UInt32)pBuffer.Length; for (int i = 0; i < Amount; i ) pBuffer[i] = (byte)(i 1); Prodave6.swab_buffer_ex6(pBuffer, 6); //以下测试copy_buffer_ex6 byte[] pSourceBuffer={1,2,3,4,5,6,7,8,9,10}; byte[] pTargetBuffer=new byte[10]; Prodave6.copy_buffer_ex6( pTargetBuffer, pSourceBuffer,8); //以下测试ushort_2_bcd_ex6 UInt16[] pwValues = { 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 }; Prodave6.ushort_2_bcd_ex6(pwValues, 10, 0, 0); //以下测试bcd_2_ushort_ex6 Prodave6.bcd_2_ushort_ex6(pwValues, 10, 0, 0); UInt32[] pdwValues = { 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 }; //以下测试ulong_2_bcd_ex6 Prodave6.ulong_2_bcd_ex6(pdwValues,8, 0, 0); //以下测试bcd_2_ulong_ex6 Prodave6.bcd_2_ulong_ex6(pdwValues, 8, 0, 0); //以下测试自定义辅助函数 byte[] test_bytes = { 1, 2 }; byte[] test_bytes2 = { 1, 2,3,4 }; UInt16[] test_words={1,2}; UInt16 word = Prodave6.bytes_2_word(test_bytes[0], test_bytes[1]); UInt32 dword = Prodave6.bytes_2_dword(test_bytes2[0], test_bytes2[1], test_bytes2[2], test_bytes2[3]); UInt32 dword2 = Prodave6.words_2_dword(test_words[0], test_words[1]); byte[] return_bytes = Prodave6.word_2_bytes(word); byte[] return_bytes2 = Prodave6.dword_2_bytes(dword); ushort[] return_words = Prodave6.dword_2_words(dword2); } } }
【文档目录】
Contents 1 Introduction 1-1 2 Installation 2-1 2.1 Automation License Manager........................................................................2-1 2.1.1 User Rights through the Automation License Manager ....................................2-1 2.1.2 Installing the Automation License Manager......................................................2-3 2.1.3 Guidelines for Handling License Keys ..............................................................2-4 2.2 Installing PRODAVE MPI/IE V6.0 ...................................................................2-5 2.2.1 Installation Procedure .......................................................................................2-6 2.2.2 Setting the PG/PC Interface..............................................................................2-8 2.3 Uninstalling PRODAVE MPI/IE V6.0 ............................................................2-10 2.3.1 Uninstalling PRODAVE MPI/IE V6.0...............................................................2-10 3 New Functions as of PRODAVE MPI/IE V6.0 3-1 3.1 Basic Functions ..............................................................................................3-4 3.1.1 LoadConnection_ex6 ........................................................................................3-4 3.1.2 UnloadConnection_ex6.....................................................................................3-7 3.1.3 SetActiveConnection_ex6.................................................................................3-8 3.1.4 SetPassword_ex6 .............................................................................................3-9 3.1.5 UnSetPassword_ex6.......................................................................................3-10 3.1.6 as_info_ex6.....................................................................................................3-11 3.1.7 as_zustand_ex6 ..............................................................................................3-13 3.1.8 db_buch_ex6...................................................................................................3-15 3.1.9 db_read_ex6 ...................................................................................................3-17 3.1.10 db_write_ex6...................................................................................................3-19 3.1.11 bst_read_diag_ex6..........................................................................................3-21 3.1.12 bst_read_stat_ex6...........................................................................................3-23 3.1.13 bst_read_ex6 ..................................................................................................3-25 3.1.14 read_diag_buf_ex6 .........................................................................................3-29 3.1.15 field_read_ex6.................................................................................................3-31 3.1.16 field_write_ex6 ................................................................................................3-33 3.1.17 mb_setbit_ex6.................................................................................................3-35 3.1.18 mb_bittest_ex6................................................................................................3-37 Contents PRODAVE MPI/IE V6.0 viii A5E00388168-01 3.2 Functions for Data Transfer to S7-200........................................................3-39 3.2.1 as200_as_info_ex6.........................................................................................3-39 3.2.2 as200_as_zustand_ex6 ..................................................................................3-41 3.2.3 as200_field_read_ex6.....................................................................................3-43 3.2.4 as200_field_write_ex6 ....................................................................................3-45 3.2.5 as200_mb_setbit_ex6 .....................................................................................3-47 3.2.6 as200_mb_bittest_ex6....................................................................................3-49 3.3 Convenience Functions................................................................................3-51 3.3.1 GetErrorMessage_ex6 ....................................................................................3-51 3.3.2 kg_2_float_ex6................................................................................................3-55 3.3.3 float_2_kg_ex6................................................................................................3-56 3.3.4 gp_2_float_ex6................................................................................................3-57 3.3.5 float_2_gp_ex6................................................................................................3-58 3.3.6 testbit_ex6.......................................................................................................3-59 3.3.7 byte_2_bool_ex6.............................................................................................3-60 3.3.8 bool_2_byte_ex6.............................................................................................3-62 3.3.9 kf_2_integer_ex6, kf_2_long_ex6 ...................................................................3-64 3.3.10 swab_buffer_ex6.............................................................................................3-66 3.3.11 copy_buffer_ex6..............................................................................................3-67 3.3.12 ushort_2_bcd_ex6, ulong_2_bcd_ex6............................................................3-68 3.3.13 bcd_2_ushort_ex6, bcd_2_ulong_ex6............................................................3-70 3.3.14 GetLoadedConnections_ex6...........................................................................3-72 3.4 TeleService Functions..................................................................................3-73 3.4.1 ts_dial_ex6 ......................................................................................................3-73 3.4.2 ts_hang_up_dial_ex6......................................................................................3-75 3.4.3 ts_set_ringindicator_ex6 .................................................................................3-76 3.4.4 ts_read_info_ex6.............................................................................................3-78 3.4.5 ts_hang_up_ring_ex6......................................................................................3-79 3.4.6 ts_get_modem_name_ex6..............................................................................3-80