Macro instruction for the Omron CQM1H

Cruise13

Member
Join Date
Jun 2003
Location
Marikina City, Philippines
Posts
11
Hi, I am using an Omron CQM1H PLC. I was just wondering about the syntax for the Macro (function 99) command. For example, I have a program structure that checks for the input, the output and uses a 25502 (pulse contact) to drive another output.

Question 1: Can I use the 25502 using the macro command?
Question 2: My inputs and outputs are arranged accordingly. However, the macro command checks for words, and all inputs belong to word 000 and all outputs belong to word 100. Can I use the macro command given that my inputs are 00004-00009 and the even #'s within 00004 and 00014, and the outputs are the odd #'s within 00005 and 00015? Or do I have to do this the hard and long way?

I'm just asking 'coz if I can use the macro, then that saves me around 50 lines of repetitive programming.
 
First I dont see any reason why not to usr 25502 in macro(99)
2nd As you already know fun 99 work on word that mean you will have to isolated your bit after the macro command or arrange it in the way you want before.
I dont know what you try to do, but some time to write 50 lines in separated file is more easy.and esay to trace.
 
re: thanks

Thanks.

So, for example (just an easy and trivial one):

If I were going to make input 1 drive output 1, input 2 drive output 2, and so on, until input 15 drives output 15, you're saying there's no way that I can use Macro (99)? There's no tracing necessary in what I need to do, since I am already sure the program works (based on ladder simulations), but I'm just trying to find this out (which will make work easier for me in the long run.)
 
I didnt say so

What I mean is if you want to make any operation it must be on word so I think you need to translate the bit to word make your opration then translate your word to bit again.
Be more spcifice and then I will try to give you better answer.
 
Ok. Here goes:

I have inputs 00004 - 00009. Then I have six outputs (10004, 10006, 10008, 10010, 10012 and 10014) that drive circuit breakers and isolating switches to turn on (the inputs correspond to the outputs). The program evaluates the inputs, and then sets the outputs accordingly (some switches can't both be turned on, etc.). Because I thought I could use macro(99) and therefore needed outputs that were consecutive, I made it such that the indicator lamps for the six outputs correspond to outputs 10005, 10007, 10009, 10011, 10013 and 10015. One part of the program needs to check whether the inputs and the outputs actually jive (if 00004 is on, then 10004 should also be on). If they do, the indicator lamp is lit. If not, it should blink.

So far the program structure I've made is:

ld input
ld output
ld not output
and 25502 (pulse)
or ld
and ld
ld not input
and output
and 25502 (pulse)
or ld
out lamp

ladder diagram:

input output lamp
----] [--+-----] [---------------+------()----
| |
| output 25502 |
+-----]/[-------] [-----+
|
input output 25502 |
----]/[--------] [-------] [-----+






Now since the macro command only accepts the first three numbers here, all my inputs become 000, all my outputs become 100? [Am I right so far?] So how do I use the macro to be able to shorten the programming? I could just actually program the whole thing, but I still wanna learn if the macro is usable here in this situation. If so, how?

Thanks.
 
Last edited:
Now since the macro command only accepts the first three numbers here, all my inputs become 000, all my outputs become 100?
When you see an instruction that only calls for three numbers, it requires the use of words rather than bits.

Arikby has been trying to show you that that the MCRO(99) instruction uses entire words of inputs and words of outputs as its source and destination. Therefore you will have to move these inputs to a work word of some address higher than normal I/O. For the number of circuits that you have, it would be better to hard code these rungs rather han use MCRO(99).

MCRO(99) has intrigued many programmers as a way to reduce code, but it's limitations to only words frustrate them to the point of not using the instruction. If your circuit uses timers, it's an impossibility.

Even though it can't be used on CQM1H, you might want to look at the tutorial on MrPLC.com which shows how to use Index Registers to indirectly address bits.
Indirect addressing @ MrPLC.com
 
Last edited:
Thanks.

The "frustrating" part really cleared up things for me, coz that's how I was really feeling about the whole macro thing.So to use the macro I would need to move the input bits to other work words, etc. such that for example 00004 turns on xxx while 10004 turns on yyy and 10005 turns on yyy(y+1), etc. I was beginning to think the whole macro stuff for my program was useless, and now I really agree. ;)

Thanks again.
 

Similar Topics

Hello, I'm new to a program EBpro and I have to find a way to make a numeric object's background change colors depending on read data from plc...
Replies
3
Views
300
Hello everyone, this is my first post. FactoryTalk View SE v.13 I have a macro defined in my project that I would like to call up when someone...
Replies
0
Views
304
Hello Guys, I have been trying to study a Machine that have Omron 3g3mv VFDs that is controlled by CJ1m CPU and SCU41-V1 communication card. The...
Replies
0
Views
476
Hello Guys, I have a packaging machine in the company that I work for that have 8 Omron VFDs (3G3MV ) that are controlled via Modbus with CJ1M...
Replies
1
Views
641
Hello there. How to transfer data from one memory area to another using macro? Data Type - Double Word Length - 4 Format - BIN Integer -...
Replies
0
Views
653
Back
Top Bottom