Flip-Flop as Service Interface Function Block SIFB

After creating a Service Interface Function Block (SIFB) perform the following steps to add the Flip-Flop functionality to your own SIFB.

  1. Within the Properties tab enter a comment description for the Flip-Flop like Flip Flop alternating on/off
  2. Within the Interface tab use the same interface as for the BFB:
    Flip-Flop BFB Interface
  3. For a SIFB the general structure is provided via 4DIAC-IDE function block export. Since you have to insert the desired Flip-Flop functionality into that structure, you have to export your SIFB first as it is described here.
  4. open the .cpp source file of the new SIFB and change the exported code here:
    void FORTE_FlipFlop3::executeEvent(int pa_nEIID){ switch(pa_nEIID){ case scm_nEventREQID: #error add code for REQ event! /* do not forget to send output evelt, calling e.g. sendOutputEvent(scm_nEventCNFID); */ break; } }
    Change the code, that either could not be created via a Basic or Composite FB like an interface to Hardware or needs to be more efficient due hardware space restrictions. Do not forget to send the output event as shown in the default comment. Notice the output event variable is scm_nEventID, in this case CNF.
    void FORTE_FlipFlop3::executeEvent(int pa_nEIID){ switch(pa_nEIID){ case scm_nEventREQID: Q() = !Q(); sendOutputEvent(scm_nEventCNFID); break; } }