This is the code that I need to change to do the following: 1. Write an hcs12 as
ID: 3532058 • Letter: T
Question
This is the code that I need to change to do the following:
1. Write an hcs12 assembly language program to turn only the middle LED ON with the others OFF?
2. Write an hcs12 assembly language program to continuously turn all 3 LEDs simultaneously ON and OFF (toggle) with a one-second delay between each toggle?
3. Write an hcs12 assembly language program that uses the LEDs to display binary values corresponding to decimal values from 0 to 7 sequentially, with a 0.75-second delay between each digit displayed?
XDEF Entry, _Startup ; export 'Entry' symbol<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
ABSENTRY Entry ; Application entry point
INCLUDE 'derivative.inc'
; Following Labels are defined in 'include file' so do not need to
; be redefined here if needed
;
;RAMStart EQU $2000
;RAMEnd EQU $3FFF
ORG ROM_C000Start
Entry:
_Startup:
LDAA #$FF
STAA DDRT ; Define Port T as an output
; 3 LEDS ARE IN BIT POSITIONS 6,5,4
STAA PTT ; Turns All LEDs OFF (Recall active low)
LDAA #~$50 ; Turns LED3 and LED1 ON (Recall active low)
STAA PTT ;
L1: bra L1 ; place cursor here when using 'run to cursor' in Debug
Explanation / Answer
ABSENTRY Entry ; Application entry point
INCLUDE 'derivative.inc'
ORG $2000
; Data is defined HERE
ORG $C000
Entry:
_Startup:
LDS #$4000
LDAA #$FF
STAA DDRT
Back LDAA #$00
STAA PTT ; Define Port T as an output
JSR Delay
LDAA #$FF
STAA PTT ; Turns LED4 and LED2 ON
JSR Delay
BRA Back
Delay PSHX
PSHY
LDY #10
LOOP1 LDX #$FFFF
LOOP2 DEX
NOP
BNE LOOP2
DEY
BNE LOOP1
PULY
PULX
RTS
ORG $FFFE
DC.W Entry ; Reset Vector
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.