Nanasakiai

Main Program of CPU Q-Series memory

8 posts in this topic

Dear all,

Am currently having problem with the Main program memory of  Q-CPU series ( Q03UDV). The problem is my Main program total weight about 250,000 bytes but my PLC capacity just only 115,344 bytes. 

Am asking for the solution here to reduce the Main program because I use FB which wrote in SCL. Do I need to change all my program into LAD to be able to meet the capacity of the PLC or the is other ways to solve this problem.
If not about the software, are there any memory card or module or something that can help extend the Capacity ??

Thanks for reading.

Best regards, 

Untitled.png

Share this post


Link to post
Share on other sites

@Nanasakiai SD memory card can increase number of data device, store backup program and data logging but your Main CPU should have capacity suitable with program do you write for your current program you should use Q06UDVCPU (nearly reach maximum memory) or Q13UDVCPU (for future programming) to use with your program.

1 person likes this

Share this post


Link to post
Share on other sites

Hi @Wasan,

Thanks for your quick reply.

Sadly, I already got the CPU for the project based on the Maximum I/O. So I will stick with the CPU and finding solutions for this problem. So only SD card can increase the Main Program @@. If all the program was written in LAD , would have had any effects ?? I do see the memory decrease when using  LAD style when trying to reduce the total size.

Best regards, 

Share this post


Link to post
Share on other sites

Unfortunately Mits isn't really good at using function blocks (this is of course in my own experience).

You will find that you use much less memory/ steps if writing it in ladders/ steps, instead of FB's.

The CPU you have chosen is too small (capacity size) and a larger CPU would be needed.

1 person likes this

Share this post


Link to post
Share on other sites

Thanks for the replied @waynes,

Working with Mitsubishi for a short time then I realized that Mitsu don't have the big fourm and demo examples of its own compare to Siemens. You guys know any site that have a big size of Example and guide for Mitsu ( not that Mrplc.com is bad but I want to learn more you know T^T ). 

Big thanks from me again! Hope you have a nice days and keep this up.

Best regards,

Share this post


Link to post
Share on other sites

There are lots of trick to reduce your program size but I would suggest changing the CPU as already recommended.

The problem is too general to give any meaningful help.

Hints would be:

- look at the program structure -  use "for next" loops for example.

- Load the program into the plc, or at least half of it. Upload a raw ladder - see how the function block bloat the program.

- Look at your addressing and see if index registers can help.

-You can then go deeper and look for repeated snippets of code.

Your program will probably end up being completely unreadable and if it does fit in the plc it will leave no room for expansion.

 

 

1 person likes this

Share this post


Link to post
Share on other sites

Never used SCL.  But the only way to get more program memory is get the right size CPU.

If you create function blocks from your repetitive code sections, then they can be called multiple times like subroutines but do not take up as much memory.  Or as someone else said, try to use some FOR/NEXT loops to create sections of code.

Never size a PLC by the number of inputs and outputs it can control.

Share this post


Link to post
Share on other sites

As both @Veganic and @Crossbow writes, you nede to size your CPU correctly (or reprogram your code if possible to use loops and reuse code).

Some has mentioned that FB's take up a lot of space, but that is not always correct. FBs can sometimes use less space than not using FBs, it all depends on how you use it and how it is configured, but you need to know some basics about them first.

First of all there are FBs and FUNs. FBs are instantiated whilst FUNs are not instantiated. If you have something that doesn't deal with states (e.g. Timers need states) then you can often put them in FUNs. The same goes for FBs without the tick for macrocode. FBs without macrocode are called as subroutines and are great when not dealing with states, however the payload for generating the subroutine sometimes calls for the use of macrocode even if the FB is not dealing with states. Therefore, if it is a large FB and you use it at least 2 times in your code, and it's not dealing with states, then it's probably a good idea to generate it without macrocode. If you use it only one time (you've created the FB as a structured way of programming), then it's almost always space saving to generate it with macrocode.

To be clear on some terms:
FB: Function block - instantiated
FUN: Function - non-instantiated
Macrocode: When enabled, the code in the FB will be "inserted"/injected in your main-code inline without any calls. When not enabled, the code in the FB will be put more or less as a subroutine and called in the proper places in the main-code.

P.S. SD card will NOT increase the maximum size of your main program. It will NOT be able to handle a larger code than what you already know. You need to read @Wasan's post in more detail as it is well explained there (devices/log-files/backup).

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