Jump to content

Recommended Posts

Posted
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
Posted (edited)
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
Posted
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.
Posted
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.
Posted
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
Posted
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.
Posted (edited)
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
Posted (edited)
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
Posted
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).
Posted
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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...