Answered Essay: i have a practice problem where we have to create an assembly language program. This involves setting up a DIP switch and th

i have a practice problem where we have to create an assembly language program. This involves setting up a DIP switch and then to activate the LEDs on the Dragon 12 light board. The problem I am having is to implement the instruction where I have to set up switch 1 and 8. Can you provide an example of the instructions using the Code Warrior shell text (see below) as a guideline?

I use the  HCS12 Microcontrollers and Embedded Systems as a reference.

1.     When both DIP switches #8 and #1 are high, turn on all LEDs.

2.     When both DIP switches #8 and #1 are low, turn off all LEDs

3.     When DIP switch #8 is high and #1 is low, turn on all the even numbered LEDs.

4.     When DIP switch #1 is high and #8 is low, turn on all the odd numbered LEDs.

5.      Your program must to read DIP switches and turn on/off corresponding LRDs continuously until a Reset.

Expert Answer

 

START: CPL P1.0

ACALL WAIT

SJMP START

WAIT: MOV R4,#05H

WAIT1: MOV R3,#00H

WAIT2: MOV R2,#00H

WAIT3: DJNZ R2,WAIT3

DJNZ R3,WAIT2

DJNZ R4,WAIT1

RET

START: CPL P1.0

ACALL WAIT

CPL P1.0

CPL P1.1

ACALL WAIT

CPL P1.1

SJMP START

WAIT: MOV R4,#05H

WAIT1: MOV R3,#00H

WAIT2: MOV R2,#00H

WAIT3: DJNZ R2,WAIT3

DJNZ R3,WAIT2

DJNZ R4,WAIT1

RET

; 5s_delay.asm 5 second delay timer for DRAGON12 Rev. E board

; (c)2002, EVBplus.com, written by Wayne Chu

;

; Function: 5 second delay routine using output comparator 6

; The PB0 LED will be turned on immediately after running

; this program. It will be turned off after 5 second delay.

; Change the DELAY_TIME to 36000 will delay 3 minutes.

PB0: equ 1

DB6: equ $40

;

TB1MS: equ 24000 ; 1ms time base of 24,000 instruction cycles

; ; 24,000 x 1/24MHz = 1ms at 24 MHz bus speed

;DELAY_TIME: equ 36000 ; 36000 X 5 ms= 180 sec = 3 min

DELAY_TIME: equ 5000 ; 5000 X 1 ms= 5 sec

REGBLK: equ $0

#include reg9s12.h ; include register equates

org $1000

;

flag_5s: rmb 1

cnt_5s: rmb 2

STACK: equ $2000

org $2000

start:

lds #STACK

ldx #timer6

stx $3E62 ; initialize the int vetctor

ldx #REGBLK

ldaa #$ff

staa ddrb,x ; make port B an output port

staa ddrp,x ; make port P an output port

staa ptp,x ; turn off 7-segment LED display

staa ddrj,x ; make port J an output port

clr ptj,x ; make PJ1 low to enable LEDs

ldaa #$80

staa tscr,x ; enable timer

ldaa #DB6

staa tios,x ; select t6 as an output compare

staa tmsk1,x

cli

bset portb,x PB0 ; turn on LED PB0

jsr delay_5s

bclr portb,x PB0 ; turn off LED PB0

stp: jmp stp

delay_5s:

clr cnt_5s

clr cnt_5s+1

clr flag_5s

delay: ldaa flag_5s

beq delay

rts

timer6:

ldx cnt_5s

inx

stx cnt_5s

cpx #DELAY_TIME

bne tmr6

clr cnt_5s

clr cnt_5s+1

ldaa #1

staa flag_5s

rti

tmr6: ldx #REGBLK

ldd #TB1MS ; reload the count for 1 ms time base

addd tc6,x

std tc6,x

ldaa #DB6

staa tflg1,x ; clear flag

rti

org $3E62

fdb timer6

end

Buy Essay
Calculate your paper price
Pages (550 words)
Approximate price: -

Help Me Write My Essay - Reasons:

Best Online Essay Writing Service

We strive to give our customers the best online essay writing experience. We Make sure essays are submitted on time and all the instructions are followed.

Our Writers are Experienced and Professional

Our essay writing service is founded on professional writers who are on stand by to help you any time.

Free Revision Fo all Essays

Sometimes you may require our writers to add on a point to make your essay as customised as possible, we will give you unlimited times to do this. And we will do it for free.

Timely Essay(s)

We understand the frustrations that comes with late essays and our writers are extra careful to not violate this term. Our support team is always engauging our writers to help you have your essay ahead of time.

Customised Essays &100% Confidential

Our Online writing Service has zero torelance for plagiarised papers. We have plagiarism checking tool that generate plagiarism reports just to make sure you are satisfied.

24/7 Customer Support

Our agents are ready to help you around the clock. Please feel free to reach out and enquire about anything.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

HOW OUR ONLINE ESSAY WRITING SERVICE WORKS

Let us write that nagging essay.

STEP 1

Submit Your Essay/Homework Instructions

By clicking on the "PLACE ORDER" button, tell us your requires. Be precise for an accurate customised essay. You may also upload any reading materials where applicable.

STEP 2

Pick A & Writer

Our ordering form will provide you with a list of writers and their feedbacks. At step 2, its time select a writer. Our online agents are on stand by to help you just in case.

STEP 3

Editing (OUR PART)

At this stage, our editor will go through your essay and make sure your writer did meet all the instructions.

STEP 4

Receive your Paper

After Editing, your paper will be sent to you via email.

× How can I help you?