Monday, June 1, 2015

RPi Test #6: Bit Toggling

In this example (GPIO_TEST6), at each press of a pushbutton the state of an LED is toggled from OFF to ON or vice versa.
  • The Tagged Data and Local Multicast design patterns are reused from the previous example to simplify the system configuration.
  • An instance of the E_F_TRIG function block (FB) type is used to detect the keypress by issuing an EO event when a falling edge of the button state (BUTTON.RD_1) occurs.
  • The TRIGGER.EO event fires the OUTPUT.REQ event block to toggle the OUTPUT.OUT value, which is then passed to the LED.
    • The OUTPUT block is an instance of the E_TOGGLE FB type, whose interface and implementation are documented in the second and third figures below.
    • Although the E_TOGGLE implementation is modeled using instances of the E_SWITCH and E_SR FB types, the actual implementation uses optimized Java code.


xxx