Micrologix file copy instruction

motor-mike

Member
Join Date
Dec 2003
Location
Grass Valley, CA
Posts
3
I am trying to program my own stack so I can handle it my own way rather than using the built in stack instructions (hum, I just had an idea). I am using an AB Micrologix 1200 Series C controller and am having problems with the cop (copy file) instruction as it acts like the file fill instruction, filling the dest location with length copies of the singular source location. This is not how I read the documentation for this instruction.

Am I crazy, or is there a problem.

Thanks
 
I'll go out on a limb here and guess that what you've got is something like:

COP
+---------+
---| |--------| N12:0 | (source)
| N12:1 | (destn)
| LEN 10 |
+---------+


If this is true, what is happening is that N12:0 gets copied to N12:1, then N12:1 gets copied to N12:2, etc. Whatever was in N12:0 gets propagated through the entire file (stack).

My suggestion to get around this would be to copy to a 'scratchpad file' and then back to the main file in order to do the PUSHing. The logic outline below will PUSH a word onto the stack:


The main file is copied to the scratchpad
COP
+---------+
---| |--------| N12:0 | (main)
| N13:0 | (scratch)
| LEN 9 |
+---------+
The scratchpad file is copied back to the main file shifted up by one word
COP
+---------+
---| |--------| N13:0 | (scratch)
| N12:1 | (main)
| LEN 9 |
+---------+
The incoming word is copied to the main file in the first position
MOV
+---------+
---| |--------| N7:0 |
| N12:0 |
+---------+



POPping is a lot easier, MOV the word being popped to wherever you need it and then do a COP this way:



COP
+---------+
---| |--------| N12:1 | (main)
| N12:0 | (main)
| LEN 9 |
+---------+

 
Doh!

You are completely right.

I didn't even need to finish reading, but thank you on the scratch file suggestion as it is exactly what I need.

Having spent the past 6 years programming in C++ it would have taken me a while to remember to look back to my assembly language days when programming a PLC. Now that my higher level programming paradigm has been properly reset I think I can manage it from here.
 

Similar Topics

I stumbled onto this behavior the other day, then went looking for old forum posts with the assumption that "there is nothing new under the...
Replies
0
Views
782
I want to talk to a micrologix 1100 from a Productivity 3000 PLC using Ethernet/IP protocol. I believe I need to generate an EDS for the...
Replies
2
Views
2,709
I'm a CO-OP student who is new to PLC's so this may be a stupid question, but I haven't been able to find the answer and this is bugging me. I...
Replies
2
Views
2,351
I have a Micrologix 1400 that I am setting up to communicate via Ethernet/IP to a Data Linc I/O master radio. I have one message working fine...
Replies
4
Views
2,486
I am reading and writing between two ML1400 PLC's. Previous versions worked just fine. Now all of a sudden I am getting an ERR message for only a...
Replies
5
Views
3,367
Back
Top Bottom