Macro Setdata()/Stringset() inserts only 1 char in PLC

Macro Setdata()/Stringset() inserts only 1 char in PLC
none 0.0 0
  • HMI Model: 8103IE
  • EasyBuilder Pro Version: V6.10.01

I think this is a common issue.

I’m scanning a barcode (which works), and monitoring the flag (which works), and then

using SetData() or StringSet() to send the result to a PLC.

I only receive one char at the PLC.
Google search indicates that this might be a common problem.

I have not yet tried using an ArrayofChars at the plc to see if your HMI will fill that array one char at a time.

Hi @pfarrell,

Thank you for contributing to our forum.

If the SetData function is only transferring one value, the data count attribute may be set to its default value of one. Could you confirm that this value is set to the proper amount?

Below, the data count is the last argument of one:
SetData(var[0], "Local HMI", LW, 100, 1)

If this doesn’t resolve your issue, could you send us images or code of your macro so we can further diagnose the problem?

Thank you.

I do not see a value added for Address Offset, and I can’t remember if I tried tath or ont, I was following code example that supposedly works.

Now I have a new problem, I get a c50 error when compiling

I just accepted an upgrade a few days ago. I hope that did not create a problem for me…

Hi @pfarrell,

The error is occurring due to a syntax error, as it looks like you have an extra argument in there which is causing the issue. We recommend you use the GET/SET FN… tool in the bottom-left corner of the macro window. You can use this tool to write out your macro.

Below is a video to help you use this tool. Macro Video

Please let us know if you have any other questions!

Example of correct syntax

OK, that’s great. So that’s why I did not use teh extra arguement that your user guide says to use.

When I do that, and set the size variable to something like 20 or 10 or 24, then I only get one character transmitted.

Why is that?

Hi @pfarrell ,

When you are monitoring the 1 char that is being returned is it within the PLC software or a address tag within Easy Builder Pro?

I’m trying different way s of getting a 6 digit number into th PLC.

I can use stringset() to transfer one digit. If I change the starting point var[1] to var[3] then the single char I receive in strMy_PLC_Var :STRING(24) := ‘ ‘; changes from ‘3’ to ‘7’ or whatever digit is stored in the Weintek array. Yes- I see one char in the PLC.

The code is simple and clean (Other than the trial commands I commented out)

Hi @pfarrell,

Can you please try the following macro and let us know if this allows you to set multiple characters into your PLC tag:

char BC_scan_Data[8] = "Hello CS"

StringSet(BC_scan_Data[0], "CODESYS V3 (Ethernet)", "Application.GVL_DATA.strThisOrderNum", 8)

It sends character [0], which is an H.

This barcode is only 6 digits long. I’ll just send each array element to a different variable in the PLC and then concatenate them.

Thanks

@pfarrell,

You can certainly concatenate these characters, however, the issue that you’ve described is not normal. Can you please advise the full EasyBuilder Pro version, CODESYS IDE version, and CODESYS runtime for our reference so that we can try to replicate this issue in office?

I’ll send some info when I can. Thanks.