Using WinTech OPC (OLE for Process Control)

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
Reply to
Steve
Loading thread data ...

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);

Reply to
Steve

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.