Issue a simple message

Messages can be triggered in 2 ways: simple and complex.

This Sample shows how a simple message is triggered in the PLC. The Code used for a simple message is shorter than for a complex message, but you will have less configuration possibilities.
 

  1. Create a new PLC-Project.
  2. Use the TcEventConfigurator to create a quit-requiring message with the SourceID 17001 and EventID 1
  3. Add following code to the project:
  4. (*Variable-declaration*)
    VAR
        event    : FB_SimpleAdsLogEvent;
        bEvent   : BOOL;
        bQuitEvt : BOOL;
    END_VAR
     
  5.  
  6. (*PLC Code*)
    Event( SourceID  := 17001,
           EventID   := 1,
           bSetEvent := bEvent,
           bQuit     := bQuitEvt);
  7. Start the PLC Program.
  8. Start the TcEventbar ('TwinCAT/Eventlogger' directory).
  9. By toggling bSetEvent1 the message will be triggered. Rising edge starts the message, otherwise it will be reset.
  10. Toggling bSetEvent won't reset the message cause it is a quit-requiring message. It must be deleted before bSetEvent can be reset and bQuitEvent must be set.

 

Requirements

Language / IDE

Source code

TwinCAT PLC (Structured Text)

Sample01.zip