
92 CHAPTER 8. SIGNAL GENERATION
Before After
LDAA #’Z’ LOOP
LOOP JSR OUTA JSR INPUT
BRA LOOP TSTA
BEQ LOOP
ANDA #$0F
TAB ; B HAS INDEX
LDX #ONTIMETBL
ABX
ABX
LDY #OFFTIMETBL
ABY
ABY
LDD 0,X
STD ONTIME
LDD 0,Y
STD OFFTIME
BRA LOOP
8.6 Exercises
1. Make the changes shown above and run the program. Connect PA4 to an
oscilloscope. Press any of the keys 0 to 9 and verify that the frequency
changes.
2. Change the program so that when you press any of the keys 0 to 9, the
frequency should be fixed at 100 Hz but the duty cycle changes. Pick 10
different duty cycles. Also, connect the output pin to a digital voltmeter.
How does the voltage change with the duty cycle?
Comentarios a estos manuales