Jump to content

Recommended Posts

Posted (edited)
can someone explain the following statements to me as simply as possible as however many times i read the explanations it doesn't sink in; [FMOV K0 K4M702 K14] [TO H1A H220 K4M1064 K4] i think i get some of it; in the first example you are moving the constant value '0' to M702 - M717? i am unsure of the function of the K14 a the end of the instruction? in the second example you are moving the data 'TO' the cclink card which has the designation H1A? H220 is the buffer memory address? K4M1064 means you are sending 16 bits from M1064, again, i am unsure of the function of the K4, other than it matching the K4 of the K4M1064, but this isn't always the case. after reading a few manuals etc it appears the K4M702 or K4M1064 is the head address with the end K4 being the amount of 'nibbles' to be transferred? if that is correct, why have the head address as a block of bits? this is on an A series PLC. any help would be appreciated. thankyou Duncan Edited by dunc

Posted
As you mentioned, for the bits (K4...) you are correct. When it comes to the HeadAddress this is not defined with K4 because it is a word address and not a bit address. Hence the start address is H220 which is a word. So when you transfer K4M1064 K4 into start BFM H220 you are moving data into H220 - H223 in the card. Did that explain everything?
Posted
I am even more confused now!? could you explain it in respect to the fmov command I posted up please? I have done very little cclink so may be easier for me to understand with a local command. for example; what would be the difference in operation with the following 2 commands: [FMOV K0 K4M702 K14] [FMOV K0 K4M702 K8] thanks
Posted
It's a long time since I used bits directly, but if I recall: FMOV K0 K4M702 K14 will move 0 into: K4M702 (M702 - M717) x 14 (M702-M925) FMOV K0 K4M702 K8 will move 0 into: K4M702 (M702 - M717) x 8 (M702 - M829) Did that help?
Posted
right, so the second K value at the end of the instruction is a multiplier? for example: [FMOV K0 K1M702 K8] would move a value of 0 into M702-M734 [FMOV K0 K2M702 K4] would also move a value of 0 into M702-M734 i assume this is done because you cant go any bigger than a double word value (K8M702) in one go so this gives you the ability to move more than a 32 bit word in a single instruction? please correct me if i am wrong and thankyou for your help :)
Posted
You basically have the idea, it's just confusing because the examples you are citing combine a couple of different features of the Mitsubishi instruction set. I'll try to deconstruct things a little, hopefully without further snarling your brain! Both instructions are more commonly used with data registers (D0, etc.), so let's ignore the added fun of the bit grouping (K4M0, etc.). FMOV (fill move) is a block fill instruction with the format [FMOV source destination quantity]. The source is a single data register or a constant. The destination is the first register that will be filled with the source data, and the quantity is a constant indicating the number of registers to be filled. So for example, [FMOV K0 D0 K14] would "fill" registers D0 through D13 (fourteen registers) with the value 0. A great way to clear a range of addresses! Now, as you've figured out, you have the option of grouping bit addresses and treating them like words in a lot of the instructions (though not all!). I won't bore you with the details since you understand that. Let's just return to your actual example by replacing the "D0" with K4M702. So, the instruction [FMOV K0 K4M702 K14] would "fill" the bit groups M702-M717, M718-M733, M734-M749..... you get the idea. So to answer your latest post, the quantity argument isn't really a multiplier. I guess that's one way of describing it, but it seems to me that it's a little misleading. I don't actually know what would happen if you wrote the instruction [FMOV K0 K2M702 K28]. Would that work the same? I suspect it would, but would have to test it. The TO instruction is a block move instruction that moves data from the processor to a special function module like analog or communications. There is also a FROM instruction that moves data the other directions. The format of the TO instruction is [TO address buffer source quantity]. The address is the "head address" of the module, which is calculated based on the location of the module in the rack and which cards are in front of it. I can explain more if you're interested (i.e. bored...). The buffer is the memory location on the module. The buffers are listed in the modules manual along with their purpose. The source is the location in the processor of the data you are moving. And the quantity is the number of registers to be moved. So for example, [TO H1A H220 D0 K4] would move the data in registers D0-D3 (four registers) into buffer memory locations 220-223 (hex) of the card located at location 1A (hex) on the backplane. In other words, the value in D0 would land in buffer 220, D1 would land in 221, etc. Now to go back to your original example, [TO H1A H220 K4M1064 K4] would move the data in bit group M1064-M1079 into buffer 220, the data in M1080-M1096 into buffer 221, etc. With the bit groups, it works like a bit mapping. M1064 would map to the least significant bit of buffer 220, and so on. With this instruction, we can see the importance of the distinction between "multiplier" and "quantity". In this case I do know what would happen if you would rewrite the instruction as [TO H1A H220 K2M1064 K8]. In this case, you'd be moving M1064-M1071 into buffer 220, M1072-M1079 into buffer 221, M1080-M1087 into buffer 222, and so on. Since the bit mapping is only moving 8 bits, the upper 8 bits of the destination address are reset to zero. As you can see, this gives you a completely different result! Hope this helps. Eschew obfuscation!
Posted
right. I think I finally get it, thanks. I guess as long as you are only mapping bits in that way instead of whole words and you are aware of what bits are where when transferred over the network via the buffer addresses you could transfer them either way as you would still end up mapping the same quantity of bits over in total, it would only affect their placing within the buffer addresses? are the buffer memory addresses single or double word registers or does that depends on the address? I was just wondering what would happen if you put [TO H1A H220 K8M1064 K4] would the 32 bit word overflow the register and cause issues or would the 16 LSB be lost? I understand you argument though, in the first example it is better to think of the K4M702 as a 16 bit word rather than M702 + 15 consecutive bits. that way the quantity value at the end of the instruction makes more sense across all instructions. as for you comment about finding out what the head address of the card is. is it always the same depending on the position of the card in the rack or can it always be different? for example if I had a rack with power supply,CPU then CClink card would the head address of that card be the same if I was to build another system and put the card in the same place? sorry if my questions seem a little basic, im only really familiar with melsecnet as we are a little behind the times where I work! thanks again, that has been a great help in understanding this.
Posted
1. When using TO instructions, you will write to as many sequentual buffer memories as you specify. So if you write 32 bits to the start buffer address H220 you will essentially write those 32 bits into H220 and H221!! The only time the PLC might complain is if you try to write into a non-existing buffer memory. Except from that, all BFMs are 16bit, and depending on the number of words (16bit) you transfer you will write to the same number of BFMs. 2. In the Q-series you can actually choose which HeadAddress any card will have (but all cards must have it's unique HeadAddress). So basically module 0 in the rack can have HeadAddress H0080 and so on. If unspecified in the prog software, the default is what the card IO is, hence you must count each module until you arrive at the specified module No problem with the questions. That's why we're here...
Posted
There are 16-bit and 32-bit versions of most instructions. I don't know about FMOV without checking the manual, but the 32-bit version of TO is DTO. If you enter the instruction as you have above, you'll get an error. It would have to be [DTO H1A H220 K8M1064 K4]. This would actually work identically to [TO H1A H220 K4M1064 K8]. Since buffer memory locations are always 16-bit I'm not sure why you'd ever need to use the 32-bit version, though I have seen a program the used it! On the A-series, the head address is based on the modules in the rack and is not fixed to the rack itself. The first slot is head address H00. The second slot depends on what is in the first slot. If the first slot is empty or has a 16-bit card (ie 16-point I/O cards), the the head address of the second slot is H01. If the first slot has a 32-bit card (ie 32-point I/O or special function module like analog), then the head address of the second slot is H02. This is because the 32-bit card takes two positions. The third slot depends on the second slot, and do on. The newer Q-series let's you override this default addressing.
Posted
thanks for everyones help. im by no means an expert now, but I understand a bit more which is always a good way to go. I will wait until I get something else I come across I don't understand and hassle everyone again!

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
×
×
  • Create New...