Author Topic: New Rev3.99r does not write multiple data with DF1 driver  (Read 813 times)

CarlosAguero

  • Newbie
  • *
  • Posts: 4
    • View Profile
New Rev3.99r does not write multiple data with DF1 driver
« on: September 29, 2016, 01:01:40 PM »
I was working with version 3.99d, I'm using DF1 serial communication to a SLC 5/04 Allen Bradley PLC.
With this version I can write multiple registers with one instruction --> DF1Com1.Write("B100:0", 50, to_PLC_array) . Works fast and with no issues
******************************
At this moment I just downloaded from AdvancedHMI webpage the latest version 3.99r.
With the new version I can only write 1 register, but not multiple registers.. 
-->SerialDF1forSLCMicroCom1.Write("B100:0", 50, to_PLC_array) ,   it throws the Error 2- Too many arguments to 'Public Function Write(startAddress As String, dataToWrite As String) As String'.

To have my solution working in production line, temporarily I used a FOR..NEXT cycle to write one at the time all of the registers , but it takes too long (around 5 seconds)
Is there a way to write multiple registers with the new version with one instruction??....

I will appreciate your help....  Regards!
Carlos E. Aguero J.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: New Rev3.99r does not write multiple data with DF1 driver
« Reply #1 on: September 29, 2016, 02:46:33 PM »
You can write multiple values using an asynchronous write:

        Dim V() As String = {"1", "2", "3"}
        SerialDF1forSLCMicroCom1.BeginWrite("N7:0", 2, V)

CarlosAguero

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: New Rev3.99r does not write multiple data with DF1 driver
« Reply #2 on: September 29, 2016, 07:22:40 PM »
Thanks, good idea.
I execute the code but it doesn't write or shows any error...

SerialDF1forSLCMicroCom2.BaudRate = 19200
SerialDF1forSLCMicroCom2.ComPort = "COM14"
SerialDF1forSLCMicroCom2.BeginWrite("B100:0", 10, Write_Array)

how can I detect if BeginWrite was successful or with errors?.. Is there an event for Write_Done?, like event DataReceived for async readings...


Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: New Rev3.99r does not write multiple data with DF1 driver
« Reply #3 on: September 29, 2016, 07:27:11 PM »
Not 100% sure, but it may fire the ComError event in the event of a write failure.

When I tested it, I had 3 BasicLabels on the form showing the values, then used a button to trigger the write. The BasicLabels showed me when the communication started and also let me verify the write occurred.