Posted 18 Jan 2022 (edited) I read the max value from a encoder SD4502. In the label I have sign the SD4502 as double word. If the trigger ( X10) is high then the value is counting in SD4502. If the trigger flange is going down I puls with DHCMOV the value from SD4502 to D0. Now I will storage this data like shifting but it is only working on 16 bit. Is any one that can help how I can solved for 32 bit? I have tryit with commando sfr, SFL or BSFR,BSFL and also SHR_E. measuring on belt.gx3 Edited 21 Jan 2022 by BL Share this post Link to post Share on other sites
Posted 18 Jan 2022 you should get a copy of the manual for your PLC. it will make your life much easier. many instructions are available in 16 and 32 bit version. names of 32bit instructions are easy to recognize since they start with D ("double word" is 2x16bit=32bit) example of such pairs include HCMOV and DHCMOV - move word or doubleword from highspeed counter RCL and DRCL - rotate left with carry RCR and DRCR - rotate right with carry exact name, availability and details of each instructions is in the manual i have not used FX5 but quick glance suggests that things are bit different here - instruction name does not change so SHL can be 16 or 32 bit as determined by type/side of the operands. https://dl.mitsubishielectric.com/dl/fa/document/manual/plcf/jy997d55801/jy997d55801t.pdf see page 1283 Share this post Link to post Share on other sites
Posted 19 Jan 2022 Dear panic mode, Thanks for your support. I have already try the SHR from page 1283. I have make 2 labels as double word so then they are 32 bit. One for in and the other one is for the SHR out. Then by N you must fill in 1 till 31. I have try all but if i try to rebuild (F4) then it give a error in the 32bit label. I have also try it with 16 bit then I can rebuild it and there is no error. I hope that you uderstand it otherwise let me now. Share this post Link to post Share on other sites
Posted 19 Jan 2022 Hello BL, do you really want to shift the bits of the counter in D0 or is it about reading multiple counter values and store them block by block? If you need to shift the bits of the counter (D0), this can be done with the SHL or SHR instruction, but I can't understand why you should shift bits of a counter. How many bits do you want to shift? If you need to swap high/low byte of the read counter you can use the DSWAP instruction. If you want to store multiple values (each after reading with dhcmov) you don't need a shift instruction. In this case you can the use the BMOV instruction. Alternatively you could use an index register e.g. Z1 and read the values after D0Z1. Share this post Link to post Share on other sites
Posted 20 Jan 2022 On 1/19/2022 at 2:23 PM, BL said: I have try all but if i try to rebuild (F4) then it give a error in the 32bit label. i know you did but... you still did not show what exactly did you try. please post your code and how you try to use the instruction as well as how used variables are declared and their values. Also post example of what you want or expect the code to produce. Then others will be able to comment on it or try it out themselves. Share this post Link to post Share on other sites
Posted 21 Jan 2022 @Panic mode thank you for your advice. My goal is for measuring a part on a belt. I do it with a encoder and with the trigger I start the measuring. I one cycles it can that we have max 30 products. This data I will **** this to data register so I can after the end cycles to write it to SD card. I have upload the program what I have now. But the problem is from ruel ±90. First is for starting the high speed counter. Then I read the max value from the high speed counter en move it to D0. Then some ruels for testing so I can put the value back to zero for tesing. And then where the problem is I will the data from the value shiften in D2 untill D60. So I can write it to a sd card after the cycles. But the valeu shiften for 32bit is not working. measuring on belt.gx3 Share this post Link to post Share on other sites