Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Modify code below and write a program that calls your subroutine successively to generate a three-tone siren where each tone lasts half a second. The

Modify code below and write a program that calls your subroutine successively to generate a three-tone siren where each tone lasts half a second. The frequencies of these tones are: 200 Hz, 500 Hz, and 1kHz. Refer to Chapter 4 of the Dragon12-Light user manual for info on the crystal and internal clock rates.

***************************************************************** ;* DEMO PROGRAM ;* FOR DRAGON12 WITH SERIAL MONITOR ;* --ONLY FILL IN SECTIONS ;*****************************************************************

; export symbols XDEF Entry, _Startup ; export 'Entry' symbol ABSENTRY Entry ; for absolute assembly: mark this as application entry point

; Include derivative-specific definitions INCLUDE 'derivative.inc' ;-------------------------------------------------- ; Equates Section ;---------------------------------------------------- ROMStart EQU $2000 ; absolute address to place my code

;---------------------------------------------------- ; Variable/Data Section ;---------------------------------------------------- ORG RAMStart ; loc $1000 (RAMEnd = $3FFF) ; Insert here your data definitions here MSG1A dc.b "Microcontrollers" MSG1B dc.b "are FUN " counter ds 1

INCLUDE 'utilities.inc' INCLUDE 'LCD.inc'

;---------------------------------------------------- ; Code Section ;---------------------------------------------------- ORG ROMStart ; loc $2000 Entry: _Startup: ; remap the RAM & EEPROM here. See EB386.pdf ifdef _HCS12_SERIALMON ; set registers at $0000 CLR $11 ; INITRG= $0 ; set ram to end at $3FFF LDAB #$39 STAB $10 ; INITRM= $39

; set eeprom to end at $0FFF LDAA #$9 STAA $12 ; INITEE= $9 JSR PLL_init ; initialize PLL endif

;---------------------------------------------------- ; Insert your code here ;---------------------------------------------------- ;* The following fuctions are available for the LCD ; lcd_init -initialize LCD ; clear_lcd -clear LCD and set print position to 00 (top line0 ; set_lcd_addr -set LCD address to B ; lcd_putchar -print character in B ; lcd_prtstrg -print string pointed to by D to LCD ; hex2lcd -display hex digit in B to LCD ; write_int_lcd -print value in D as integer (see example) ; ms_delay -delay in ms the value in D (assumes 24MHz bus clock) LDS #ROMStart ; initialize the stack pointer ;*SET UP THE SERVICE ROUTINE (ISR) ; --see vector setup at end of file bset DDRT,%00100000 ; PT5 (spkr) is output jsr TermInit ; needed for simulator jsr led_enable ldaa #%10101010 ; light up LEDs staa PORTB

ldd #MSG1A ; D is pointer to string jsr printf ; print string to terminal (SCI1) jsr lcd_init ; initialize LCD (must be done first) ldab #$0 ; set print position to top line jsr set_lcd_addr ; " ldd #MSG1A ; D is pointer to string jsr lcd_prtstrg; ; print first string ldab #$44 ; set print position in bottom line jsr set_lcd_addr ; " ldd #MSG1B ; D is pointer to string jsr lcd_prtstrg ; print second string ; delay for 1 second ldd #1000 ; 1000ms delay jsr ms_delay ; now print $1F to the LCD after clearing jsr clear_lcd ldab #$01 jsr hex2lcd ldab #$0F jsr hex2lcd ; delay for 1 second ldd #1000 ; 1000ms delay jsr ms_delay ; now print 5000.mV to the LCD after clearing jsr clear_lcd ldd #5000 jsr write_int_lcd ldab #'.' jsr lcd_putchar ldab #'m' jsr lcd_putchar ldab #'V' jsr lcd_putchar cli Buzzer: LDAA PTT ; toggle speaker on PT5 EORA #%00100000 ; ...... STAA PTT ; ...... ldd #2 ; 2ms delay jsr ms_delay bra Buzzer

;************************************************************** ;* Interrupt Vectors * ;************************************************************** ORG Vreset DC.W Entry ; Reset Vector

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Ai And The Lottery Defying Odds With Intelligent Prediction

Authors: Gary Covella Ph D

1st Edition

B0CND1ZB98, 979-8223302568

More Books

Students explore these related Databases questions

Question

8. Describe how cultural spaces are formed.

Answered: 3 weeks ago