Author Topic: Set PLC bit to run VB SUB  (Read 1453 times)

Holmux

  • Newbie
  • *
  • Posts: 34
    • View Profile
Set PLC bit to run VB SUB
« on: October 15, 2019, 10:13:34 AM »
HI

It turns out after using AdvancedHMI for for some time now, I never had to start a SUB from the PLC.

This is probalbly very simple I just haven't been able to google this one.

I am sending some data to a SQL database, and would like to tricker the sub from the PLC, how
do I get the state of a PLC(Compactlogix) Boolean to tricker the Sub ??

Thanks
Holmux

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Set PLC bit to run VB SUB
« Reply #1 on: October 15, 2019, 11:00:52 AM »
- Add a DataSubscriber to the form
- Set PLCAddressValue to the bit you want to monitor
- Double click the DataSubscriber on the design view
- Add code like this:
Code: [Select]
if e.errorID=0 then
  if e.Values(0)="True" then
    'Do Something
  End If
End If
« Last Edit: October 15, 2019, 11:23:47 AM by Archie »

Holmux

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: Set PLC bit to run VB SUB
« Reply #2 on: October 15, 2019, 11:23:09 AM »
Hi Artie

Thanks, just what I was looking for.

/Holmux