Dariusch Posted April 23, 2010 Report Posted April 23, 2010 Hi, Anyone know how to make a 32bit FIFO in a Q? The FIFW/FIFR does only work on 16bit. Thank you in advanced! Best regards Dariusch
JRoss Posted April 23, 2010 Report Posted April 23, 2010 Build it yourself. You can use BSL or BSR commands.
Inntele Posted April 24, 2010 Report Posted April 24, 2010 (edited) As a method, which is an alternative to suggested by JRoss, the 32-bit word can be divided into two 16-bit words (on high- and low-order part) and then each part synchronously write in/read from own FIFO. After reading two 16-bit words can be combined into single 32-bit word. Edited April 24, 2010 by Inntele
Crossbow Posted April 24, 2010 Report Posted April 24, 2010 I've always used DMOV and a pointer (number of entries doubled) to determine where to write, and to remove I use BMOV and move the whole table back 2 registers then decrement the count. This works for floating point as well, just change DMOV to EMOV.
Dariusch Posted April 25, 2010 Author Report Posted April 25, 2010 (edited) Hi All, Thank you for the replys. I self was thinking like Crossbow, but I can't use the BMOV with DINT!? Edit// And I want to use symbolic variables, because I want to use it as a generel Function. The BMOV will only be usefull when using Mitsu adresses direct. Edited April 25, 2010 by Dariusch
Crossbow Posted April 25, 2010 Report Posted April 25, 2010 You never mentioned you were using IEC. If you're not allocating addresses, then use an array and a bunch of MOVE instructions. This would be an easy function block to write. I may give it a shot in GX Works2 when I have some free time.
Dariusch Posted April 25, 2010 Author Report Posted April 25, 2010 Arh yes.. Sorry for the missing information at first. When having an array of 100 or even 1000 then I think making 100 or 1000 MOV instruction is not the solution. There should be a better way of doing it!? Best Regards Dariusch!
Dariusch Posted April 26, 2010 Author Report Posted April 26, 2010 Hi again, Here is my solution of doing it. I used a FOR TO loop
waynes Posted May 1, 2010 Report Posted May 1, 2010 As per crossbow, Use Z/V index registers. Much easier. Quick to index etc. No need for 100/1000 MOV instructions. Just use BMOV. Let's paint the picture a bit. Given: FIFO list with D register D100 containing the index number. D101+D102 containing the first data block (32 bits). D10 contains read/ written data. D1 is just a temp reg. for FIFR: Read the first two reg's as above (DMOV D101 D10) or wherever. Then move everything along, two spaces up * D100 K2 D1 BMOV D103 D101 D1 DECP D100 for FIFW: * D100 K2 D1 BMOV D101 D103 D1 DMOV D10 D101 INCP D100 Done.
waynes Posted May 1, 2010 Report Posted May 1, 2010 BTW, I also wished there was a DFIFW/ DFIFR instuction. Wishfull thinking I suppose! :P
Dariusch Posted May 1, 2010 Author Report Posted May 1, 2010 Hi Waynes, Yes It would be easier to make if you are using GX-Developer or If you do not whant to make a functionblock (FB) I use symbolic variable so I can not use your example. or can I Best regards Dariusch
Crossbow Posted May 1, 2010 Report Posted May 1, 2010 I have been reviewing the possibility of creating a function block in GX Works2 which could make a data table of 32-bit data. It would make use of an array, which would allow a global label with no address to be used for the table destination. If I get some time to work on it, I will post an example here.
Inntele Posted May 1, 2010 Report Posted May 1, 2010 See the solution of this task for IEC Developer in attachment below. DFIFO.rar
Dariusch Posted May 7, 2010 Author Report Posted May 7, 2010 Hi Inntele, I have not yet tried your FB's but I looks simple an without to much temp.var etc. Thank you! Dariusch
Inntele Posted May 8, 2010 Report Posted May 8, 2010 Hi Dariusch, Use and enjoy Using MELSEC IL language for writing functional blocks, not only provide the necessary functions with optimal code, but also allows to correct mistakes made by developers of IEC libraries. The single restriction is not possibility of array usage. Inntele
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