This is a very interesting hand work. After that, I have to write my
own assembly program for the certain result. Once the switch button is pressed,
the buzzer will be activated with a 1-KHz signal for a duration of around 0.5
seconds and all LEDs are turned on. If the button is pressed again, the all
LEDs are turned off.
For verifying that I had generated 1-KHz signal, I used oscilloscope
to see the output signal’s frequency as the below figure.
Here is the part of assembly program which set 1 KHz signal's frequency.
timer_1KHz_msb equ 9timer_1KHz_lsb equ 196;When the switch is pressed, LEDs change state and sound 0.5 second.EXAMPLE1 PROC NEAR;call ram_test; Initialize the 8255 in mode 0mov dx,i8255_base_addressmov al,10010000B ;set PA as input, set PB as output, set PC as outputinc dxinc dxinc dx ;point to command registerout dx,al;end initialize the 8255; Initialize the 8254 in mode 3mov al,00110110Bmov dx,i8254_base_addressinc dxinc dxinc dx ;point to command registerout dx,almov dx,i8254_base_addressmov al,timer_1KHz_lsbout dx,almov al,timer_1KHz_msbout dx,al;end initialize the 8254
To calculation of the value in MSB and LSB for generating 1 KHz
We know that the period of 1 KHz signal is 1ms.
The period of a 2.5MHz clock signal is 0.4us. Therefore, the number of count
for the counter is 0.5ms/0.4us= 9*256+196
Thus, MSB is 9 and LSB is 196.
This is a very interesting and meaningful lab. As this lab course is
related to ELEG323 0(Microprocessors and computer systems). I have to use the
knowledge that I have learnt in ELEG3230 to the lab. I feel proud of me that I
can apply those things into the lab.
沒有留言:
張貼留言