In step7, when writing FB or FC blocks, can I use M points instead of local variables?

Updated on delicacies 2024-08-05
16 answers
  1. Anonymous users2024-02-15

    1. Yes, but not recommended. Because the purpose of making an FB fc block is to call repeatedly, if the m point is used, it will cause the address to be repeated during repeated calls, resulting in the program may not run normally. 3. FC must be able to be made into FB, and FB may not be able to be made into FC.

    Because FB has its own background data, that is, it can store some intermediate variables for use in the next cycle, while FC cannot.

  2. Anonymous users2024-02-14

    In fc,fb, try to use the m point as little as possible, otherwise your fc, fb portability is not strong, on the contrary, it will cause problems when called multiple times, and it will not reflect the advantages of fc and fb, and the use of temporary variables in the ob can be replaced by m points.

  3. Anonymous users2024-02-13

    It should be possible in ob1, but it is rarely used in fc, fb, m is a global variable that is valid at all times, and a temporary variable is only valid for one cycle, so the block portability with a temporary variable is strong.

  4. Anonymous users2024-02-12

    Static variables and m-area are not the same function, after the static variable is used, it will be cleared when exiting fb or fc, then the next time the program calls this fb, the data stored in the same static variable will have to be rewritten. However, if you replace it with the m-zone, it will not be cleared, and sometimes the data will be superimposed when you call FB twice. See how your program is written.

  5. Anonymous users2024-02-11

    Question addendum: In this routine, ob1 also uses a large number of temporary variables, can it be replaced by m points?

  6. Anonymous users2024-02-10

    When calling the fc block, if a timer is used, then there will be an unstable value jumping phenomenon after multiple calls, modify the timer in the program, the timer code is in type or in-out mode, the format is selected in timer format, remember that the timer of the call cannot be repeated, and if the counter is used, it can not be reused, the code name of the counter should be connected with the in type or in-out mode, and the format is counter. When calling, fill in the code in order, timer such as t1, t2, t3, counter c1, c2, c3, and so on! Call the flower many times, remember, it must not be repeated, and the use of temporary variables is not at ease of the flower, just output the temporary variable to the outside in the db block, establish the structure variable in the db block, call it many times, write it once, copy and replace it!

  7. Anonymous users2024-02-09

    In the OB, FC can be called, in the FC can be called and then called is the main program, and FC and FB are the subroutines used to implement the control function.

    Zen Qin db is a data block.

    VAT is a variable table of FB that implements a specific function.

    What is the role of the UDT in the S7-300FM.

    In the S7-300, the FM function module has the ability to independently process its own IO, while the S7-300CPU, in addition to processing the IO, also calls the corresponding function block to communicate with the function module.

    The communication area exists in the format of UDT, and the user must first copy the UDT to their own project from the example of the Gonghe Xun Bineng module, and then generate the corresponding communication data block (UDT can not be ** to the CPU, while the DB block can), and call the corresponding function (Chang Tsai FC) for data communication.

  8. Anonymous users2024-02-08

    Of course. FC and FB are designed to be programmatically structured. If it is a small program, it can be written directly in ob1 or other required ob blocks.

  9. Anonymous users2024-02-07

    Upstairs, what do you want? I don't understand! Back to the owner, FC can be understood as a functional connection block, FB can be understood as a functional template, the two can be interchanged, but they have their own advantages in use, for example:

    FC is flexible and can do all the control functions, but when using the same control method (assuming that different devices under the same control scheme are divided into different groups) to control 10, 20, or more groups of devices, the same number of FC blocks will be used. If you make an FB block at this time, it is to make a function board, as long as you add a set of different data combinations to each template (FB calls DB block), in the case of completing the same control scheme, whether it is development, error checking, debugging, the advantages are obvious!

  10. Anonymous users2024-02-06

    FB has a background DB, FC does not, and programs that need to store data can choose FB

  11. Anonymous users2024-02-05

    That's right, yes, you should pull the program out and talk about it separately.

  12. Anonymous users2024-02-04

    I borrowed a learning version, I wanted to get familiar with it, but I didn't expect it to be saved, which is really hateful!

  13. Anonymous users2024-02-03

    It doesn't matter. Why don't you see clearly that in the block are temporary variables (as if they occupy the L store) or the input and output parameters of the block, etc. This is a bit like high-level languages (e.g. C and basic), where one is the main program (main) and the other is a subroutine or function, and the variable declarations of the two are not of the same use.

    This kind of problem is clearly written in the programming manual.

  14. Anonymous users2024-02-02

    The symbols in the table are global variables, while ob, fc, and fb are local variables, which are only useful in this subprogram.

  15. Anonymous users2024-02-01

    If you create your own FC input and output pins, you can set the default values.

  16. Anonymous users2024-01-31

    You program it this way, so that the first four contacts of p will only move after the logical operation has a rising edge! That is, if the normally open work is normally closed, it will not work, and there will be a rising edge, and the "pump start" will be in place.

Related questions
18 answers2024-08-05

There should be no problem with the device, mainly on the communication settings. For example, if you only have one communication port, and you set the port as a free communication protocol, it will naturally fail to communicate in the running state, and you can only use the PPI protocol in the stopped state, and the free port communication protocol is blocked at this time.

16 answers2024-08-05

Write in the mouseover event and mouseout event, and clear the word in the text box when there is focus.

4 answers2024-08-05

It's best to post the error prompt, or take a screenshot to see the reason, so that it is not clear. >>>More

6 answers2024-08-05

I encapsulated the fetch method into a function called week.,His three parameters are year, month and day.,In it, it will print out the day of the week.,I don't understand the place to leave me a message.。 >>>More

5 answers2024-08-05

This is the indirect method (the direct method is that a cash transaction is included in a cash flow). >>>More