Troubleshooting
Fixing HMI macro error C70 after EasyBuilder migration
Short answer
Error C70 appears because EasyBuilder Pro checks macro array bounds at compile time and EasyBuilder 8000 did not: this macro declares short buffRd[10] while its final SetData writes 12 elements from buffRd[0]. Decide the output contract at RW 20-31, then either declare short buffRd[12] and assign the two added elements, or cut the transfer count to 10.
On this page
Error C70 is EasyBuilder Pro refusing to compile a macro whose transfer count exceeds a declared array. In the migrated project the macro declares short buffRd[10] and ends with SetData(buffRd[0], "Local HMI", RW, 20, 12) — a request for 12 elements from a 10-element array. EasyBuilder 8000 compiled the same code because it did not enforce this check. Correct the bounds before looking at drivers or screens: either the destination at RW 20 through RW 31 genuinely needs 12 words, in which case declare short buffRd[12] and assign the two added elements, or the payload is the 10 words the macro actually processes, in which case change the count to 10.
What C70 is telling you #
C70 fires during macro compilation. The compilation result names the macro, and compiling that macro on its own reproduces the array sizing failure. Because the project stops at compile, the controller link, the register addresses and the screen bindings are not involved yet; those branches matter only after the project builds and runs.
EasyBuilder Pro verifies array correctness where EasyBuilder 8000 did not. A clean compile in the old editor therefore proves nothing about a migrated macro's bounds, so audit every declaration in every macro brought across, not only the one the error points at.
Audit every array with the arithmetic #
The rule the compiler applies: the highest index a transfer touches equals its start index plus its element count minus one, and that must stay at or below the declared length minus one.
Applied to the failing call:
- Start index 0, count 12: last index touched = 0 + 12 − 1 = 11.
- Declared length 10: highest valid index = 10 − 1 = 9.
- 11 > 9, so the call reads two elements,
buffRd[10]andbuffRd[11], that were never allocated. That is C70.
short buffRd[10]
...
SetData(buffRd[0], "Local HMI", RW, 20, 12)
The same rule clears the other three declarations:
| Array | Declared | Highest index reached | Where | Result |
|---|---|---|---|---|
| buffRd | 10 | 11 | final SetData of 12 elements from buffRd[0] | exceeds by 2 |
| buffChk | 20 | 19 | unpack loop: at n = 9, ptr = 9 × 2 = 18, then ptr + 1 = 19 | fits exactly |
| chePunz | 41 | 40 | 41-element read from index 0; search runs p = 1 to 40 | fits |
| buffPosMatrix | 20 | 19 | lookup loop n = 0 to 19; 20-element write | fits |
Only the final write from buffRd breaks the rule. The byte-unpacking loop reaches index 18 at n = 9 and index 19 after the increment — the last element of a 20-element array — which is legal and is not the failure.
Decide the output contract at RW 20-31 #
The macro reads 10 words from RW 0, unpacks them into 20 bytes, looks up 20 position codes, repacks 10 words and writes them from RW 20. A 12-element write covers RW 20 through RW 31; a 10-element write covers RW 20 through RW 29. Both silence C70, but they implement different outputs:
| Required output | Correction | Extra obligation |
|---|---|---|
| 12 words at RW 20-31 | change the declaration to short buffRd[12] |
assign buffRd[10] and buffRd[11] before the write |
| 10 words at RW 20-29 | change the final count from 12 to 10 | none; RW 30 and RW 31 stay untouched by this call |
The decision rests on what consumes RW 30 and RW 31: screen objects, other macros, controller logic reading the panel's local words. The macro itself only ever defines 10 output words — the read at RW 0 asks for 10 and the repack loop fills indexes 0 through 9 — so unless a consumer needs those two addresses, the 10-word transfer is the correction that matches what the code does, and a 12-word write would push two never-assigned values into RW 30 and RW 31. Commit to short buffRd[12] only when the receiving layout specifies 12 words.
Apply the correction #
- Save a separate migration copy of the project before editing the macro.
- Open the macro named in the compile result and confirm the pairing:
short buffRd[10]againstSetData(buffRd[0], "Local HMI", RW, 20, 12). - Search the project for consumers of RW 30 and RW 31, including screen objects and other macros, and choose the output contract from that evidence.
- For the 10-word contract, change the final call to
SetData(buffRd[0], "Local HMI", RW, 20, 10). - For the 12-word contract, change the declaration to
short buffRd[12]and assign the two added elements from the receiving layout before the write. - Compile the macro, then compile the complete project for the replacement terminal, clearing any further diagnostics one at a time.
- Leave the position-code transfer
SetData(buffPosMatrix[0], "Drivers", 4x, 1#8194, 20)untouched; 20 elements out of a 20-element array is within bounds.
What a larger declaration does not fix #
Two gaps survive the compiler, and C70 catches neither:
- The added elements have no source. The
GetDataat RW 0 reads 10 elements and the repack loop writes indexes 0 through 9, so nothing in the macro ever setsbuffRd[10]orbuffRd[11]. Raising the input read to 12 would change the input contract at RW 0-11 and still would not define the outputs; their values have to come from the application's data layout. - An unmatched byte leaves a hole.
buffPosMatrix[n]receives a value only whensrc == tstfor some p between 1 and 40; a byte absent fromchePunz[1]throughchePunz[40]leaves that position code unassigned on that pass. That is a run-time data question, so specify the behavior — reject the input, flag it, or assign an agreed fallback — and test it deliberately.
Verify the corrected macro #
- Confirm the
SYNC_TRIG_MACRO(2)sequence completes and the macro executes once per trigger under controlled conditions. - Load known words at RW 0-9. The repack reconstructs each word as low byte + 256 × high byte, so RW 20-29 must read back identical to RW 0-9; a mismatch means the unpack or repack path was disturbed.
- On the 12-word contract, check RW 30 and RW 31 against their specified values, not against leftovers.
- Read the 20 position codes at the Drivers destination
1#8194and compare them with the positions expected for the bytes loaded at RW 0-9. - Keep compile-time and run-time failures separate from here: a project that compiles but reports no response from the controller is a driver and device question, the kind behind an EasyBuilder Pro upgrade that shows HMI no response, not a macro bounds problem.
- Carry the same discipline into the rest of the conversion by validating HMI variables during a software migration, because the compiler accepts addressing and naming differences the old project hid.
Questions asked
What does error C70 mean in an EasyBuilder Pro macro?
It is a compile-time array bounds error: a transfer or index reaches past the declared length. Here the final SetData requests 12 elements from buffRd[10], whose valid indexes end at 9. The compilation result names the macro, and the project cannot be built for the replacement terminal until the mismatch is removed.
Why did the same macro compile in EasyBuilder 8000?
EasyBuilder 8000 did not enforce this bounds check, so its clean compile never proved the transfer stayed inside the array. Treat every macro leaving the old editor as unverified and run the start-index-plus-count-minus-one check against each declaration before compiling in EasyBuilder Pro.
Should the declaration become buffRd[12] or the count become 10?
The destination decides. If screens or logic read RW 30 and RW 31, the application needs 12 words, so declare short buffRd[12] and assign the two added elements before the write. If nothing consumes those addresses, change the count to 10, because the macro only ever defines 10 words.
Is enlarging the array declaration enough on its own?
No. The GetData at RW 0 reads 10 elements and the repack loop fills indexes 0 through 9, so buffRd[10] and buffRd[11] would reach RW 30 and RW 31 without ever receiving a value. Define their contents from the receiving layout, or take the 10-word branch instead.
Do the other arrays in this macro also overrun?
No. buffChk peaks at index 19 of 20 when the unpack loop reaches n = 9, chePunz is read across all 41 declared elements while the search uses 1 through 40, and buffPosMatrix is written across its full 20. Only the 12-element write from buffRd is out of bounds.
Will C70 also catch values that were never assigned?
No. C70 compares counts against declarations at compile time; it does not track whether an element holds a defined value at run time. The unmatched-byte case in the lookup leaves buffPosMatrix elements unassigned without any diagnostic, so that behavior must be specified and tested separately.