⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 u-scale led blinker.vsr

📁 8051试验程序 基础教材
💻 VSR
字号:
@visualSTATE @RuleBase @Format2 "NoName"

@Directives

  @visualSTATE 5-4-0-1273;
  @Date 2007-06-01;
  @Time 11:19:01;



@Declaration

  @ActionFunction
    VS_VOID TurnOffLED(),
    VS_VOID TurnOnLED();


@Definition

  @Event
    Pin13_Interrupt(),
    Pin15_Interrupt(),
    Timer_Interrupt();


@Implementation

  @StateMachine StateMachineSpec_4 =

    @State;

    @StateRegion;

    @Entry
      #TurnOnLED();

    @Exit;

    @Do;

    @InternalRule;

    @TransitionRule;

    @TerminationRule;

  @End;

  @StateMachine StateMachineSpec_3 =

    @State;

    @StateRegion;

    @Entry
      #TurnOffLED();

    @Exit;

    @Do;

    @InternalRule;

    @TransitionRule;

    @TerminationRule;

  @End;

  @StateMachine StateMachineSpec_2 =

    @State;

    @StateRegion;

    @Entry
      #TurnOnLED();

    @Exit;

    @Do;

    @InternalRule;

    @TransitionRule;

    @TerminationRule;

  @End;

  @StateMachine StateMachineSpec_1 =

    @State
      Blink_LED_On
        [[ Pos440 = "12 48 110 73 16 1 1638401" ]],
      Blink_LED_Off
        [[ Pos440 = "383 47 494 72 16 1 1638401" ]],
      @Initial _InitialState2
        [[ Pos440 = "4 -1 24 19 114689" ]];

    @StateRegion
      @OffPage Region1 (Blink_LED_On, Blink_LED_Off, _InitialState2)
        [[ Pos440 = "0 0 223 57", TextDisplayNote = "Preserve", 
           TextDisplayState = "Preserve", TextDisplayTransDesc = "Preserve", 
           View = "2 2 7" ]];

    @Entry;

    @Exit;

    @Do;

    @InternalRule;

    @TransitionRule
      Timer_Interrupt() @Src Blink_LED_On : @Dest Blink_LED_Off #TurnOffLED()
        [[ Pos440 = "148 20 349 55 0 809894016 98 3 0 4" ]],
      Timer_Interrupt() @Src Blink_LED_Off : @Dest Blink_LED_On #TurnOnLED()
        [[ Pos440 = "147 72 343 102 0 809894016 0 20 98 19" ]],
      @NoEvent @Src _InitialState2 : @Dest Blink_LED_On
        [[ Pos440 = "15 12 95 42 0 809894016 13 20 32 0" ]];

    @TerminationRule;

  @End;

  @StateMachine StateMachineSpec_0 =

    @State
      Blink_Off_LED_Off = StateMachineSpec_3
        [[ Pos440 = "91 189 226 239 16 1 1638401" ]],
      @Initial _InitialState1
        [[ Pos440 = "28 75 48 95 114689" ]],
      LED_On = StateMachineSpec_4
        [[ Pos440 = "389 23 526 61 16 1 1638401" ]],
      Wait1
        [[ Pos440 = "130 28 190 54 16 1 1638401" ]],
      Wait2
        [[ Pos440 = "433 191 495 217 16 1 1638401" ]];

    @StateRegion
      @OffPage Region1 (Blink_Off_LED_Off, _InitialState1, LED_On, Wait1, Wait2)
        [[ Pos440 = "0 0 171 91", TextDisplayNote = "Preserve", 
           TextDisplayState = "Preserve", TextDisplayTransDesc = "Preserve", 
           View = "2 2 7" ]];

    @Entry;

    @Exit;

    @Do;

    @InternalRule;

    @TransitionRule
      Timer_Interrupt() @Src Blink_Off_LED_Off : @Dest Wait1
        [[ Pos440 = "161 105 284 135 0 809894016 69 0 30 26" ]],
      @NoEvent @Src _InitialState1 : @Dest Blink_Off_LED_Off
        [[ Pos440 = "10 104 90 134 0 809894016 13 20 19 0" ]],
      Timer_Interrupt() @Src LED_On : @Dest Wait2
        [[ Pos440 = "459 101 594 131 0 809894016 72 38 28 0" ]],
      Pin15_Interrupt() @Src Wait1 : @Dest LED_On
        [[ Pos440 = "250 39 365 69 0 809894016 60 12 0 17" ]],
      Pin15_Interrupt() @Src Wait2 : @Dest Blink_Off_LED_Off
        [[ Pos440 = "274 219 388 249 0 809894016 0 13 135 15" ]];

    @TerminationRule;

  @End;

  @TopStateMachine Demo =

    @State
      Start
        [[ Pos440 = "35 278 95 303 16 1 1638401" ]],
      @Initial _InitialState0
        [[ Pos440 = "44 166 64 186 114689" ]],
      Blink_Off_LED_On = StateMachineSpec_2
        [[ Pos440 = "281 567 429 617 16 1 1638401" ]],
      @OffPage Change_LED_State = StateMachineSpec_0
        [[ Pos440 = "277 150 448 261 20 1 114689" ]],
      @OffPage Blink_State = StateMachineSpec_1
        [[ Pos440 = "259 350 482 423 16 1 114689" ]];

    @StateRegion
      @OffPage Region1 (Start, _InitialState0, Blink_Off_LED_On, 
      Change_LED_State, Blink_State)
        [[ Pos440 = "0 0 120 34", TextDisplayNote = "Preserve", 
           TextDisplayState = "Preserve", TextDisplayTransDesc = "Preserve", 
           View = "2 2 7" ]];

    @Entry;

    @Exit;

    @Do;

    @InternalRule;

    @TransitionRule
      Timer_Interrupt() @Src Start : @Dest Blink_State #TurnOnLED()
        [[ Pos440 = "96 290 299 320 0 809894016 30 25 0 20" ]],
      @NoEvent @Src _InitialState0 : @Dest Start
        [[ Pos440 = "53 176 133 206 0 809894016 10 20 19 0" ]],
      Timer_Interrupt() @Src Blink_Off_LED_On : @Dest Blink_State
        [[ Pos440 = "45 505 169 535 1 809894017 0 24 172 523 0 71" ]],
      Pin13_Interrupt() @Src Change_LED_State : @Dest Blink_Off_LED_On
        [[ Pos440 = "573 387 770 417 1 809894017 171 96 588 328 587 458 148 28"
            ]],
      Pin13_Interrupt() @Src Blink_State : @Dest Blink_Off_LED_On
        [[ Pos440 = "315 455 526 485 0 809894016 106 73 84 0" ]],
      Pin15_Interrupt() @Src Blink_State : @Dest Change_LED_State
        [[ Pos440 = "318 284 531 314 0 809894016 105 0 87 111" ]];

    @TerminationRule;

    [[ Pos440 = "10 10 130 60 16 1 114689" ]]

  @End;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -