2012年11月7日 星期三

Experiment 5 -- Parallel I/O and Timer/Count Interface


        On this two week, I had done the lab 5. The objective of Lab 5 is to study the interfacing of the 8255 PPI and 8254 PTC with the 8088 MPU. First of all, I need to wrap wire the control signals of the 8255 PPI and 8254 PTC as shown in the figure below.
























         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     9
  timer_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 0
    mov dx,i8255_base_address
      mov al,10010000B ;set PA as input, set PB as output, set PC as output
      inc dx
      inc dx
      inc dx                  ;point to command register
      out dx,al
       ;end initialize the 8255
       ; Initialize the 8254 in mode 3
    mov     al,00110110B
      mov     dx,i8254_base_address
      inc     dx
      inc     dx
      inc     dx       ;point to command register
      out     dx,al
      mov     dx,i8254_base_address
      mov     al,timer_1KHz_lsb
      out     dx,al
      mov     al,timer_1KHz_msb
      out     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. 


沒有留言:

張貼留言