Author Topic: TwinCAT boolean array results in invalid PLC address  (Read 2807 times)

davejp

  • Newbie
  • *
  • Posts: 3
    • View Profile
TwinCAT boolean array results in invalid PLC address
« on: September 21, 2014, 11:33:26 PM »
Hi all, When using a BasicIndicator with a PLC address that is an array I receive the message "Invalid Select1 Value". I am using OPC comms with Beckhoff TwinCAT and the address is setup as "Product_req:ARRAY[1..40] OF BOOL;" in TwinCAT. The value I have in the PLCAddressSelect1 field is "plc1.Product_req[1]" and I can view the value of this address with the OPC test client. If I change this to another address in TwinCAT which is not in an array "plc1.Half_second_pulse" then it works fine.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: TwinCAT boolean array results in invalid PLC address
« Reply #1 on: September 22, 2014, 07:28:49 AM »
Open BasicIndicator.vb and go to Line 392 and put a break point by clicking in the margin to the left. Run the application and when it stop at the breakpoint, hover over e.Values(0) to see what the value being returned is.

Just out of curiosity, why are you using OPC and not the native TwinCAT driver?

davejp

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: TwinCAT boolean array results in invalid PLC address
« Reply #2 on: September 23, 2014, 02:23:38 AM »
Guess what, it seems to be working fine now!!! I am afraid I am not sure what I have done differently but I am using the same PLC array address as before and everything is working correctly. Sorry if I wasted your time.

I am using OPC as I have the HMI running on the same controller as TwinCAT ( Beckhoff C6915 ) and I read somewhere that the native driver would not work in this case.

davejp

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: TwinCAT boolean array results in invalid PLC address
« Reply #3 on: September 23, 2014, 03:32:50 AM »
It's back! A little differently though. Using a graphic indicator with the same PLC array address for both select1 and select2 images, ValueSelect1 set to FALSE and ValueSelect2 set to TRUE. Only the TRUE state is displayed, when the address is FALSE nothing is shown. I can toggle the address in the PLC and only the TRUE state displays an image.
I then modified the PLC to toggle the address every 0.5 seconds automatically because I was getting sick of doing it manually. Both states display correctly and I have not made any change to the VB code. I then did the same test with an address not in an array and had the same results.
Very wierd