Sign in to follow this  
Followers 0
Dariusch

32Bit FIFO Q-System

15 posts in this topic

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

Share this post


Link to post
Share on other sites
Build it yourself. You can use BSL or BSR commands.

Share this post


Link to post
Share on other sites
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 by Inntele

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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 by Dariusch

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
Hi again, Here is my solution of doing it. I used a FOR TO loop

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
BTW, I also wished there was a DFIFW/ DFIFR instuction. Wishfull thinking I suppose! :P

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
See the solution of this task for IEC Developer in attachment below. DFIFO.rar

Share this post


Link to post
Share on other sites
Hi Inntele, I have not yet tried your FB's but I looks simple an without to much temp.var etc. Thank you! Dariusch

Share this post


Link to post
Share on other sites
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

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