EDUSAT SESSION FOR ADVANCED MICROPROCESSOR EC54 - PowerPoint PPT Presentation

1 / 27
About This Presentation
Title:

EDUSAT SESSION FOR ADVANCED MICROPROCESSOR EC54

Description:

Interfacing. SW register- could be absent as in 8255A ... Interfacing Examples. 1: Generate a square wave on PC0 pin of 8255 in the add on card ... – PowerPoint PPT presentation

Number of Views:163
Avg rating:3.0/5.0
Slides: 28
Provided by: VTU1
Category:

less

Transcript and Presenter's Notes

Title: EDUSAT SESSION FOR ADVANCED MICROPROCESSOR EC54


1
EDUSAT SESSION FOR ADVANCED MICROPROCESSOR
(EC54) Date 08.11.2005 Session VII Topic
Programming Examples Faculty Anita Kanavalli
MSRIT
2
Program 9

Write a program to compute factorial of a
positive number using recursive
procedure Program .MODEL SMALL .STACK
64H .DATA Num DW 04H Fact DW ?
3
Program 9

.CODE MOV AX,_at_DATA MOV DS,AX MOV BX,Num CALL
FACT MOV AH,4CH INT 21H .EXIT
4
Program 9

FACT PROC CMP BX,00H JE Next PUSH BX DEC BX CALL
FACT POP BX MUL BX
5
Program 9

RET Next MOV AX,01H RET ENDP END
6
Interfacing
  • PPI or Multi Function Devices (MFD)

F0
D- BF
I/O
FN1
C P U
FN2
F1
I/O
System Bus
SW Register
F2
I/O
CW Register
7
Interfacing
  • D-Buf is the data buffer
  • System Bus- carries ADDR,DATA,CONTROL
  • FN1,FN2,FN3,F0,F1.. Are functional circuits
    (MFC)
  • MFCs could be I/O ports, Timers, Transmitters,
    Receivers etc
  • MFC- Independent function
  • Each MFC has UNIQUE ADDRESS
  • SW Register- Status register

8
Interfacing
  • SW register- could be absent as in 8255A
  • CW register- must be present in all MFDs (
    PPIs)
  • There could be more than one CW register
  • Each SW and CW also has UNIQUE ADDRESS
  • CW- defines (prepares) a functional unit in one
    of the modes
  • SW- tells the status of various functional
    devices

9
Interfacing
  • PROGRAMMING ?
  • SEND CONTROL WORD / WORDS
  • SEND/RECEIVE DATA TO/FROM each functional unit

10
Interfacing
  • I/O s
  • Logic Controllers
  • Modem
  • Stepper Motor
  • Key board
  • Display
  • One for each functional unit sometimes

11
Interfacing Examples

1 Generate a square wave on PC0 pin of 8255 in
the add on card Command Word of 8255
7 6 5 4 3
2 1 0
1 MD MD PA PCU
MD PB PCL
12
Interfacing Examples
  • PPI or Multi Function Devices (MFD) 8255A

PA
D- BF
FN1
C P U
FN2
PB
System Bus
PC
Card
CW Register
13
Interfacing Example
  • Program
  • .MODEL SMALL
  • .DATA
  • PA EQU 200H
  • PB EQU 201H
  • PC EQU 202H
  • CW WQU 203H

14
Interfacing Example

.CODE MOV AX,_at_DATA MOV DS,AX MOV AL,80H
CW MOV DX,CW the addr of CW moved to DX OUT
DX,AL CW sent to MFD Back MOV AL,00H
15
Interfacing Example

MOV DX,PC move addr of port c OUT DX,AL CALL
Delay procedure call MOV AL,01H MOV DX,PC OUT
DX,AL CALL Delay JMP Back
16
Interfacing Example

Delay PROC MOV CX,0FFFFH Here LOOP
Here RET ENDP END
17
Interfacing Example

2 Interface a stepper motor and write program
to rotate in clock-wise direction by N-steps
To all coils of the motor
8255A
Memory
P C 0- 3
CPU
Stepper Motor
18
Interfacing Example
  • Program
  • .MODEL SMALL
  • .DATA
  • PA EQU 200H
  • PB EQU 201H
  • PC EQU 202H
  • CW WQU 203H

19
Interfacing Example

.CODE MOV AX,_at_DATA MOV DS,AX MOV AL,80H
CW MOV DX,CW the addr of CW moved to DX OUT
DX,AL CW sent to MFD MOV CX,64H for the steps
of rotation
20
Interfacing Example

MOV AL,88H data to be sent on PC lines MOV
DX,PC load DX with addr of PC Back OUT
DX,AL CALL Delay ROR AL,01H LOOP Back .EXIT
21
Interfacing Example

Delay PROC RET ENDP END
22
Interfacing Example

3 Interface a 8X3 matrix key pad and write a
program to identify the key closed
.MODEL SMALL .DATA PA EQU 200H PB EQU
201H PC EQU 202H CW WQU 203H
23
Interfacing Example

.CODE MOV AX,_at_DATA MOV DS,AX MOV AL,90H
CW MOV DX,CW move addr of CW to DX OUT
DX,AL CW sent to MFD MOV AX,07H MOV DX,PC

24
Interfacing Example

OUT DX,AL W1 MOV DX,PA IN AL,DX CMP
AL,00H JZ W1 L1 MOV AH,AL MOV DX,PC OUT DX,AL

25
Interfacing Example

MOV DX,PA IN AL,DX CMP AL,00H JNZ C1 ADD
BL,08H MOV AL,0AH RCL AL,01H JMP L1

26
Interfacing Example

C1 RCR AL,01H JC L2 INC BL JMP C1 L2 MOV
BL,AL CMP AL,0AH JB Num ADD AL,07H

27
Interfacing Example

Num ADD AL,30H MOV DL,AL MOV AH,02H INT
21H MOV AH,4CH INT 21H END
Write a Comment
User Comments (0)
About PowerShow.com