Sign in to follow this  
Followers 0
tingxing

Omron Bit Set Instruction (vs. Mitsubishi PLC)

13 posts in this topic

Hello, I am looking for Omron PLC's bit set instruction, which is similar to Mitsubishi's, like, in Mitsubishi PLC: Set B1000Z0 if Z0 is 10AA, then B10AA will be set. has Omron's instruction set contains such functionality? In my application, PLC will receive a number for example N(i.e. a sequence number), and I want to set the set the Nth bit in a memory block (W or so). Many thanks in advance. Xing

Share this post


Link to post
Share on other sites
The TST instruction should perform the function you require. I'm sorry. This is wrong. The TST instruction is for comparison, not for setting. Edited by IO_Rack

Share this post


Link to post
Share on other sites
I have run out of time for the moment. I remember a discussion about this feature some time ago. The syntax is similar to: OUT W100.[D1] This will depend upon which PLC type you are using. I also remember it may compile in some PLC's but will not work. Maybe someone else can help us out here. I can't remember the solution.

Share this post


Link to post
Share on other sites
You did not mention which PLC you are using, but assuming that you are using a current model (CJ2, CP1, etc), then the SETB instruction can be used to do exactly what you are asking. The RSTB is the instruction to use to reset the bit. For instance, if your code looked like this: Then bit 5 (Value in D0) of W0 is set ON.

Share this post


Link to post
Share on other sites
Thank you all very much! Yes, I am using the current CJ2M cpu's. for SETB W0 D0 if D0 = 128, will W8.0 be set? I mean, will the set operation span out to more than the one word(16bit) ? Xing

Share this post


Link to post
Share on other sites
No. The bit number can only be #00 to #0F (0 to 15). Any larger value will cause an error and no bit will be set.

Share this post


Link to post
Share on other sites
Ah, then you would need to do something more like IO_Rack was saying (just use the SET instruction rather than OUT): Note that you cannot do this with all of our PLCs, but you can do it with the CJ2M.

Share this post


Link to post
Share on other sites
great! surely, it will be the Set command using Dxx offset. thank you for your example ladder! 1. really the No. 128bit will be set ? my current instruction manual (w474-e1-09_cs_cj_nsj.pdf, old?) says the offset should be constant 0-15 or word address in I/O memory. 2. is this command usable in CS1G? in my cxprogrammer, there is error report. though our production equipment uses CJ2M, I am currently using CS1G for testing. Edited by tingxing

Share this post


Link to post
Share on other sites
If you use IR/DR, bit 128 will indeed me set. Not sure how to do this in text, but something like: MOVR W0.00 IR0 MOV D0 DR0 BSET #0 W0 W100 (or however large your bit array is) OTE IR0,DR0 (Sorry, AB speak for the output instruction...) Edited by lostcontrol

Share this post


Link to post
Share on other sites
Nice one "lostcontrol". Completely forgot that IR's could be addresses as bits!!

Share this post


Link to post
Share on other sites
1. Yes, I tested the code that I entered above with the simulator in CX-Programmer. As you can see in the picture, the SET W0.00[D0] instruction, with D0 = 128 does in fact turn on W8.00 (see the watch window in the picture below the ladder rung - Highlighted in Green and Blue below). 2. No. CJ2 processors can do this, but no other Omron PLCs (not including NJ as a PLC).

Share this post


Link to post
Share on other sites
thank you Michael, now I understand CJ2 can do. and as you pointed out, CS1G wont work. And I tested BITS N BYTES' sample, it works! except that I changed the output to the SET instruction: the 128bit, after W0.0, i.e. W8.0 can be turned. thank you all for the instructions. as I stated above, the purpose is to translate a number (used as command code from PC) in to a bit command. In mitsubishi, the SET command conveniently translates the number into the B devices. I have long formed the bias that Omron's development tool(Cxprogrammer) is better than that of Mitsubishi(gxworks). This might be an exception? or I am actually wrong. Xing

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0