Using WinTech OPC (OLE for Process Control)

Aug 15, 2003 1 Replies

Question on OPC (OLE for Process Control) When a button is pressed the following will be executed. Updating the value 4 times but the callback function in the client is only called once. Why? ////////////// void __fastcall TForm1::ButtonStartStopClick(TObject *Sender) { ....... UpdateTag (m_StatusTag->Handle, m_StatusTag->Value, OPC_QUALITY_GOOD); m_StatusTag->Value.vt = VT_I2; m_StatusTag->Value.intVal = 0; UpdateTag (m_StatusTag->Handle, m_StatusTag->Value, OPC_QUALITY_GOOD); m_StatusTag->Value.vt = VT_I2; m_StatusTag->Value.intVal = 1; UpdateTag (m_StatusTag->Handle, m_StatusTag->Value, OPC_QUALITY_GOOD); m_StatusTag->Value.vt = VT_I2; m_StatusTag->Value.intVal = 2; UpdateTag (m_StatusTag->Handle, m_StatusTag->Value, OPC_QUALITY_GOOD); m_StatusTag->Value.vt = VT_I2; m_StatusTag->Value.intVal = 3; UpdateTag (m_StatusTag->Handle, m_StatusTag->Value, OPC_QUALITY_GOOD); } /////////////// The callback function is called only once even though the value is changed 4 times in the server.Why is this so???Am I missing something?I,m new to this opc thing //////////////////////// void CALLBACK OPCUpdateCallback (HANDLE hGroup, HANDLE hItem, VARIANT



*pVar, FILETIME timestamp, DWORD quality) { Form1->OPCDataUpdate (hGroup, hItem, pVar, timestamp, quality); } ///////////////////// Any help would be much appreciated

I inserted a wait state for loop in between the update statements as you said but it does not work. No matter how long the delay you put in between the update statements it will not work.

UpdateTag (m_StatusTag->Handle, m_StatusTag->Value, OPC_QUALITY_GOOD); for(i=0;iValue.vt = VT_I2; m_StatusTag->Value.intVal = 0; UpdateTag (m_StatusTag->Handle, m_StatusTag->Value, OPC_QUALITY_GOOD); for(i=0;iValue.vt = VT_I2; m_StatusTag->Value.intVal = 1; UpdateTag (m_StatusTag->Handle, m_StatusTag->Value, OPC_QUALITY_GOOD);

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required