Joined on 03-23-2004
Copying a variable
I need to copy a variable instead of moving it. When I move the variable, it reinitializes the varaible. I need to leave the data intact. It’s a 32 bit integer. Thanks, Marc
03-24-2004, 2:42 AM
Joined on 12-01-2003
Optomation Systems, Madrid, Spain
Re: Copying a variable
You are using the correct instruction. There is no “Copy” instruction. I think there is something else wrong. Iâ€™m sure it seems that this is what is happening, but it isnâ€™t happening because of the â€œMoveâ€ instruction. If it was happening it would make any programming impossible! Just to confirm that you are not going mad, write a brand new strategy, define two integer variables, declaring one as â€œInitialize on Downloadâ€ to â€œ22â€, and use a move instruction to transfer copy the value to the second value. If that works the problem is in your code.
10 ideas for starters to locate the problem.
- Another chart writing to the same variable
- Initialization of variable on startup or download (maybe the controller is resetting)
- Initializing through download file or external instruction
- Variable declared as Notification Variable in ioDisplay/OptoDisplay
- Variable initialized externally or from another controller through Peer2Peer transfer
- Variable as down timer counting to zero automatically
- Wrongly assigned pointer
- Variable used elsewhere for status result of instruction
- 64Bit Integer being moved to a 32Bit Integer
- Wrong I/O Base type or variable size declared in â€IO Unitâ€ instruction.
If none of the above helps, I would suggest zip mailing your strategy file to product support at Opto22, for them to take a look at where the problem is.