News:

  • May 02, 2026, 01:26:50 AM

Login with username, password and session length

Author Topic: How do I copy a DATETIME structure?  (Read 13448 times)

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3806
    • Host Engineering
How do I copy a DATETIME structure?
« on: October 09, 2012, 05:42:44 PM »
The Ladder Palette and Instruction Box Browser show all the Assignment instructions:
INIT, MAPIO, MEMCLEAR, MEMCOPY, MOVE, MOVEBIT, MOVER, PUBLISH, REFWRITE, RSTR, SETNUMR, SETR, SUBSCRIB

and it's as clear as mud which one of those you need to use.   ::)

Most of the Assignment instructions copy VALUEs.  The MEMCOPY instruction was created for BLIND BYTE COPIES, including copying STRUCTs, since STRUCT's do not have a "numeric value".  MEMCOPY is also the fastest of the "assignment" instructions for bulk copy of raw memory (e.g. DATETIME structures or copying a range of V to another range of V).

The other assignment instructions typically "load" the "value" into the internal accumulator then "writes" the "value" into the format of the output (e.g. V0 to R10 will convert the V0 integer VALUE to its real VALUE and output that to R10, so integer 1 gets converted to real 1.0).

So, if you want to copy a time stamp into UDT0 (User Date/Time block, index 0) with  $Now (system nickname for SDT0), do a

MEMCOPY of $Now to UDT0
with a "Number of Elements" set to 1.


There are no comments for this topic. Do you want to be the first?