1 / 17

振動(傾き)を 検出

振動スイッチを活用. 振動(傾き)を 検出. ボールが移動. a) オン時. b) オフ時. オンからオフ時の観察. 処理の流れ(フローチャート). 振動スィッチの オン / オフ状態を 調べる. LOOP0 MOVLW D'20' MOVWF KAISU MOVLW D'0' MOVWF HENKA CHECK1 BTFSC PORTA,5 GOTO CHECK2 CALL WAIT1

lawson
Download Presentation

振動(傾き)を 検出

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 振動スイッチを活用 振動(傾き)を検出 ボールが移動 a)オン時 b)オフ時 オンからオフ時の観察

  2. 処理の流れ(フローチャート) 振動スィッチの オン/オフ状態を 調べる

  3. LOOP0 MOVLW D'20' MOVWF KAISU MOVLW D'0' MOVWF HENKA CHECK1 BTFSC PORTA,5 GOTO CHECK2 CALL WAIT1 BTFSC PORTA,5 INCF HENKA,1 GOTO CHECK9 CHECK2 CALL WAIT1 BTFSS PORTA,5 INCF HENKA,1 CHECK9 DECFSZ KAISU,1 GOTO CHECK1

  4. LOOP0 MOVLW D'20' MOVWF KAISU MOVLW D'0' MOVWF HENKA CHECK1 BTFSC PORTA,5 GOTO CHECK2 CALL WAIT1 BTFSC PORTA,5 INCF HENKA,1 GOTO CHECK9 CHECK2 CALL WAIT1 BTFSS PORTA,5 INCF HENKA,1 CHECK9 DECFSZ KAISU,1 GOTO CHECK1

  5. LOOP0 MOVLW D'20' MOVWF KAISU MOVLW D'0' MOVWF HENKA CHECK1 BTFSC GPIO,4 GOTO CHECK2 CALL WAIT1 BTFSC GPIO,4 INCF HENKA,1 GOTO CHECK9 CHECK2 CALL WAIT1 BTFSS PORTA,5 INCF HENKA,1 CHECK9 DECFSZ KAISU,1 GOTO CHECK1 命令語1 MOVLW X 機能:Xの値をWレジスタに記憶      「W=X」

  6. LOOP0 MOVLW D'20' MOVWF KAISU MOVLW D'0' MOVWF HENKA CHECK1 BTFSC GPIO,4 GOTO CHECK2 CALL WAIT1 BTFSC GPIO,4 INCF HENKA,1 GOTO CHECK9 CHECK2 CALL WAIT1 BTFSS PORTA,5 INCF HENKA,1 CHECK9 DECFSZ KAISU,1 GOTO CHECK1 命令語2 MOVWF X 機能:Wの値をXレジスタに記憶      「X=W」

  7. LOOP0 MOVLW D'20' MOVWF KAISU MOVLW D'0' MOVWF HENKA CHECK1 BTFSC PORTA,5 GOTO CHECK2 CALL WAIT1 BTFSC PORTA,5 INCF HENKA,1 GOTO CHECK9 CHECK2 CALL WAIT1 BTFSS PORTA,5 INCF HENKA,1 CHECK9 DECFSZ KAISU,1 GOTO CHECK1

  8. 命令語3 BTFSC X, N LOOP0 MOVLW D'20' MOVWF KAISU MOVLW D'0' MOVWF HENKA CHECK1 BTFSC PORTA,5 GOTO CHECK2 CALL WAIT1 BTFSC PORTA,5 INCF HENKA,1 GOTO CHECK9 CHECK2 CALL WAIT1 BTFSS PORTA,5 INCF HENKA,1 CHECK9 DECFSZ KAISU,1 GOTO CHECK1 機能:XレジスタのNビットを調べ、 0(クリア)ならば次の命令をスキップ

  9. 命令語4 GOTO ラベル LOOP0 MOVLW D'20' MOVWF KAISU MOVLW D'0' MOVWF HENKA CHECK1 BTFSC PORTA,5 GOTO CHECK2 CALL WAIT1 BTFSC PORTA,5 INCF HENKA,1 GOTO CHECK9 CHECK2 CALL WAIT1 BTFSS PORTA,5 INCF HENKA,1 CHECK9 DECFSZ KAISU,1 GOTO CHECK1 機能:指定のラベル行へジャンプ   (処理を移行)

  10. LOOP0 MOVLW D'20' MOVWF KAISU MOVLW D'0' MOVWF HENKA CHECK1 BTFSC PORTA,5 GOTO CHECK2 CALL WAIT1 BTFSC PORTA,5 INCF HENKA,1 GOTO CHECK9 CHECK2 CALL WAIT1 BTFSS PORTA,5 INCF HENKA,1 CHECK9 DECFSZ KAISU,1 GOTO CHECK1

  11. 命令語5 CALL ラベル LOOP0 MOVLW D'20' MOVWF KAISU MOVLW D'0' MOVWF HENKA CHECK1 BTFSC PORTA,5 GOTO CHECK2 CALL WAIT1 BTFSC PORTA,5 INCF HENKA,1 GOTO CHECK9 CHECK2 CALL WAIT1 BTFSS PORTA,5 INCF HENKA,1 CHECK9 DECFSZ KAISU,1 GOTO CHECK1 機能:指定ラベルのサブルーチンを  呼び出す(終了後は次の命令に戻る)

  12. 命令語6 INCFX, 1 LOOP0 MOVLW D'20' MOVWF KAISU MOVLW D'0' MOVWF HENKA CHECK1 BTFSC PORTA,5 GOTO CHECK2 CALL WAIT1 BTFSC PORTA,5 INCF HENKA,1 GOTO CHECK9 CHECK2 CALL WAIT1 BTFSS PORTA,5 INCF HENKA,1 CHECK9 DECFSZ KAISU,1 GOTO CHECK1 機能:レジスタXの値を+1する

  13. LOOP0 MOVLW D'20' MOVWF KAISU MOVLW D'0' MOVWF HENKA CHECK1 BTFSC PORTA,5 GOTO CHECK2 CALL WAIT1 BTFSC PORTA,5 INCF HENKA,1 GOTO CHECK9 CHECK2 CALL WAIT1 BTFSS PORTA,5 INCF HENKA,1 CHECK9 DECFSZ KAISU,1 GOTO CHECK1

  14. LOOP0 MOVLW D'20' MOVWF KAISU MOVLW D'0' MOVWF HENKA CHECK1 BTFSC GPIO,4 GOTO CHECK2 CALL WAIT1 BTFSC PORTA,5 INCF HENKA,1 GOTO CHECK9 CHECK2 CALL WAIT1 BTFSS PORTA,5 INCF HENKA,1 CHECK9 DECFSZ KAISU,1 GOTO CHECK1 命令語7 BTFSSX, N 機能:XレジスタのNビットを調べ、 1(セット)ならば次の命令をスキップ

  15. LOOP0 MOVLW D'20' MOVWF KAISU MOVLW D'0' MOVWF HENKA CHECK1 BTFSC PORTA,5 GOTO CHECK2 CALL WAIT1 BTFSC PORTA,5 INCF HENKA,1 GOTO CHECK9 CHECK2 CALL WAIT1 BTFSS PORTA,5 INCF HENKA,1 CHECK9 DECFSZ KAISU,1 GOTO CHECK1

  16. LOOP0 MOVLW D'20' MOVWF KAISU MOVLW D'0' MOVWF HENKA CHECK1 BTFSC GPIO,4 GOTO CHECK2 CALL WAIT1 BTFSC PORTA,5 INCF HENKA,1 GOTO CHECK9 CHECK2 CALL WAIT1 BTFSS PORTA,5 INCF HENKA,1 CHECK9 DECFSZ KAISU,1 GOTO CHECK1 命令語8 DECFSZX, 1 機能:Xレジスタの値を-1し、 0(ゼロ)ならば次の命令をスキップ

  17. LOOP0 MOVLW D'20' MOVWF KAISU MOVLW D'0' MOVWF HENKA CHECK1 BTFSC PORTA,5 GOTO CHECK2 CALL WAIT1 BTFSC PORTA,5 INCF HENKA,1 GOTO CHECK9 CHECK2 CALL WAIT1 BTFSS PORTA,5 INCF HENKA,1 CHECK9 DECFSZ KAISU,1 GOTO CHECK1

More Related