OPC客戶端的自動(dòng)化_第1頁(yè)
OPC客戶端的自動(dòng)化_第2頁(yè)
OPC客戶端的自動(dòng)化_第3頁(yè)
OPC客戶端的自動(dòng)化_第4頁(yè)
OPC客戶端的自動(dòng)化_第5頁(yè)
已閱讀5頁(yè),還剩10頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

/OPC客戶端的自動(dòng)化實(shí)現(xiàn)OPC是建立在COM,DCOM的基礎(chǔ)商的,因此絕大多數(shù)語(yǔ)言都可以很好的進(jìn)行開(kāi)發(fā).在Net中開(kāi)發(fā)客戶端有以下幾種方式:(1)

使用OPCNetAPI,需要用到OPCNetAPI.dll,.dll(2)

使用自動(dòng)化接口,需要用到OPCDAAuto.dll(3)

使用自定義接口,需要用到多個(gè)Wrapper:OpcRcw。Ae。dll,OpcRcw。Batch.dll,n.dll,OpcRcw.Da.dll,OpcRcw。Dx.dll,OpcRcw。Hda。dll,OpcRcw.Sec.dll以上開(kāi)發(fā)方式所需的動(dòng)態(tài)鏈接庫(kù)可以從OPC基金會(huì)()的網(wǎng)站上下載,一些下載項(xiàng)目可能需要注冊(cè),或成為基金會(huì)的成員。不同的方式有各自的有缺點(diǎn),請(qǐng)參見(jiàn)…本文使用自動(dòng)化接口,VB.Net語(yǔ)言進(jìn)行開(kāi)發(fā),開(kāi)發(fā)項(xiàng)目是無(wú)線射頻(RFID)卡方面的應(yīng)用,典型的如公交車(chē),或公司考勤使用的刷卡機(jī).需要注意的是自動(dòng)化接口存在一個(gè)“不是問(wèn)題”的問(wèn)題,數(shù)組下標(biāo)是以1開(kāi)始的,而不是傳統(tǒng)計(jì)算機(jī)開(kāi)發(fā)上的以0開(kāi)始.不知道設(shè)計(jì)者頭腦是怎么想(有人知道嗎?);這可能會(huì)給一些語(yǔ)言的開(kāi)發(fā)造成問(wèn)題(有人碰到嗎,沒(méi)有你就是幸運(yùn)的)需求:OPCDAAuto。dll或該Dll的Interop(一)

:客戶端開(kāi)發(fā)流程OPC客戶端的開(kāi)發(fā)主要遵循下圖所示的開(kāi)發(fā)流程,下面就從以下幾個(gè)開(kāi)發(fā)步驟進(jìn)行說(shuō)明

?

(二)

:枚舉OPC服務(wù)器列表枚舉服務(wù)器主要是通過(guò)OPCServer接口的GetOPCServers方法來(lái)實(shí)現(xiàn)的,該方法會(huì)返回OPC服務(wù)器數(shù)組(以1為下界,上面已有說(shuō)明),以下是代碼段'枚舉OPC服務(wù)器列表PrivateSubForm1_Load(ByValsenderAsSystem。Object,ByValeAsSystem。EventArgs)HandlesMyBase.LoadTryGlobalOPCServer=NewOPCAutomation。OPCServerClass()DimServerListAsObject=GlobalOPCServer。GetOPCServersForindexAsShort=LBound(ServerList)ToUBound(ServerList)’加入控件列表中,注意這里使用LBound和UBoundcbbServerList。Items.Add(ServerList(index))NextIfcbbServerList.Items.Count>0ThencbbServerList.SelectedIndex=0EndIfResetControlStatus()'設(shè)置控件狀態(tài)GlobalOPCServer=NothingCatchExAsExceptionMessageBox.Show("ListOPCserversfailed:"+Ex。Message,"OPCSample",MessageBoxButtons。OK)EndTryEndSub(三)

:連接OPC服務(wù)器自動(dòng)化接口中連接到服務(wù)器是使用connect方法PublicOverridableSubConnect(ByValProgIDAsString,OptionalByValNodeAsObject=Nothing)ProgID指服務(wù)器的ProgID,Node代表網(wǎng)絡(luò)節(jié)點(diǎn),如果是本機(jī)則放空即可。連接到服務(wù)器后,以下屬性需要特別注意:OPCServer.StartTime:服務(wù)器的啟動(dòng)時(shí)間OPCServer。CurrentTime:服務(wù)器的當(dāng)前時(shí)間,各個(gè)客戶端可以通過(guò)這個(gè)屬性值完成一些同步的操作OPCGroups.DefaultGroupIsActive:以后添加的Group是否默認(rèn)激活OPCGroups。DefaultGroupDeadBand:Group的默認(rèn)死區(qū),變化量超過(guò)死區(qū)后將會(huì)觸發(fā)DataChange事件,合理的設(shè)置該值可以提高程序性能OPCGroups.Count:下屬組(Group)的數(shù)量OPCGroups.DefaultGroupLocalID:組(Group)的默認(rèn)通信區(qū)域編號(hào),如1024OPCGroups.DefaultGroupUpdat(yī)eRate:組(Group)的默認(rèn)刷新率,該屬性也比較重要OPCGroups。DefaultGroupTimeBias:組(Group)的默認(rèn)時(shí)間偏差(四)

:添加組(Group)和項(xiàng)(Item)添加組和項(xiàng)需要用到Groups.Add和Items。AddItem方法,以下是原型:FunctionAdd(OptionalByValNameAsObject=Nothing)AsOPCAutomation。OPCGroupFunctionA(yù)ddItem(ByValItemIDAsString,ByValClientHandleAsInteger)AsOPCAutomation.OPCItem 組也有兩個(gè)重要的屬性 Group.UpdateRate:刷新率,該屬性通Groups的UpdateRate意義一樣,如果這個(gè)值有設(shè)置,則以這個(gè)值為準(zhǔn) Group。IsSubscribed:是否使用訂閱功能 以下是代碼段?'連接到指定的OPC服務(wù)器PrivateSubbtnConnectServer_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesbtnConnectServer.ClickIfcbbServerList.Text<>""ThenConnectedOPCServer=NewOPCAutomation.OPCServerClass()TryConnectedOPCServer.Connect(cbbServerList.Text)'設(shè)置組集合的默認(rèn)屬性ConnectedOPCServer。OPCGroups。DefaultGroupIsActive=TrueConnectedOPCServer.OPCGroups.DefaultGroupDeadband=0'添加組ConnectedGroup=ConnectedOPCServer.OPCGroups。Add()ConnectedGroup。UpdateRate=3*1000'刷新慮,用于下面的DataChange事件ConnectedGroup.IsSubscribed=True'使用訂閱功能'添加項(xiàng)GlobalOPCItems(0)=ConnectedGroup.OPCItems.AddItem("Reader_Device.OpenCard",0)GlobalOPCItems(1)=ConnectedGroup.OPCItems。AddItem("Reader_Device.CloseCard”,1)GlobalOPCItems(2)=ConnectedGroup.OPCItems.AddItem("ReaderdNO”,2)RefreshServerStatus()'刷新服務(wù)器狀態(tài)CatchexAsExceptionConnectedOPCServer=NothingMessageBox。Show("OPCserverconnectfailed:”+ex。Message,"OPCSample”,MessageBoxB(niǎo)uttons.OK)EndTryResetControlStatus()EndIfEndSub(五)

:讀寫(xiě)操作與事件控制讀寫(xiě)操作包括同步和異步兩種操作方式,以下是這幾個(gè)方法的原型:Group的同步讀事件SubSyncRead(ByValSourceAsShort,ByValNumItemsAsInteger,ByRefServerHandlesAsSystem。Array,ByRefValuesAsSystem。Array,ByRefErrorsAsSystem.Array,OptionalByRefQualitiesAsObject=Nothing,OptionalByRefTimeStampsAsObject=Nothing)

Group的同步寫(xiě)事件SubSyncWrite(ByValNumItemsAsInteger,ByRefServerHandlesAsSystem.Array,ByRefValuesAsSystem.Array,ByRefErrorsAsSystem。Array)

Group的異步讀事件SubAsyncRead(ByValNumItemsAsInteger,ByRefServerHandlesAsSystem.Array,ByRefErrorsAsSystem。Array,ByValTransactionIDAsInteger,ByRefCancelIDAsInteger)

Group的異步寫(xiě)事件SubAsyncWrite(ByValNumItemsAsInteger,ByRefServerHandlesAsSystem.Array,ByRefValuesAsSystem。Array,ByRefErrorsAsSystem.Array,ByValTransactionI(lǐng)DAsInteger,ByRefCancelIDAsInteger)如果使用異步的讀寫(xiě)操作,那么還需要實(shí)現(xiàn)Group中的ReadComplete和WriteComplete兩個(gè)事件PublicEventAsyncReadComplete(ByValTransactionIDAsInteger,ByValNumItemsAsInteger,ByRefClientHandlesAsSystem。Array,ByRefItemValuesAsSystem.Array,ByRefQualitiesAsSystem。Array,ByRefTimeStampsAsSystem.Array,ByRefErrorsAsSystem.Array)

PublicEventAsyncWriteComplete(ByValTransactionIDAsInteger,ByValNumItemsAsInteger,ByRefClientHandlesAsSystem.Array,ByRefErrorsAsSystem.Array)其他相關(guān)的重要事件包括:Group數(shù)據(jù)變化時(shí)的通知事件PublicEventDataChange(ByValTransactionIDAsInteger,ByValNumItemsAsInteger,ByRefClientHandlesAsSystem.Array,ByRefItemValuesAsSystem。Array,ByRefQualitiesAsSystem.Array,ByRefTimeStampsAsSystem.Array)

Group的異步取消事件PublicEventAsyncCancelComplete(ByValCancelIDAsInteger)

Server(服務(wù)器)關(guān)閉通知事件PublicEventServerShutDown(ByValReasonAsString)

以下是這些實(shí)現(xiàn)的代碼段'讀取卡片指定的塊號(hào)的值PrivateSubbtnReadCard_Click(ByValsenderAsSystem。Object,ByValeAsSystem.EventArgs)IfNot(ConnectedGroupIsNothing)ThenTry’獲取塊號(hào)DimBlockNoAsShort=CByte(ReadBlockNo.Text)’如果要獲取數(shù)據(jù)的塊所對(duì)應(yīng)的項(xiàng)還沒(méi)有創(chuàng)建,就創(chuàng)建它IfGlobalOPCBlockItems(BlockNo)IsNothingThenGlobalOPCBlockItems(BlockNo)=ConnectedGroup.OPCItems。AddItem("Reader_Device.Block"&CStr(BlockNo),200+BlockNo)EndIf'準(zhǔn)備參數(shù)數(shù)組DimServerResultsAsSystem。ArrayDimServerErrorsAsSystem。ArrayDimServerHandles(1)AsIntegerServerHandles(1)=GlobalOPCBlockItems(BlockNo).ServerHandle’讀取值ConnectedGroup.SyncRead(OPCAutomation.OPCDataSource.OPCDevice,1,ServerHandles,ServerResults,ServerErrors)IfServerErrors(1)<>0ThenMsgBox("ReadCardFailed:"&ServerErrors(1))ElsetxtReadBlockNo.Text=ServerResults(1)EndIfCatchexAsExceptionMessageBox.Show("OPCserverReadCardfailed:"+ex.Message,"OPCSample",MessageBoxButtons.OK)EndTryEndIfEndSub

’寫(xiě)卡片指定塊的值PrivateSubbtnWriteCard_Click(ByValsenderAsSystem.Object,ByValeAsSystem。EventArgs)IfNot(ConnectedGroupIsNothing)ThenTry'獲取塊號(hào)DimBlockNoAsShort=CByte(WriteBlockNo.Text)'如果要寫(xiě)入數(shù)據(jù)的塊所對(duì)應(yīng)的項(xiàng)還沒(méi)有創(chuàng)建,就創(chuàng)建它IfGlobalOPCBlockItems(BlockNo)IsNothingThenGlobalOPCBlockItems(BlockNo)=ConnectedGroup.OPCItems.AddItem(”Reader_Device.Block"&CStr(BlockNo),200+BlockNo)EndIf'準(zhǔn)備參數(shù)數(shù)組DimServerValues(1)AsObjectDimServerErrorsAsArrayDimServerHandles(1)AsIntegerServerHandles(1)=GlobalOPCBlockItems(BlockNo).ServerHandleServerValues(1)=txtWriteBlockNo。Text’寫(xiě)入值ConnectedGroup。SyncWrite(1,ServerHandles,ServerValues,ServerErrors)IfServerErrors(1)〈>0ThenMsgBox(”WriteCardFailed:"&ServerErrors(1))ElseMsgBox(”WriteCardSucceed")EndIfCat(yī)chexAsExceptionMessageBox。Show("OPCserverWriteCardfailed:"+ex.Message,”O(jiān)PCSample”,MessageBoxB(niǎo)uttons。OK)EndTryEndIfEndSub(六)

:斷開(kāi)服務(wù)器斷開(kāi)服務(wù)器只要使用OPCServer的Disconnect方法幾個(gè),以下是代碼段:'斷開(kāi)到指定OPC服務(wù)器的連接PrivateSubbtnDisconnectServer_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesbtnDisconnectServer.ClickIfNot(ConnectedOPCServerIsNothing)ThenTryConnectedOPCServer。Disconnect()CatchexAsExceptionMessageBox.Show(”O(jiān)PCserverdisconnectfailed:”+ex。Message,”O(jiān)PCSample”,MessageBoxB(niǎo)uttons.OK)FinallyConnectedOPCServer=NothingResetControlStat(yī)us()EndTryEndIfEndSub(七)

:相關(guān)鏈接非常好的一個(gè)OPC技術(shù)網(wǎng)站OPC基金會(huì)網(wǎng)址國(guó)內(nèi)的一個(gè)比較好的OPC網(wǎng)站(八):全部源碼Imports

System.Runtime。InteropServices?Public

Class

Form1?

Dim

GlobalOPCServer

As

OPCAutomation。OPCServerClass

Dim

WithEvents

ConnectedOPCServer

As

OPCAutomation。OPCServerClass

Dim

WithEvents

ConnectedGroup

As

OPCAutomat(yī)ion.OPCGroupClass

?

Dim

GlobalOPCItems(4)

As

OPCAutomation。OPCItem

Dim

GlobalOPCBlockItems(64)

As

OPCAutomation.OPCItem

??

'枚舉OPC服務(wù)器列表?

Private

Sub

Form1_Load(ByVal

sender

As

System。Object,

ByVal

e

As

System。EventArgs)

Handles

MyBase。Load

Try?

GlobalOPCServer

=

New

OPCAutomation。OPCServerClass()

Dim

ServerList

As

Object

=

GlobalOPCServer.GetOPCServers?

For

index

As

Short

=

LBound(ServerList)

To

UBound(ServerList)

’加入控件列表中,注意這里使用LBound和UBound

cbbServerList.Items.Add(ServerList(index))

Next

If

cbbServerList.Items。Count

>

Then

cbbServerList.SelectedIndex

=

0?

End

If

ResetControlStat(yī)us()

'設(shè)置控件狀態(tài)

GlobalOPCServer

Nothing?

Cat(yī)ch

Ex

As

Exception

MessageBox。Show("List

OPC

servers

failed:

+

Ex.Message,

"OPCSample”,

MessageBoxButtons.OK)?

End

Try?

End

Sub?

’連接到指定的OPC服務(wù)器?

Privat(yī)e

Sub

btnConnectServer_Click(ByVal

sender

As

System.Object,

ByVal

e

As

System.EventArgs)

Handles

btnConnectServer。Click?

If

cbbServerList。Text

<〉

""

Then?

ConnectedOPCServer

New

OPCAutomation.OPCServerClass()?

Try?

ConnectedOPCServer。Connect(cbbServerList。Text)?

’設(shè)置組集合的默認(rèn)屬性

ConnectedOPCServer。OPCGroups.DefaultGroupIsActive

True?

ConnectedOPCServer.OPCGroups.DefaultGroupDeadband

=

0?

’添加組

ConnectedGroup

ConnectedOPCServer。OPCGroups.Add()

ConnectedGroup.Updat(yī)eRate

=

3

1000

'刷新慮,用于下面的DataChange事件?

ConnectedGroup.IsSubscribed

=

True

'使用訂閱功能?

'添加項(xiàng)

GlobalOPCItems(0)

=

ConnectedGroup.OPCItems.AddItem("Reader_Device。OpenCard",

0)?

GlobalOPCItems(1)

=

ConnectedGroup.OPCItems.AddItem("Reader_Device。CloseCard”,

1)

GlobalOPCItems(2)

ConnectedGroup.OPCItems。AddItem("ReaderdNO",

2)?

RefreshServerStatus()

’刷新服務(wù)器狀態(tài)?

Catch

ex

As

Exception?

ConnectedOPCServer

=

Nothing

MessageBox.Show("OPC

server

connect

failed

"

ex.Message,

”O(jiān)PCSample",

MessageBoxButtons.OK)

End

Try

ResetControlStatus()

End

If

End

Sub?

’服務(wù)器斷開(kāi)事件通知

Private

Sub

OnServerShutDown(ByVal

Reason

As

String)

Handles

ConnectedOPCServer。ServerShutDown?

btnDisconnectServer_Click(Nothing,

New

EventArgs())?

End

Sub

?

Private

Sub

OnGroupDat(yī)aChange(ByVal

TransactionID

As

Integer,

ByVal

NumItems

As

Integer,

ByRef

ClientHandles

As

System。Array,

ByRef

ItemValues

As

System.Array,

ByRef

Qualities

As

System.Array,

ByRef

TimeStamps

As

System.Array)

Handles

ConnectedGroup.DataChange?

For

i

As

Integer

=

1

To

NumItems

If

Qualities(i)

=

OPCAutomation。OPCQuality.OPCQualityGood

Then?

Select

Case

ClientHandles(i)

Case

2?

txtCardN(xiāo)o.Text

CStr(ItemValues(i))

Case

200

'測(cè)試7張卡片

txtValueBlock0.Text

=

CStr(ItemValues(i))

Case

201

txtValueBlock1。Text

=

CStr(ItemValues(i))

Case

202?

txtValueBlock2。Text

=

CStr(ItemValues(i))

Case

203

txtValueBlock3.Text

=

CStr(ItemValues(i))

Case

204?

txtValueBlock4.Text

CStr(ItemValues(i))?

Case

205

txtValueBlock5.Text

CStr(ItemValues(i))

Case

206?

txtValueBlock6。Text

=

CStr(ItemValues(i))?

Case

207

txtValueBlock7。Text

=

CStr(ItemValues(i))

Case

Else?

End

Select

?

End

If

Next

End

Sub

??

’斷開(kāi)到指定OPC服務(wù)器的連接?

Private

Sub

btnDisconnectServer_Click(ByVal

sender

As

System.Object,

ByVal

e

As

System.EventArgs)

Handles

btnDisconnectServer.Click?

If

Not

(ConnectedOPCServer

Is

Nothing)

Then?

Try?

ConnectedOPCServer.Disconnect()?

Catch

ex

As

Exception

MessageBox.Show("OPC

server

disconnect

failed:

"

ex.Message,

”O(jiān)PCSample",

MessageBoxB(niǎo)uttons.OK)

Finally?

ConnectedOPCServer

Nothing?

ResetControlStatus()?

End

Try?

End

If?

End

Sub

?

’開(kāi)卡,并返回卡號(hào)

Private

Sub

btnOpenCard_Click(ByVal

sender

As

System.Object,

ByVal

e

As

System.EventArgs)?

If

ConnectedGroup

IsNot

Nothing

Then

Try?

'準(zhǔn)備參數(shù)數(shù)組

Dim

ServerHandles(1)

As

Integer

Dim

ServerValues(1)

As

Object

Dim

ServerErrors

As

System。Array?

ServerHandles(1)

GlobalOPCItems(0)。ServerHandle?

ServerValues(1)

=

1

'寫(xiě)入值,用于執(zhí)行OpenCard的操作?

ConnectedGroup.SyncWrite(1,

ServerHandles,

ServerValues,

ServerErrors)

If

ServerErrors(1)

<>

0

Then

MsgBox("OpenCardError:

ServerErrors(1))

End

If

ServerHandles(1)

=

GlobalOPCItems(2).ServerHandle?

Dim

ServerResult

As

System。Array

'讀取卡號(hào)?

ConnectedGroup.SyncRead(OPCAutomation.OPCDat(yī)aSource.OPCDevice,

1,

ServerHandles,

ServerResult,

ServerErrors)?

If

ServerErrors(1)

〈>

0

Then?

MsgBox("ReadCardNoError:

&

ServerErrors(1))?

Else?

txtCardNo。Text

=

ServerResult(1)?

End

If

Catch

ex

As

Exception

MessageBox.Show("OPC

server

Open

Card

failed:

+

ex。Message,

”O(jiān)PCSample",

MessageBoxButtons.OK)

End

Try

ResetControlStatus()

End

If?

End

Sub??

'讀取卡片指定的塊號(hào)的值

Private

Sub

btnReadCard_Click(ByVal

sender

As

System.Object,

ByVal

e

As

System.EventArgs)?

If

Not

(ConnectedGroup

Is

Nothing)

Then?

Try

'獲取塊號(hào)

Dim

BlockNo

As

Short

CByte(ReadBlockNo。Text)

'如果要獲取數(shù)據(jù)的塊所對(duì)應(yīng)的項(xiàng)還沒(méi)有創(chuàng)建,就創(chuàng)建它

If

GlobalOPCBlockItems(BlockNo)

Is

Nothing

Then?

GlobalOPCBlockItems(BlockNo)

ConnectedGroup.OPCItems.AddItem(”Reader_Device.Block"

CStr(BlockNo),

200

+

BlockNo)

End

If

'準(zhǔn)備參數(shù)數(shù)組

Dim

ServerResults

As

System.Array?

Dim

ServerErrors

As

System.Array?

Dim

ServerHandles(1)

As

Integer?

ServerHandles(1)

=

GlobalOPCBlockItems(BlockNo).ServerHandle

’讀取值

ConnectedGroup。SyncRead(OPCAutomation.OPCDataSource.OPCDevice,

1,

ServerHandles,

ServerResults,

ServerErrors)?

If

ServerErrors(1)

〈>

0

Then?

MsgBox("Read

Card

Failed:"

&

ServerErrors(1))

Else?

txtReadBlockNo.Text

=

ServerResults(1)

End

If?

Catch

ex

As

Exception?

MessageBox.Show(”O(jiān)PC

server

Read

Card

failed:

+

ex.Message,

"OPCSample”,

MessageBoxButtons.OK)?

End

Try

End

If

End

Sub??

’寫(xiě)卡片指定塊的值?

Private

Sub

btnWriteCard_Click(ByVal

sender

As

System。Object,

ByVal

e

As

System.EventArgs)?

If

Not

(ConnectedGroup

Is

Nothing)

Then

Try

’獲取塊號(hào)

Dim

BlockNo

As

Short

CByte(WriteBlockNo.Text)?

’如果要寫(xiě)入數(shù)據(jù)的塊所對(duì)應(yīng)的項(xiàng)還沒(méi)有創(chuàng)建,就創(chuàng)建它?

If

GlobalOPCBlockItems(BlockNo)

Is

Nothing

Then?

GlobalOPCBlockItems(BlockNo)

=

ConnectedGroup。OPCItems.AddItem(”Reader_Device.Block”

&

CStr(BlockNo),

200

BlockNo)?

End

If

’準(zhǔn)備參數(shù)數(shù)組

Dim

ServerValues(1)

As

Object?

Dim

ServerErrors

As

Array

Dim

ServerHandles(1)

As

Integer

ServerHandles(1)

GlobalOPCBlockItems(BlockNo)。ServerHandle

ServerValues(1)

=

txtWriteBlockNo。Text

’寫(xiě)入值?

ConnectedGroup.SyncWrite(1,

ServerHandles,

ServerValues,

ServerErrors)?

If

ServerErrors(1)

<〉

0

Then?

MsgBox(”Write

Card

Failed:"

&

ServerErrors(1))?

Else

MsgBox("Write

Card

Succeed”)?

End

If?

Catch

ex

As

Exception?

MessageBox.Show(”O(jiān)PC

server

Write

Card

failed:

"

ex.Message,

”O(jiān)PCSample”,

MessageBoxButtons。OK)

End

Try?

End

If

End

Sub

'重設(shè)控件狀態(tài)

Private

Sub

ResetControlStat(yī)us()?

If

ConnectedOPCServer

Is

Nothing

Then?

btnConnectServer.Enabled

=

True

btnDisconnectServer.Enabled

=

False

btnReadCard.Enabled

False

btnWriteCard。Enabled

False?

btnOpenCard。Enabled

False?

btnCloseCard.Enabled

False

ReadBlockNo.Value

=

0?

WriteBlockNo.Value

=

0

txtReadBlockNo.Text

=

”"

txtWriteBlockNo.Text

”0000000000”

txtCardN(xiāo)o.Text

=

""

?

txtSrvStartTime.Text

=

""

txtSrvCurrTime.Text

=

”"

txtSrvGroupCount。Text

""?

txtSrvGroupDeadBand.Text

=

""

txtSrvGroupDefActive。Text

=

""?

txtSrvGroupLocalID。Text

=

”"?

txtSrvGroupTimeBias.Text

=

""

txtSrvRequestRate.Text

=

""?

Else

btnConnectServer.Enabled

False?

btnDisconnectServer.Enabled

=

True?

If

txtCardNo.Text

=

””

Then

btnReadCard。Enabled

=

False

btnWriteCard.Enabled

=

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論