wjun7610
級(jí)別: 略有小成
精華主題: 0
發(fā)帖數(shù)量: 127 個(gè)
工控威望: 249 點(diǎn)
下載積分: 708 分
在線時(shí)間: 31(小時(shí))
注冊(cè)時(shí)間: 2007-09-16
最后登錄: 2024-10-02
查看wjun7610的 主題 / 回貼
樓主  發(fā)表于: 2013-06-22 19:51
Omron_Fins.dll V1.0 Fins通信協(xié)議串口通訊動(dòng)態(tài)鏈接庫(kù)DLL(以下簡(jiǎn)稱DLL),是為滿足工業(yè)通信需要,

針對(duì)工業(yè)領(lǐng)域要求上位機(jī)對(duì)歐姆龍系列PLC通訊實(shí)時(shí)采集與控制的組態(tài)編程而設(shè)計(jì)。

可以適用于常用的各種開(kāi)發(fā)環(huán)境如:Vb6、Vb.net、Delphi、C#、VC++、powerbuilder、易語(yǔ)言、labviEW等進(jìn)行上位機(jī)軟件開(kāi)發(fā)。

本DLL是采用Delphi語(yǔ)言開(kāi)發(fā)的標(biāo)準(zhǔn)串口通訊庫(kù),具有以下特點(diǎn):

1)、遵循歐姆龍最新Fins通信協(xié)議;

2)、支持多串口并發(fā)操作,支持多線程串口通訊,將串口通訊對(duì)主程序的影響降至最低;

3)、實(shí)時(shí)性、可靠性好,通用性強(qiáng);

4)、適用于多PLC(下位機(jī))聯(lián)網(wǎng)和上位機(jī)通信,滿足多方面的需要;

5)、函數(shù)接口功能全,操作簡(jiǎn)單,支持歐姆龍PLC的絕大部分地址的讀寫(xiě)功能函數(shù);

6)、支持USB、PC擴(kuò)展卡等擴(kuò)展串口號(hào);

7)、支持多種操作系統(tǒng)win2000/winXP/Win7(標(biāo)準(zhǔn)Win32 DLL);

8)、易于快速開(kāi)發(fā)(VC等非RAD開(kāi)發(fā)環(huán)境的開(kāi)發(fā));

9)、采用數(shù)組指針調(diào)用數(shù)據(jù)發(fā)生與接收,初學(xué)者快速入門(mén);對(duì)于不方便使用指針的開(kāi)發(fā)環(huán)境可采用DLL緩沖區(qū)傳遞;

10)、可在多種編程環(huán)境下使用,例如VB、VC、Delphi、PB、Labview、易語(yǔ)言等開(kāi)發(fā)環(huán)境;

11)、擴(kuò)展了函數(shù)功能讀取下位機(jī)中的雙字、單精度浮點(diǎn)等類(lèi)型數(shù)據(jù),更加符合工業(yè)自動(dòng)化領(lǐng)域的工控軟件的開(kāi)發(fā)。

軟件版本及相關(guān)說(shuō)明:

Omron_Fins.dll V1.0 Fins通信協(xié)議串口通訊鏈接庫(kù),實(shí)現(xiàn)了對(duì)歐姆龍全系列PLC的Fins協(xié)議的支持,

wangjun于2013年在原有Omron_HostLink.dll V3.2版基礎(chǔ)上基于Finsi協(xié)議重寫(xiě)通訊底層協(xié)議結(jié)構(gòu)。

對(duì)于16位整數(shù)和32位整數(shù)讀取寫(xiě)入均按有符號(hào)整數(shù)處理,小數(shù)的返回按單精度浮點(diǎn)型(2進(jìn)制浮點(diǎn))

處理讀取方式。提供擴(kuò)展功能函數(shù),方便用戶實(shí)現(xiàn)混合數(shù)據(jù)讀取。能夠同時(shí)滿足32個(gè)串口并發(fā)

情況下的正常使用。

Omron_Fins.dll V1.0 分為完美版和單機(jī)版兩個(gè)版本。

注意:實(shí)例在使用時(shí)不能超出試用版的地址限制,否則無(wú)法正確通訊。


龍帥工作室為您提供專業(yè)串口通訊控件,也可為您訂制

專用通訊協(xié)議串口控件。目前龍帥系列串口通訊協(xié)議

控件包括modbus_rtu、modbus_tcp、三菱FX PLC編程口、

歐姆龍HostLink、西門(mén)子PPI等多個(gè)系列產(chǎn)品。

淘-寶-店:http://shop34821629.taobao.com

電 話:13912935690

騰訊QQ:157610979

阿里旺旺: wj_longshuai

郵 箱:[url=mailto:157610979@QQ.com]157610979@QQ.com[/url] ;   [url=mailto:chinawanglong@163.com]chinawanglong@163.com[/url]
[ 此帖被wjun7610在2016-11-24 14:06重新編輯 ]
附件: 歐姆龍fins協(xié)議動(dòng)態(tài)庫(kù).rar (1353 K) 下載次數(shù):659
網(wǎng)站提示: 請(qǐng)不要用迅雷下載附件,容易出錯(cuò)
wjun7610
級(jí)別: 略有小成
精華主題: 0
發(fā)帖數(shù)量: 127 個(gè)
工控威望: 249 點(diǎn)
下載積分: 708 分
在線時(shí)間: 31(小時(shí))
注冊(cè)時(shí)間: 2007-09-16
最后登錄: 2024-10-02
查看wjun7610的 主題 / 回貼
1樓  發(fā)表于: 2013-06-22 19:52
DLL串口操作函數(shù)包括:

  1)、finsComOpen打開(kāi)串口;

     finsCvComOpen打開(kāi)串口; //CV模式通訊串口打開(kāi)

  2)、finsComClose關(guān)閉串口;
      
  3)、finsSetDelay串口通訊延時(shí)設(shè)定;
                    
  4)、finsComTrue判斷串口是否打開(kāi)成功;
            
  5)、finsComWork判斷串口是否正在工作中;

Fins協(xié)議基本功能函數(shù)包括:

  1)、finsPlcRs  讀取PLC運(yùn)行狀態(tài);

  2)、finsPlcWs 更改PLC運(yùn)行狀態(tài);  

  3)、finsBitForced  PLC位元件強(qiáng)制;

  4)、finsCancelAllF 取消全部PLC強(qiáng)制;

  5)、finsReadBit 讀PLC位元件值;

  6)、finsReadInt 讀PLC字元件值;

  7)、finsWriteBit 寫(xiě)PLC位元件值;  

  8)、finsWriteInt 寫(xiě)PLC字元件值;

Fins協(xié)議擴(kuò)展功能函數(shù)包括:

  1)、finsSet PLC的位元件置位;

  2)、finsReSet PLC的位元件復(fù)位;  

  3)、finsReadDInt 讀PLC的雙字整數(shù)值;

  4)、finsReadFloat 讀PLC的浮點(diǎn)數(shù)據(jù)值;

  5)、finsWriteDInt 寫(xiě)PLC的雙字整數(shù)值;

  6)、finsWriteFloat 寫(xiě)PLC的浮點(diǎn)數(shù)據(jù)值;

Fins協(xié)議DLL緩沖區(qū)傳遞功能函數(shù)包括

  1)、finsClearBuf  清除復(fù)位DLL緩存區(qū);

  2)、finsReadBitBuf 讀PLC的位元件值  

  3)、finsReadIntBuf 讀PLC的字元件值;

  4)、finsReadDIntBuf 讀PLC雙字整數(shù)值;

  5)、finsIntDllBufRead 讀DLL整數(shù)緩存區(qū)值;

  6)、finsReadFloatBuf 讀PLC浮點(diǎn)數(shù)據(jù)值;  

  7)、finsFloatDllBufRead 讀DLL浮點(diǎn)緩存區(qū)值;

  8)、finsWriteIntDllBuf  寫(xiě)DLL整數(shù)緩存區(qū)值;

  9)、finsBitBufWrite  寫(xiě)PLC的位元件值;

  10)、finsIntBufWrite 寫(xiě)PLC的字元件值;  

  11)、finsDIntBufWrite 寫(xiě)PLC雙字整數(shù)值;

  12)、finsWriteFloatDllBuf 寫(xiě)DLL浮點(diǎn)緩存區(qū)值;  

  13)、finsFloatBufWrite 寫(xiě)PLC浮點(diǎn)數(shù)據(jù)值;
當(dāng)需要進(jìn)行16位整數(shù)、32位整數(shù)、32位浮點(diǎn)數(shù)值進(jìn)行混合讀寫(xiě)時(shí),所需拓展函數(shù)包括:

  1)、DecBitBin  字整數(shù)的位抽。

  2)、Int32ToInt_16h  雙字到字轉(zhuǎn)換高位字;  

  3)、Int32ToInt_16l  雙字到字轉(zhuǎn)換低位字;

  4)、Int16ToInt32  字到雙字的轉(zhuǎn)換;

  5)、Float32ToInt_16h 浮點(diǎn)到字轉(zhuǎn)換高位字;

  6)、Float32ToInt_16l 浮點(diǎn)到字轉(zhuǎn)換低位字;

  7)、Int16ToFloat32  字到浮點(diǎn)的轉(zhuǎn)換;

  8)、Int16Unsign   16位有符號(hào)整數(shù)轉(zhuǎn)無(wú)符號(hào)整數(shù)  
wjun7610
級(jí)別: 略有小成
精華主題: 0
發(fā)帖數(shù)量: 127 個(gè)
工控威望: 249 點(diǎn)
下載積分: 708 分
在線時(shí)間: 31(小時(shí))
注冊(cè)時(shí)間: 2007-09-16
最后登錄: 2024-10-02
查看wjun7610的 主題 / 回貼
2樓  發(fā)表于: 2013-06-22 19:52
在VC中使用DLL一般都是采用動(dòng)態(tài)聲明的方式,函數(shù)說(shuō)明中給出的是Delphi的函數(shù)原型,

在VC中聲明時(shí)只要注意一下類(lèi)型的對(duì)應(yīng)即可,Delphi中的longint類(lèi)型對(duì)應(yīng)VC中的int類(lèi)型

Delphi中的Pchar對(duì)應(yīng)VC中的char* ,下面給出主要函數(shù)的聲明:

在使用的文件的cpp中聲明一個(gè)句柄:

HINSTANCE hinstDLL;

用來(lái)標(biāo)識(shí)導(dǎo)入的動(dòng)態(tài)鏈接庫(kù)。

1)、按下例說(shuō)明聲明相關(guān)各個(gè)函數(shù):(在cpp文件的頭處聲明)

typedef int (_stdcall *pOpen)(int nport, int BaudRate, int DataBits, char* Parity, int StopBits, char* User);
typedef int (_stdcall *pClose)(int nport);
typedef int (_stdcall *pSetDelay)(int value);
typedef int (_stdcall *pComTrue)(int nport);
typedef int (_stdcall *pComWork)(int nport);

typedef int (_stdcall *pRs)(int nport, int node);
typedef int (_stdcall *pWs)(int nport, int node, int State);
typedef int (_stdcall *pBitForced)(int nport, int node, int address, int Bit, int value, char* Area);
typedef int (_stdcall *pCancelAllF)(int nport, int node);
typedef int (_stdcall *pReadBit)(int nport, int node, int address, int Bit, int Count, char* Area, int* RxdBuffer);
typedef int (_stdcall *pReadInt)(int nport, int node, int address, int Count, char* Area, int* RxdBuffer);
typedef int (_stdcall *pWriteBit)(int nport, int node, int address, int Bit, int Count, char* Area, int* TxdBuffer);
typedef int (_stdcall *pWriteInt)(int nport, int node, int address, int Count, char* Area, int* TxdBuffer);

typedef int (_stdcall *pSet)(int nport, int node, int address, int Bit, char* Area);
typedef int (_stdcall *pReSet)(int nport, int node, int address, int Bit, char* Area);
typedef int (_stdcall *pReadDInt)(int nport, int node, int address, int Count, int* RxdBuffer);
typedef int (_stdcall *pReadFloat)(int nport, int node, int address, int Count, float* RxdBuffer);
typedef int (_stdcall *pWriteDInt)(int nport, int node, int address, int Count, int* TxdBuffer);
typedef int (_stdcall *pWriteFloat)(int nport, int node, int address, int Count, float* TxdBuffer);

typedef int (_stdcall *pBitBin)(int value, int Bitaddress);
typedef int (_stdcall *p32I_16h)(int value);
typedef int (_stdcall *p32I_16l)(int value);
typedef int (_stdcall *p16I_32I)(int valueH, int valueL);
typedef int (_stdcall *p32f_16h)(float value);
typedef int (_stdcall *p32f_16l)(float value);
typedef float (_stdcall *p16I_32f)(int valueH, int valueL);
typedef int (_stdcall *pInt16Unsign)(int value);

2)、建立動(dòng)態(tài)鏈接庫(kù)的新函數(shù)名:(在cpp文件的頭處聲明)

pOpen mOpen;
pClose mClose;
pSetDelay mSetDelay;
pComTrue mComTrue;
pComWork mComWork;

pRs mRs;
pWs mWs;
pBitForced mBitForced;
pCancelAllF mCancelAllF;
pReadBit mReadBit;
pReadInt mReadInt;
pWriteBit mWriteBit;
pWriteInt mWriteInt;

pSet mSet;
pReSet mReSet;
pReadDInt mReadDInt;
pReadFloat mReadFloat;
pWriteDInt mWriteDInt;
pWriteFloat mWriteFloat;

pBitBin mBitBin;
p32I_16h m32I_16h;
p32I_16l m32I_16l;
p16I_32I m16I_32I;
p32f_16h m32f_16h;
p32f_16l m32f_16l;
p16I_32f m16I_32f;
pInt16Unsign mInt16Unsign;

3)、導(dǎo)入動(dòng)態(tài)鏈接庫(kù),如例所示:(在cpp文件的OnInitDialog過(guò)程建立):

hinstDLL = LoadLibrary("Omron_fins.dll");

4)、判斷dll文件是否存在并聲明并建立動(dòng)態(tài)鏈接庫(kù)中的函數(shù)與新函數(shù)名的對(duì)應(yīng)關(guān)系,

如下:(在cpp文件的OnInitDialog過(guò)程建立):

   if (hinstDLL)
   {
      mOpen = (pOpen)GetProcAddress (hinstDLL,"finsComOpen");
      //mOpen = (pOpen)GetProcAddress (hinstDLL,"finsCvComOpen");  CV模式plc使用這個(gè)打開(kāi)串口
      mClose = (pClose)GetProcAddress (hinstDLL,"finsComClose");
      mSetDelay = (pSetDelay)GetProcAddress (hinstDLL,"finsSetDelay");
      mComTrue = (pComTrue)GetProcAddress (hinstDLL,"finsComTrue");
      mComWork = (pComWork)GetProcAddress (hinstDLL,"finsComWork");
    
      mRs = (pRs)GetProcAddress (hinstDLL,"finsPlcRs");
      mWs = (pWs)GetProcAddress (hinstDLL,"finsPlcWs");
      mBitForced = (pBitForced)GetProcAddress (hinstDLL,"finsBitForced");
      mCancelAllF = (pCancelAllF)GetProcAddress (hinstDLL,"finsCancelAllF");
      mReadBit = (pReadBit)GetProcAddress (hinstDLL,"finsReadBit");
      mReadInt = (pReadInt)GetProcAddress (hinstDLL,"finsReadInt");
      mWriteBit = (pWriteBit)GetProcAddress (hinstDLL,"finsWriteBit");
      mWriteInt = (pWriteInt)GetProcAddress (hinstDLL,"finsWriteInt");

      mSet = (pSet)GetProcAddress (hinstDLL,"finsSet");
      mReSet = (pReSet)GetProcAddress (hinstDLL,"finsReSet");
      mReadDInt = (pReadDInt)GetProcAddress (hinstDLL,"finsReadDInt");
      mReadFloat = (pReadFloat)GetProcAddress (hinstDLL,"finsReadFloat");
      mWriteDInt = (pWriteDInt)GetProcAddress (hinstDLL,"finsWriteDInt");
      mWriteFloat = (pWriteFloat)GetProcAddress (hinstDLL,"finsWriteFloat");


     mBitBin = (pBitBin)GetProcAddress (hinstDLL,"DecBitBin");
     m32I_16h = (p32I_16h)GetProcAddress (hinstDLL,"Int32ToInt_16h");
     m32I_16l = (p32I_16l)GetProcAddress (hinstDLL,"Int32ToInt_16l");
     m16I_32I= (p16I_32I)GetProcAddress (hinstDLL,"Int16ToInt32");
     m32f_16h = (p32f_16h)GetProcAddress (hinstDLL,"Float32ToInt_16h");
     m32f_16l = (p32f_16l)GetProcAddress (hinstDLL,"Float32ToInt_16l");
     m16I_32f= (p16I_32f)GetProcAddress (hinstDLL,"Int16ToFloat32");
     mInt16Unsign = (pInt16Unsign)GetProcAddress (hinstDLL,"Int16Unsign");
  
     AfxMessageBox("Omron_fins.dll已成功載入!");
  }
  else
{
    AfxMessageBox("沒(méi)找到Omron_fins.dll!");
    SendMessage(WM_CLOSE);
  }

注:雙引號(hào)中為動(dòng)態(tài)鏈接庫(kù)中的原有函數(shù)名。


函數(shù)中用到了char*型參數(shù),這里介紹下char*與Cstring的相互轉(zhuǎn)換的函數(shù):

(1)char*->CString

char* sz;
CString str;
str.Format("%s",sz);  //可以用此函數(shù)將讀取的值轉(zhuǎn)成字符串

(2) CString -> char*

CString str;
char* sz = str.GetBuffer(0);//可將字符串轉(zhuǎn)成char*給函數(shù)賦值


5)、當(dāng)不再需要使用DLL時(shí)記得關(guān)閉串口及釋放動(dòng)態(tài)鏈接庫(kù),(在OnDestroy事件中釋放)

if(hinstDLL)
{
   int k = mComTrue(mnport);
   if (k==1)
   {
      mClose(mnport);
   }    
   FreeLibrary(hinstDLL);
}
cmsn
      
級(jí)別: 略有小成
精華主題: 0
發(fā)帖數(shù)量: 275 個(gè)
工控威望: 451 點(diǎn)
下載積分: 1027 分
在線時(shí)間: 278(小時(shí))
注冊(cè)時(shí)間: 2012-09-10
最后登錄: 2024-10-19
查看cmsn的 主題 / 回貼
3樓  發(fā)表于: 2013-06-22 20:57
這個(gè)關(guān)注下
manjialin
專業(yè)工業(yè)控制軟件開(kāi)發(fā)!
級(jí)別: 略有小成
精華主題: 0
發(fā)帖數(shù)量: 144 個(gè)
工控威望: 334 點(diǎn)
下載積分: 718 分
在線時(shí)間: 110(小時(shí))
注冊(cè)時(shí)間: 2008-11-28
最后登錄: 2020-08-26
查看manjialin的 主題 / 回貼
4樓  發(fā)表于: 2013-07-02 08:55
干了那么多年軟件開(kāi)發(fā),第一次聽(tīng)說(shuō)OMRON能全系支持FINS
945785181
做自己,信自己。
級(jí)別: 探索解密
精華主題: 0
發(fā)帖數(shù)量: 20 個(gè)
工控威望: 128 點(diǎn)
下載積分: 619 分
在線時(shí)間: 17(小時(shí))
注冊(cè)時(shí)間: 2011-01-15
最后登錄: 2015-08-13
查看945785181的 主題 / 回貼
5樓  發(fā)表于: 2013-07-11 09:14
下載下來(lái)都不能解壓的