Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

#include "msp430.

h" ; #define controlled include file

NAME main ; module name

PUBLIC main ; make the main label vissible


; outside this module
ORG 0FFFEh
DC16 init ; set reset vector to 'init' label

RSEG CSTACK ; pre-declaration of segment


RSEG CODE ; place program in 'CODE' segment

init: MOV #SFE(CSTACK), SP ; set up stack

oszto assign 140000


osztando assign 70000

main: NOP ; main program


MOV.W #WDTPW+WDTHOLD,&WDTCTL ; Stop watchdog timer

mov.w #HWRD(oszto),R4
mov.w #LWRD(oszto),R5
mov.w #HWRD(osztando),R6
mov.w #LWRD(osztando),R7
mov.w #0,R8

osztas: cmp r7,R5


jl vege
next:
sub.w R7,R5
subc.w r6,r4
inc R8
jmp osztas

vege:
cmp r4,R6
jl next

NOP

JMP $ ; jump to current location '$'


; (endless loop)
END

You might also like