Intro Microprocessor System (CDA 3331C) MSP430G2553 Microprocessor Used **TYPE T
ID: 3722067 • Letter: I
Question
Intro Microprocessor System (CDA 3331C)
MSP430G2553 Microprocessor Used
**TYPE THE SOLUTION PLEASE**
An example of an assembly program is given below:
.cdecls C,LIST,"msp430.h"
.text
.retain
.retainrefs
RESET
mov.w #WDTPW|WDTHOLD,WDTCTL
mov.w #__STACK_END,SP
mov.w #007Dh,&0200h ;the first number
mov.w #00B5h,&0202h ;the second number
mov.w #00E8h,&0204h ;the third number
jmp $
;------------------------
;Stack Pointer definition
;------------------------
.global __STACK_END
.sect .stack
;-------------------
;Interrupt Vectors
;-------------------
.sect RESET_VECTOR
.short RESET
.end
Explanation / Answer
a.
ORG 30h
main:
MOV R6,#65h
Call Subroutine
RET
; end of main program
;Subroutine to AND r6, 0001h
Subroutine:
MOV AX,R6
ANL AX,#01h ;AND Logic AX with 0001h
MOV R6,AX ;To store result in R6
RET ;To return to main Program
;end of subroutine
b.
ORG 30h
main:
MOV R6,#1000h ;1000h is the memory location
MOV R1,#05h ;To maintain the loop count
Again: Call subroutine
DJNZ R1, Again
RET
;End of Main program
;Subroutine to AND r6, 0001h
Subroutine:
MOV AX,@R0 ;To retrieve the value from memory locactio
ANL AX,#01h ;AND Logic AX with 0001h
MOV @R0,AX ;To store result in memory location
INC R0 ;To increment the memory location
RET ;To return to main Program
;end of subroutine
The Logic is same for any controller or processor, just the syntax changes.
This program works fine 8051 controller.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.