Question: ;------------------------------------------------------------------------------- ; MSP430 Assembler Code Template for use with TI Code Composer Studio ; ; ;------------------------------------------------------------------------------- .cdecls C,LIST,msp430.h ; Include device header file ;------------------------------------------------------------------------------- .def

;------------------------------------------------------------------------------- ; MSP430 Assembler Code Template for use with TI Code Composer Studio ; ; ;------------------------------------------------------------------------------- .cdecls C,LIST,"msp430.h" ; Include device header file ;------------------------------------------------------------------------------- .def RESET ; Export program entry-point to ; make it known to linker. ;------------------------------------------------------------------------------- .text ; Assemble into program memory. .retain ; Override ELF conditional linking ; and retain current section. .retainrefs ; And retain any sections that have ; references to current section.

;------------------------------------------------------------------------------- RESET mov.w #__STACK_END,SP ; Initialize stackpointer StopWDT mov.w #WDTPW|WDTHOLD,&WDTCTL ; Stop watchdog timer

;------------------------------------------------------------------------------- ; Main loop here ;------------------------------------------------------------------------------- bis.b #11111111b, &P1DIR bic.b #11111111b, &P1OUT

loop_1: bis.b #11101111b, &P1OUT ; 9 bis.b @R11, &P1OUT push.w R11 call #delay pop.w R11

bis.b #01111111b, &P1OUT ; 8 bis.b @R11, &P1OUT push.w R11 call #delay pop.w R11

bis.b #00000111b, &P1OUT ; 7 call #delay

bis.b #11111101b, &P1OUT ; 6 call #delay

bis.b #11101101b, &P1OUT ; 5 call #delay

bis.b #01100110b, &P1OUT ; 4 call #delay

bis.b #01001111b, &P1OUT ; 3 call #delay

bis.b #01011011b, &P1OUT ; 2 call #delay

bis.b #00000110b, &P1OUT ; 1 call #delay

bis.b #00111111b, &P1OUT ; 0 call #delay

delay mov #0, R5 mov #0, R4

odd_even: ;Over here i need to count number of 1's in binary but cant figure out how to do it jnz try jz delay_over

try: bic.b #01111111b, &P1OUT bis.b #00111111b, &P1OUT ; 0 jmp continue delay_over: inc R4

keep_delay: inc R5 cmp #1000000, R5 jne keep_delay cmp #3, R4 jne delay_over bic.b #01111111b, &P1OUT

jmp continue

continue

ret

;------------------------------------------------------------------------------- ; Stack Pointer definition ;------------------------------------------------------------------------------- .global __STACK_END .sect .stack ;------------------------------------------------------------------------------- ; Interrupt Vectors ;------------------------------------------------------------------------------- .sect ".reset" ; MSP430 RESET Vector .short RESET Hi, i have homework where i should count number of 1's in binary that i set which have odd number then i need to display this on 7 segment display. On the code i wrote a comment where i should do this. I am working with texas insturment msp430.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!