Sign in to follow this  
Followers 0
pershad

Reading the Digital inputs using Mitsubishi FX1N

16 posts in this topic

Hi everyone, I have problem with reading the digital inputs from the Mitsubishi FX1N-40MR. For example, The digital Data entering the inputs is [1100101], i need to read this and store it in any memory register lets say D0. I have gone through the Mitsu Programming manual.. It says that MOV moves data from specified source to the specified destination. The problem is that the source(s) only accepts numbers like [MOV 5 D11] so when i turn X0 on D11=5 or data from one memory location to another like [MOV D8 D10] if i turn X0 on D10= Data in the D8. In no case data is read from the Inputs but only the given data is being moved from the source to destination. I will appreciate any help

Share this post


Link to post
Share on other sites
Look like very simple i,e 1100110 entering X0, X1, X2, X3, X4, X5, X6, X7. All i need is to send these values from inputs and store it in D0, D1, D2, D3, D4, D5, D6, D7. I don't know where i am going wrong. Seems like a simple MOV function will work but it isn't. I will be thankful if someone plz send me a sample programme just storing the X0 value(1) into (D0). That will solve my problem, I don't know where i am going wrong

Share this post


Link to post
Share on other sites
Try MOV K4X0 D0 This will move the status of inputs X0-X7 and X10-X17 into D0. Dave

Share this post


Link to post
Share on other sites
Try MOV K4X0 D0 This will move the status of inputs X0-X7 and X10-X17 into D0. Dave Edited by pershad

Share this post


Link to post
Share on other sites
If you want to copy a group of inputs starting from Xn into Dn register, use MOV K4Xn Dn. If you want the Dn register to reflect status of a single input Xn, use the most straightforward: LDI Xn MOV H0 Dn LD Xn MOV H1 Dn Or, the same may be done shorter, but less obvious way: WAND K1Xn H1 Dn Edited by Sergei Troizky

Share this post


Link to post
Share on other sites
Thanks. I understood the MOV K4Xn Dn function but i didn't understand what do you mean't by "LDI Xn" and "LD Xn". I was able to find the last function "WAND" in GX IEC Developer but in form of "WAND_3_M". will that make any difference if i use it?. If not then shall i use it like "WAND_3_M K1Xn H1 Dn". Would you please be able to tell me that what is "H1" and does it reamin constant or will change like H1, H2, H3....for changing inputs Like X1, X2, X3... Thanks again and will appreciate your reply

Share this post


Link to post
Share on other sites
H1 indicates the hex number 1. It's a constant.

Share this post


Link to post
Share on other sites
LD is mnemonic for "load" instruction (viewed as ladder, this is a normally open contact), example 'LD M0' is normally open contact with bit M0 LDI is "load inverted" (normally closed contact) you can just type this in and see what you get (well not sure about IEC part...) WAND is bitwise AND operation on 16-bit data. for example WAND H135A HA531 D0 will perform AND operation on mentioned hexadecimal values and place result (H1110 in this case) into D0 register. As mentioned leading H denotes hexadecimal value so H135A is same as 0x135A which is same as decimal value 4954. leading zeroes can be omitted so instead of writing H0001, you may also write H1 which is just 1. To specify decimal value just use prefix K (K4954 is same as H135A, K1 is same as H1). When treating bits as groups, one must specify quantity in nibbles. Nibble is 4-bit, byte is 8-bit or two nibbles. Example of specifying blocks of bits: MOV K1X0 D0 ; copy 4 inputs (1 nibble) starting from X0 into a D0. this means X0,X1,X2 and X3 are being copied MOV K0 K3M50 ; write value zero to 12 bits (3 nibbles) starting with M50 MOV H3AB7 K4Y20; set 16 outputs starting with Y20 to a binary pattern expressed as hexadecimal value 0x3AB7

Share this post


Link to post
Share on other sites
Thanks alot Everyone. That was really helpful. I have made this programme using GX IEC DEVELOPER to read the channel 1 and 2 of the analogue unit FX2N-4AD of Mitsubishi PLC for voltage and current. When i run the program i am getting this error shown in attachment. Can anyone please tell me how i can solve this error please(i have tried different memory locations). Can anyone please tell me is it the right program to read the voltage and current from the analogue channels and how can i use STL programming to sequentially write this programme . Thanks alot Edited by pershad

Share this post


Link to post
Share on other sites
Don't know if this will work, since I tend to complicate things The result of the "MUL_M" instruction is 32 bits wide. If you create a 32 bit register in the global variable list with start address D13 am I almost sure it will work. Edited by Bryll

Share this post


Link to post
Share on other sites
seems like its already defined as shown but its not working. can u plz tell me whr im going wrong. :) Thanks

Share this post


Link to post
Share on other sites
No, it's not created. What you are looking at is the names of the inputs and outputs of the function block. This is not your global labels. You need to create a global label and put a variable in which is DINT. And it shouldn't start on an odd address like D13, use even numbers for double words. The problem is that using addresses instead of labels it follows the standard that all data registers are 16 bit, and the output from the MUL has to be a 32-bit.

Share this post


Link to post
Share on other sites
If you instead of D13 type for example "Result" as identifier at the output of your MUL_M block and hit enter twice, the global variable definition window will appear. In this window can you specify the variable type and address. No worries to use an odd start address like D13, as long as you don't try to use D14 for anything else since this variable (DINT) will use two D-addresses. It will be a lot easier to follow the program if you use labels instead of direct addressing. When all this is done, use "Ctrl-Shift-M" to toggle between "Identifier-Mitsubishi Addr.-IEC-Addr" modes. I hope you understand what I try to explain here, I'm not very good at English.

Share this post


Link to post
Share on other sites
Bryll, while there is no problem with using D13 as a DINT, the manuals do state to start 32-bit data on even numbers. Has something to do with memory architecture or network communications or something along those lines.

Share this post


Link to post
Share on other sites
I got it. Thanks. you are very good at what you are doing. Your English is better than mine :)

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