Author Topic: com problem - invalid cast exception  (Read 9046 times)

Thegreyghost

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: com problem - invalid cast exception
« Reply #15 on: December 22, 2014, 09:17:08 AM »
Awesome.  I'll keep an eye out for it.  To you point of leaving the days of Rs232 behind, do you have any insight to the issue I'm having with the OPC driver?


Jeff.

Godra

  • Hero Member
  • *****
  • Posts: 1449
    • View Profile
Re: com problem - invalid cast exception
« Reply #16 on: December 22, 2014, 03:23:23 PM »
The last version of software that worked for me was v3.84  for DF1 driver with MicroLogix 1000 Analog PLC.

Just tried it again and it still works.

I did notice some code changes in the #Region "Constructor" since the mentioned version (I couldn't make the DF1 driver work since these changes were implemented).

Not sure if this will help you but Archie can always provide better solution.

Thegreyghost

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: com problem - invalid cast exception
« Reply #17 on: December 22, 2014, 04:32:34 PM »
Godra you are correct.  I was able to get a hold of 3.70 and the DF1 does work for me - cool.  I still have trouble with the OPC driver.   Errors in about the same location - line 91 - Dll.connect(). 
actual error:
An unhandled exception of type 'System.InvalidCastException' occurred in OpcNetApi.dll

Additional information: Unable to cast COM object of type 'System.__ComObject' to interface type 'OpcRcw.Comn.IOPCServerList2'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{9DD0B56C-AD9E-43EE-8305-487F3188BF7A}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5325
    • View Profile
    • AdvancedHMI
Re: com problem - invalid cast exception
« Reply #18 on: December 22, 2014, 08:11:02 PM »
To get the OPC driver to work, try this:

- Right Click the AdvancedHMI project in the Solution Explorer and select properties
- Change Target CPU to x86

The OPC API's are 32 bit. If you are running on a 64 bit system, they will not work. YOu have to force the application to be a 32 bit app by specifying x86

Thegreyghost

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: com problem - invalid cast exception
« Reply #19 on: December 23, 2014, 11:01:44 AM »
Currently I'm running a 32 bit machine.   I think I've found the issue.  Looks like it the version of RsLinx i'm running.  See the attached tech note from Rockwell Software.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5325
    • View Profile
    • AdvancedHMI
Re: com problem - invalid cast exception
« Reply #20 on: December 23, 2014, 12:37:01 PM »
Are you using RSLinx lite?

Thegreyghost

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: com problem - invalid cast exception
« Reply #21 on: December 23, 2014, 12:38:26 PM »
Gateway.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5325
    • View Profile
    • AdvancedHMI
Re: com problem - invalid cast exception
« Reply #22 on: December 23, 2014, 12:50:02 PM »
I thought the Gateway worked with any OPC

Thegreyghost

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: com problem - invalid cast exception
« Reply #23 on: December 23, 2014, 02:37:12 PM »
OEM, Professional, and Gateway all support OPC, Gateway supports remote OPC.  With the evolution of versions came the evolution of OPC standards and some where the switch from opcdaauto.dll to Rsiopcdauto.dll to the standard currently being used by the foundation, which i believe is the opcnetapi.dll.  Bottom line i think i need to upgrade Linx to version 2.55 or higher and re-try.

Jeff.