Sign in to follow this  
Followers 0
lchamarthi

How to do masking in Omron

24 posts in this topic

Hi Everybody! I have 16 point input module. I am interrested in some those bits (8 to15) for some data manipulations. I can use each bit indiadully which will make lenthy program. What instruction from Omron to achive the above functionality (MVM is equi..instruction in Allen Bradley)? Kindly suggest me some way to achieve this? Thanks & Regards LChamarthi

Share this post


Link to post
Share on other sites
Just to clarify a few things in LChamarthi's post and I hope I am not incorrect on this There is two decimal values coming from a 16 point input module. The first on is in bits 0-8 and the second is in bits 9-12. Need to AB equivalant of a MVM (Mask Move) with a mask of 511 to get the first value out. And then either a BTD (Bit Distribute)with a source bit of 9, destination bit of 0 and a lenth of 4 or a MVM and a DIV with a mask of 7680 and divided by 512. Edit - I incorrectly stated the secod value as bits 8-12. It should have been 9-12 Edited by TWControls

Share this post


Link to post
Share on other sites
I don't know AB's MVM instruction. If you want to use bits 8 - 15 as a separate word then try this: A logical AND with #FF00. Then move the 2 leftmost digits to the 2 rightmost positions in the channel. The example uses ch.00 as your input module and ch.31 as storage for my result. I updated the image. The MOVD instruction was using the same channel for source and destination. Last Edit: I removed the image as it was not useful but only more confusing. Edited by IO_Rack

Share this post


Link to post
Share on other sites
So just to clarify on this part. First value (bits 0-8) ANDW Input 1 - 16 point input module Input 2 - 01FF Result Word - First Value Second value (bits 9-12) ANDW Input 1 - 16 point input module Input 2 - 1E00 Result Word - Storage Location MOVD Input 1 - Storage Location (Specified to bit 9 Location?) Input 2 - (I'm unclear on control value) Result Word - Second Value Or lchamarthi, do you understand enough of this to take it from here? Edited by TWControls

Share this post


Link to post
Share on other sites
His original statement was that he wanted to manipulate bits 8-15. So the ANDW mask should be 00FF.

Share this post


Link to post
Share on other sites
Can you clarify this one too? I think lchamarthi is going to need it too. This is a continuation of THIS thread and some PMs. Specificly look at post #7. It is a 32 point input module, but the first value is bits 16-24 and the second value is bits 25-28. Wiring the upper half of the 32 point input module to a 16 point input module it would be bits 0-8 for the first value and 9-12 for the second value I hope I am not giving them too much information lchamarthi but I know it is getting late there.

Share this post


Link to post
Share on other sites
Hello, I couldn't able to understand the MOVD instruction part. Can you clarify please! LChamarthi Edited by lchamarthi

Share this post


Link to post
Share on other sites
I have a small doubt, If we use ANDW then no problem for the bits which we are interested to mask, when we come to remaning bits status should not change in the destination where as here if suppose Source---1 Mask--0 then Dest---0 which should be 1. Is it correct? By this total destination value will change. Lchamarthi

Share this post


Link to post
Share on other sites
Quick tutorial on Move Digit (MOVD) MOVD_Instruction_061803.doc

Share this post


Link to post
Share on other sites
So am I correct in thinking that moving bits 9-12 to 0-3 is going to be more difficult? lchamarthi would be better to wire the second values wires to 12-15 instead of 9-12? Is that correct? Actually instead of going through that lchamarthi can just use the ANDW and then divide by 512. That will move them from bit 9-12 to bit 0-3 won't it? Edited by TWControls

Share this post


Link to post
Share on other sites
Throughout your assistance, you keep referring to bits 0-8 and 9-12. Does bits 0-8 constitute 8 bits or 9 bits? If 9 bits, is bit 9 the hundredths bit when using BCD?

Share this post


Link to post
Share on other sites
It does have 9 bits (0-8) for one decimal value and 4 bits (9-12) for a second decimal value. It is some device multiplexing data over discrete I/O. The 9 bit value is the data and the 4 bit data is the address that tells what the data is. Pretty much if the address (4 bit) is 0 (decimal) and the data (9 bit) is 125 (decimal) the program moves 125 (decimal) into a storage array position 0. If the address is 4 and the data is 30345 (decimal) then 30345 (decimal) is put into position 4 of the storage array. As for what it does exactly or what the device it I don't know. I helped interpret an AB Controllogix program that was using it but when it came to how to do it in Omron I suggested that a topic be started over here. Hopefully I will get a chance to play with Omron one day but haven't yet Edited by TWControls

Share this post


Link to post
Share on other sites
And it is not a BCD. It is just a binary representation of a decimal value

Share this post


Link to post
Share on other sites
So he needs to separate bits 0-8 into its own channel for data (binary) manipulation and... separate bits 9-12 into its own channel for array pointer information?

Share this post


Link to post
Share on other sites
Yes. I think my terminology isn't helping us any. By channel do you mean something like tag, memory space, data address? I think we are saying the same thing.

Share this post


Link to post
Share on other sites
OK. 1.Use the ANDW concept to get bits 0-8 out of the input channel into an internal word using a mask of #01FF. 2. There a number of slick ways ( no pun intended) to get bits 09-12 out of the input word into an internal word, but since there are only 4 bits, let's just use 4 coils. LD 000.09 OUT 050.00 LD 000.10 OUT 050.01 LD 000.11 OUT 050.02 LD 000.12 OUT 050.03

Share this post


Link to post
Share on other sites
Yes. Omron uses the term channel. To get bits 0-8, you would ANDW #01FF (0000 0001 1111 1111). If using for data manipulation then you would probably want your destination to be a DM location. To get bits 9-12, you would have to shift the bits 1 place to the right then extract the 3rd digit using MOVD instruction. Example: ch. 0 = #1234 (0001 0010 0011 0100) First MOV it to another register (ex. DM0000), then ROR(28) Rotate Right (0000 1001 0001 1010) Then use MOVD to move 3rd digit to another channel in first position. (0000 0000 0000 1001)

Share this post


Link to post
Share on other sites
That looks like what he needs to me. We'll find out tomorrow. Thanks a lot guys. Sorry my terminology was causing confusion.

Share this post


Link to post
Share on other sites
Getting bits 9-12 can be done a little easier using the XFRB(062) Transfer Bits instruction. C = #0409 S = Source Channel D = Destination Channel Edited by ECSI

Share this post


Link to post
Share on other sites
I willtry to explain better by following attachment. Bits 0--8 are interested to take the new status into Destination from Source, even we are getting this. But from 9--15 bits, we are not interested in new state of these but we are taking its old status. Now in this case some these are 1's but when in Destination result is "0". Because I am taking the total Destination word for data manipulations I will get differences. Please suggest how to achive this Regards LChmarthi

Share this post


Link to post
Share on other sites
ESCI - good point but he has not clarified what model he is using or am i missing something.& In the case of the insctruciotn u mentioned The statement "All PLCs" under the Availability heading means available for the following PLCs: CS1G, CJ1G, CS1H, CS1G-H, CS1H-H, CJ1G-H, CJ1H-H, CJ1M, CS1G-H /CS1H-H /CJ1G-H /CJ1H-H /CJ1M Ver.2.0/3.0, CS1D-H Ver.1.1, CS1D-S Ver.2.0, NSJ, and CP1H. ichamathi - You have just succedded in confusing me even more by the statement Ok, sorry for yhe continuous bold, it just ain;t turning off..... Anyways... IF you want bits 9-15 to be a constant state then after you ANDW the original source and place into a destination of couse these will be a value of 0 for each. Then I would OR this destionation result with the states you want on . IE assuming channel 000 is input word and H000 is result 1, H001 = result 2 (so you can see what is happening) and we want a 9-15 bit config of 0-1-0-1-1-0-1 (bits 9-15 say) ANDW #01FF 000 H000 OR #5A00 H000 H001

Share this post


Link to post
Share on other sites
Hi ESCI!, This XFRB(062) is a very suitable instruction to transfer & moving to required position at the same time means masking (MVM) & moving bits to right most position(DIV) (refering to previous post ) is done by XFRB. Thanks a lot..... Best Regards LChamarthi

Share this post


Link to post
Share on other sites
Glad it helped. What model PLC are you using anyway??

Share this post


Link to post
Share on other sites
We are using CJ1M-CPU13 PLC

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