pershad Posted February 25, 2014 Report Posted February 25, 2014 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
pershad Posted February 25, 2014 Author Report Posted February 25, 2014 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
plcdp Posted February 25, 2014 Report Posted February 25, 2014 Try MOV K4X0 D0 This will move the status of inputs X0-X7 and X10-X17 into D0. Dave
pershad Posted February 25, 2014 Author Report Posted February 25, 2014 (edited) Try MOV K4X0 D0 This will move the status of inputs X0-X7 and X10-X17 into D0. Dave Edited February 25, 2014 by pershad
Sergei Troizky Posted March 1, 2014 Report Posted March 1, 2014 (edited) 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 March 1, 2014 by Sergei Troizky
pershad Posted March 4, 2014 Author Report Posted March 4, 2014 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
Crossbow Posted March 5, 2014 Report Posted March 5, 2014 H1 indicates the hex number 1. It's a constant.
panic mode Posted March 5, 2014 Report Posted March 5, 2014 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
pershad Posted March 7, 2014 Author Report Posted March 7, 2014 (edited) 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 March 7, 2014 by pershad
Bryll Posted March 7, 2014 Report Posted March 7, 2014 (edited) 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 March 7, 2014 by Bryll
pershad Posted March 7, 2014 Author Report Posted March 7, 2014 seems like its already defined as shown but its not working. can u plz tell me whr im going wrong. :) Thanks
Crossbow Posted March 7, 2014 Report Posted March 7, 2014 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.
Bryll Posted March 7, 2014 Report Posted March 7, 2014 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.
Crossbow Posted March 7, 2014 Report Posted March 7, 2014 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.
pershad Posted March 8, 2014 Author Report Posted March 8, 2014 I got it. Thanks. you are very good at what you are doing. Your English is better than mine :)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now