Announcement

Collapse
No announcement yet.

DoMore Array Index Expressions

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts


  • DoMore Array Index Expressions

    I'm working on modularizing some code blocks. I'm using STP-DRV-4850's with Applied Motion's SiNET Hub-8 to communicate using one RS232 port to four axes. One of the expressions is coming up with a problem within the STRPRINT command. When I try to use D[V3+70] it gives me an error. Looking deeper, any value <=63 is acceptable, but anything larger, and I get an error message (see attached). When I try this same expression in a MATH box, it takes it with no issues.

    Is this a bug, or am I doing something wrong?
    Attached Files


  • #2
    No. MATH has a stack to actually allow you to enter ENTIRE EXPRESSIONs for the array index, for both the Expression and even in the Result parameter. You could (technically) enter

    "D[3 * ROUND(SIN(PI() / 2.0))]" to indirectly reference D3 (the SIN of pi over 2 is 1.0)

    In all the other instructions, you can only index data-blocks using a single V as the index, with an optional offset of +1 to +63, e.g. D[V3+63]. The work-around is utilize a new V register with the "calculated" array index. For example, MATH V4 "V3+70", then use D[V4].
    There are 10 kinds of people in this world, those who know binary, and those who do not.

    Comment

    Working...
    X