Microprocessors Homework Solutions

Microprocessors Homework Solutions - CpE 390:...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CpE 390: Microprocessor System Solutions to Homework #1: E . 1 . 3 ) A microcontroller is a VL S I c h ip t ha t com b ines t h e microprocessor core a n d m a ny ot h er perip h er a l f unctions suc h a s timers , seri a l inter fa ce , p a r a llel ports , A/D con v erter , a n d so on . E . 1 .5) Th e 68 HC1 2 c a n add ress up to 655 3 6 b ytes o f d i ff erent loc a tions . E . 1 . 10 ) l daa $8 00 l dab $8 01 st aa $8 01 st ab $8 00 E . 1 . 1 4) l daa $8 00 su ba $8 10 st aa $8 5 E . 1 . 1 7) se x B,D st d $ 900 ; store t h e si g n- e x ten d e d B in $ 900-$ 901 l dx $8 00 xgdx ; pl a ce t h e 1 6-b it num b er store d a t $ 900 into D su bd $ 900 st d $ 900 CpE 390: Microprocessor System Solutions to Homework # 2 : 2.6) l dd $8 11 addd $8 1 4 st d $ 901 l daa $8 10 ad c a $8 13 st aa $ 900 2.8) l daa $8 00 adda $8 01 daa ; adj ust sum to B C D st aa $8 03 2. 11 ) ; ********************************************************************* ; Th is pro g r a m uses t h e s a me met h o d a s s h own in E xa mple 2. 1 2 to per f orm ; t h e 24-b it b y 24-b it multiplic a tion . ; ********************************************************************** or g $8 00 db $ 1 2,$ 3 4,$56 db $ 09 ,$ 8,$ 1 5 or g $ 1000 l dd $8 01 l d y $8 4 emul ; pro d uce M L x NL sty $ 90 2 ; store M L x NL st d $ 90 4 l daa $8 00 l dab $8 03 mul ; pro d uce M H x N H st d $ 900 ; store M H x N H l d y $8 01 l dab $8 03 clr a emul ; pro d uce M L x N H addd $ 90 2 st d $ 90 2 e xg D,Y ad c b $ 901 st ab $ 901 l dab $ 900 ad c a #0 st ab $ 900 l d y $8 4 l dab $8 00 clr a emul ; pro d uce M H x N L addd $ 90 2 st d $ 90 2 e xg D,Y ad c b $ 901 st ab $ 901 l dab $ 900 ad c b #0 st ab $ 900 swi en d 2. 1 5) N e q u 2 or g $8 00 a rr db 3 ,8, 19 , 3 4,87,45,67,4 3 , 90 ,6 db 11 ,22, 33 ,44,55,66,77,88, 99 , 100 g t _ cntrm b ; g re a ter- t ha n- 1 6 count or g $ 1000 clr g t _ cnt ; initi a li z e t h e count to l dx # a rr ; use X a s t h e a rr a y pointer l dab # N ; use B a s t h e loop count l daa #1 6 loop cmp a ,X b ls ne x t inc g t _ cnt ne x t in x db ne b, loop swi en d 2.22) Th e le f t- s h i f t oper a tion s h oul d b e per f orme d f rom $8 7 tow a r d $8 00 . or g $8 00 a rr db $ 13 ,$4 3 ,$ 9 8,$AB,$4 9 ,$ 3C ,$52,$6 E or g $ 1000 l dx # a rr l dab # 4 loop lsl 7,X rol 6,X rol 5,X rol 4,X rol 3 ,X rol 2,X rol 1 ,X rol ,X db ne b, loop swi en d CpE 390 Microprocessor Systems Homework #3 solutions 4.2. The test program and the binary search subroutine is as follows: mean equ 0 max equ 1 min equ 2 key_lo equ 8 arcnt_lo equ 9 arr_lo equ 10 n equ 30 ; array count key equ 2 ; key to be searched org $800 result rmb 1 org $1000 lds #$8000 ; initialize the stack pointer ldx #arr pshx ldaa #n psha ldaa #key psha jsr bin_search staa result swi bin_search pshx pshb leas -3,sp ; allocate 3 bytes for local variables clr min,sp ; initialize min to 0 ldaa arcnt_lo,sp deca staa max ; initialize max to arcnt - 1 ldx arr_lo,sp ; use X as the pointer to the array loop ldab...
View Full Document

Page1 / 5

Microprocessors Homework Solutions - CpE 390:...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online