Author Topic: direct reading and writing to OPC in AHMI  (Read 1532 times)

maxketcham

  • Newbie
  • *
  • Posts: 20
    • View Profile
direct reading and writing to OPC in AHMI
« on: August 05, 2016, 11:28:51 AM »
I know it's here in the forum but after 2 days searching I give up. Could someone point me to how to read and write to an opc server in AHMI without using a control, I have an need in my app for direct reads/writes to OPC and  to/from a database,  I use controls in some places but the direct reads and writes are easier. I found them here once, but now I can't find them and with 5TB of code on my hard drive I can't find it there either, any help would be appreciated, thanks in advance
Loving AHMI!!!!
and have posted about it more than once on FB LOL
ps only need the direct read and write code for OPC, I have the database handled, lol
« Last Edit: August 05, 2016, 12:28:21 PM by maxketcham »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: direct reading and writing to OPC in AHMI
« Reply #1 on: August 05, 2016, 01:10:33 PM »
You can write the code to directly communicate with the OPC Server, but it takes about a dozen lines of code. You can find several examples around the internet such as this:

https://social.msdn.microsoft.com/Forums/en-US/608798b5-986d-418d-a7c0-1d6d2211843d/connecting-a-opcserver-in-vbnet?forum=vblanguage

But an easier way would be to use the OpcDaCom driver.

- Add an OpcDaCom driver to your form
- Set the properties such as OPCServer
- In your code, use the typical AdvancedHMI methods:

Dim MyValue as string=OpcDaCom1.Read("MyTag")

maxketcham

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: direct reading and writing to OPC in AHMI
« Reply #2 on: August 05, 2016, 03:38:46 PM »
Thanks Archie