2012年11月28日 星期三

Experiment 6 -- Interface of the 8088 MPU with the 8259A PIC and LCD Module


In this week, I have done the experiment 6. This lab is to study the interfacing of the 8259A PIC with the 8088 MPU and the interfacing of the LCD module with the 8088 MPU. I need to Wrap wire the control signals of the 8259A and LCD module as shown in the lab manual, modify the I/O address field of the given test program to match our design of address decoder. Finally I need to write my own program to fulfill the following function, the switch button is pressed, my name and ID will display on the LCD.  When the button is pressed again, my partner’s name and ID will display on the LCD.

















I need to according to the above figure to wrap wire, The typical one is pin7-14 of Character LCD are connected to AD0~AD7.  The pin 6 of character LCD is connected to GAL  pin17 which I have modified the address decoder  for selecting the character LCD.

For writing this assembly program, I need to initialize all the devices first. I write to loop function which can display the name of my partner and I sequentially.
     
loop1:
check2: call check_key1
        jnc check2
        mov      dx,lcd_base
        call TURN_LED1_ON
        call display1
        mov cx,50
        call delay_X
       
check: call check_key1
        jnc check
        mov      dx,lcd_base

        call TURN_LED2_ON    
        call display2 
        mov cx,50
        call delay_X           
jmp loop1

Also I have to write the display string function, which can display name on the LCD display.
        outs1 db 'Cheng Ka Kui',0dh
        outs2 db '1155003893',0dh
        outs3 db 'Tai Pit Tat',0dh
        outs4 db '1155023064',0dh            
                       
display1   PROC      NEAR
        mov      dx,lcd_base
busy7:     in         al,dx
        and       al,10000000b
        jnz        busy7
        mov      al,00000001b    ;clear screen
        out        dx,al
;display string1
        mov      dx,lcd_base
busy10:   in         al,dx
        and       al,10000000b
        jnz        busy10
        mov      al,10000000b    ;set display address to 0
        out        dx,al
        mov      bx, offset outs1
        call        print_string
;display string2               
        mov      dx,lcd_base
busy20:   in         al,dx
        and       al,10000000b
        jnz        busy20
        mov      al,11000000b    ;set display address to 0
        out        dx,al
        mov      bx, offset outs2
        call        print_string
        ret
display1   ENDP

display2   PROC      NEAR
        mov      dx,lcd_base
busy72:   in         al,dx
        and       al,10000000b
        jnz        busy72
        mov      al,00000001b    ;clear screen
        out        dx,al
;display string3
        mov      dx,lcd_base
busy12:   in         al,dx
        and       al,10000000b
        jnz        busy12
        mov      al,10000000b    ;set display address to 0
        out        dx,al
        mov      bx, offset outs3
        call        print_string
;display string4               
        mov      dx,lcd_base
busy22:   in         al,dx
        and       al,10000000b
        jnz        busy22
        mov      al,11000000b    ;set display address to 0
        out        dx,al
        mov      bx, offset outs4
        call        print_string
        ret
display2   ENDP

Here is the result of our lab.






















              

            
              After doing this lab, I have learnt how to write the assembly program. This is a very interesting lab. I can wrap wire to connect the device and write our own program. When the LCD can display the name and ID successfully, we felt a great sense of achievement.

沒有留言:

張貼留言