Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

10. include map 30 h\" #define controlled include file 11 ORG OFF 00h. I AM THE

ID: 3784900 • Letter: 1

Question

10. include map 30 h" #define controlled include file 11 ORG OFF 00h. I AM THE MSP430 the string is placed on the stack 13. my Str DB HELLO TRORLD 14 the null character automatically added after the NAME main modul name 17 make the main label visible 18 PUBLIC main outside this module 20 OFFFEh ORG set reset vector to 'main' label DC16 main 22 RSEG CSTACK pre-declaration of segment 23 place program in CODE segment 24 RSEG CODE 25 26 main: MOV #SFE (C STACK) SP up stop watchdog timer 27 MOV.W NDT CTL 28 OFFh &P1DIR; configure P 1.x output BIS.B Mov. tmyStr R4 load the starting address of the string 29 30 into the register R4 31 R5 register R5 will serve as a counter CLR.B get a new character 32. gnext MOV.B ER4 R6 33 is it a null character 34 end if yes, go to the end JEQ 35 R6 character CMP.B it an if not, go to the next next 37 R5 if yes, increment counter INC 38 go to the next character next 39 40. end MOV.B R5, &P; Set all 1 pins 10UT 41 BIS.W ELPM4, SR LPM4 Required only for debugger 42 NOP 43 44 END

Explanation / Answer

#include "msp430.h"

ORG 0FF00h
  
myStr DB "Welcome to CPE325,home of MSP430!"
  
  
NAME main
PUBLIC main
  
ORG 0FFFEh
  
  
  
DC16 main
  
RSEG STACK
  
RSEG CODE
  
main : MOV #SFE(CSTACK),SP
MOV.W #WDTPW+WDTHOLD,&WDTCTL
       BIS.B #0FFh,&P1DIR
       BIS.B #0FFh,&P2DIR
       MOV.W #myStr,R4
      
       CLR.B R8 :: clearing R8 to store total number of characters
gnext : MOV.B @R4+,R6
CMP #0,R6
       JE lend
       INC R8
       JMP gnext
  

lend : MOV.B R8,&P1OUT :: For showing total number of characters
BIS.W #LPM4,S4
NOP

END     
      

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote