Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;---------------------------------------------------------
- ; Name: ausgabe_verschieben
- ; Purpose: LED's nach links shiften
- ; Input: Port 4
- ; Return: Port 4
- ; Destroys: Nothing
- ;---------------------------------------------------------
- ausgabe_verschieben:
- ;save register
- push.w SR
- ;verschiebe ausgabe
- clrc
- rla.b LED
- adc.b LED
- ;return
- pop.w SR
- ret
- ;---------------------------------------------------------
- ; Name: wait8MHz
- ; Purpose: warte x * 1msec
- ; Input: R6 = anzahl ms
- ; Return: nothing
- ; Destroys: nothing
- ;---------------------------------------------------------
- wait8MHz:
- ;save register
- push SR
- push R8
- push R6
- outer_loop:
- mov.w #2666, R8
- inner_loop:
- dec.w R8
- jnz inner_loop
- dec.w R6
- jnz outer_loop
- pop R6
- pop R8
- pop SR
- ret
- ;---------------------------------------------------------
- ; Module/Filename: automatikbetrieb.asm
- ; HW-System: MSP430f1611 / BOCAS
- ; IDE: CodeComposer Studio
- ; Purpose: LED-Lauflicht
- ; Author:
- ; Dates: 19.11.2011
- ;---------------------------------------------------------
- .global main
- .cdecls "msp430f1611.h"
- .text
- ;definitionen
- &P4OUT .equ LED
- #0x10 .equ taster
- #0x02 .equ schalter
- ;Variablen:
- ;R6 - Zeitvariable
- main:
- ;init ports
- mov.b #0x00, &P1SEL ;digital i/o for P1
- bic.b #0xFF, &P1DIR ;input mode for all pins
- mov.b #0x00, &P4SEL ;digital i/o for P4
- bis.b #0xFF, &P4DIR ;output mode for all pins
- mov.b #0x07, &P4OUT ;anfangswert an port 4 legen
- loop:
- PRESSED:
- ;teste ob taster gedrueckt wurde
- bit.b taster, &P1IN ;#0x10 and P1IN -> SR
- jnz PRESSED
- ;test ob schalter auf handbetrieb oder automatik steht
- bit.b schalter, &P1IN
- jz handbetrieb
- jmp automatik
- handbetrieb:
- ;warte 30 ms zur entprellung
- mov.w #30,R6
- call #wait8MHz
- ;teste ob taster NICHT gedrueckt wurde
- bit.b taster, &P1IN ;#0x10 and P1IN -> SR
- jz loop
- ;rufe unterprogramm auf
- call #ausgabe_verschieben
- jmp loop
- automatik:
- ;warte 500 ms
- mov.w #500,R6
- call #wait8MHz
- ;ausgabe verschieben
- call #ausgabe_verschieben
- jmp loop
Add Comment
Please, Sign In to add comment