Author Topic: WriteRaw has no effect (ClxDriver 1.2.1.0)  (Read 1354 times)

mpfs

  • Newbie
  • *
  • Posts: 11
    • View Profile
WriteRaw has no effect (ClxDriver 1.2.1.0)
« on: February 09, 2018, 03:41:21 AM »
Hello,

I am using the WriteRaw method to write to a UDT in one go. The UDT consists of a single element of type REAL.
The WriteRaw method does not throw an error, but to check to see if the value was actually written, I call ReadRaw immediately afterwards; however, ReadRaw always returns the former value - as if WriteRaw was completely ignored.

I have tried the following, but to no avail:
- Switch the controller to PROG mode (it's in MEM mode by default).
- Wait 10ms to 10s before calling ReadRaw

Here is the partial code I am using to write to the UDT:

Code: [Select]
byte[] newValue = BitConverter.GetBytes(100.0f);
clxClient.WriteRaw(tag.TagName, 0, newValue);

I have also noticed that passing anything other than 0 in the second parameter ("numberOfElements") in WriteRaw throws an exception. Is it safe to assume that this is the offset of the byte array (the third parameter)?

Many thanks!

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI

mpfs

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: WriteRaw has no effect (ClxDriver 1.2.1.0)
« Reply #2 on: February 09, 2018, 07:41:54 AM »
Hello Archie,

thank you for the prompt reply. I came across this method earlier in the week, but it is not exposed by the EthernetIPforCLX class in the ClxDriver namespace.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: WriteRaw has no effect (ClxDriver 1.2.1.0)
« Reply #3 on: February 09, 2018, 08:11:10 AM »
I was thinking that feature was already rolled out into the ClxDriver. It is currently only available in AdvancedHMI. I will see about getting an update for the ClxDriver.

But the WriteRaw should still work because the WriteUDT uses it also. Try declaring a variable before using Bitconverter to make sure it is a single, then make sure it is sending 4 bytes.

Dim MyValue as Single = 100
Dim b() as byte=Bitconverter.GetBytes(MyValue)
clxClient.WriteRaw(tag.TagName, 0, b)

mpfs

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: WriteRaw has no effect (ClxDriver 1.2.1.0)
« Reply #4 on: February 09, 2018, 08:21:16 AM »
Thank you again for the prompt reply. It still did not work using your suggestion (and to be quite frank, it would have really surprised me if it did).
EDIT: I can confirm it is sending 4 bytes, as did my code in my original post did.
« Last Edit: February 09, 2018, 08:23:29 AM by mpfs »

bachphi

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
Re: WriteRaw has no effect (ClxDriver 1.2.1.0)
« Reply #5 on: February 09, 2018, 10:32:21 AM »
lol, I purchased the driver but not using it yet. If there is an update, please send me one too.
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

mpfs

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: WriteRaw has no effect (ClxDriver 1.2.1.0)
« Reply #6 on: February 19, 2018, 04:22:07 AM »
Hello Archie,

I can confirm that this functionality has been restored in ClxDriver 1.2.3.0.
Thank you for your rapid response!