Laboratory Manual: College of Engineering, Osmanabad
Laboratory Manual: College of Engineering, Osmanabad
TPCT’s
College of Engineering, Osmanabad
Laboratory Manual
For
Manual Prepared by
Prof.L.M.Deshpande
1
2
TPCT’s
College of Engineering
Solapur Road, Osmanabad
Department of Electronics &Telecommunication
Vision of the Department:
2
3
College of Engineering
Technical Document
Recommended by,
HOD
Approved by,
Principal
Copies:
1. Departmental Library
2. Laboratory
3. HOD
4. Principal
3
4
FOREWORD
It is my great pleasure to present this laboratory manual for Third year engineering Students for the
subject of Advanced Processors & Microcontrollers ,keeping in view the vast coverage required
for visualization of concepts of Different aspects of the Processors.
As a student, many of you may be wondering with some of the questions in your mind
regarding the subject and exactly what has been tried is to answer through this manual.
Faculty members are also advised that covering these aspects in initial stage itself, will greatly
relived them in future as much of the load will be taken care by the enthusiasm energies of the
students once they are conceptually clear.
H.O.D.
4
1
This manual is intended for the Third year students of Electronics & Telecommunication
engineering branch in the subject of Advanced Processors & Microcontrollers . This manual
typically contains practical/Lab Sessions related to Advanced Processors & Microcontrollers
covering various aspects related to the subject to enhance understanding.
Students are advised to thoroughly go through this manual rather than only topics mentioned in the
syllabus as practical aspects are the key to understanding and conceptual visualization of
theoretical aspects covered in the books.
Prof.L.M.Deshpande
1
2
SUBJECT INDEX
2. Pre-lab Requisite.
3. Lab Experiments:
Experiments based on 8086 processor
1. Addition of two sixteen bit numbers
2. To find the factorial of a given number
3. To perform : String data transfer
4. Interfacing stepper motor control to 8086 microprocessor
5. Interfacing Analog to Digital Converter to 8086 microprocessor
Experiment based on 8051 Microcontroller
6. Transfer of block of data from internal RAM to External RAM
7. Division of two 8 bit numbers
8. Program to read the data on port 1 and send it to port 2
9. Generation of square wave using Timer
10. Serial data transfer using 8051 sreial port.
4. Appendix
2
3
1. Submission related to whatever lab work has been completed should be done during the next lab
session.
2. The promptness of submission should be encouraged by way of marking and evaluation patterns
that will benefit the sincere students.
3
4
Pre-lab Requisite.
Execution procedure
In AT-86 system user can execute the program by folloeing the following steps.
1. First of all user should ready with the hex code of the program.
prompt on the LCD, Press any hex key then system will enter in to the address
set mode.
4. Press NEXT key then system will enter into the data set mode.
5. Here feed your data, use NEXT key to enter the data in the next location.
6. After feeding if you want to check the data use PREV/NEXT keys.
7. After checking the code either you press RESET followed by GO or GO key
directly.
8. Then system will ask for the execution starting address, Enter the program
address from where execution should start then press NEXT key.
4
5
EXPERIMENT NO: 01
ADDITION OF TWO SIXTEEN BIT NUMBERS
Aim: Addition of two sixteen bit numbers stored in memory locations. Result of sixteen bit to be
stored in memory location.
Apparatus/software:
1. 8086 micro processor kit
2. Desktop Computer
Objective: To study of different Assembler directives & Data transfer instruction of 8086 Processor.
ASSUME Directive - The ASSUME directive is used to tell the assembler that the name of the logical
segment should be used for a specified segment. The 8086 works directly with only 4 physical
segments: a Code segment, a data segment, a stack segment, and an extra segment.
Example: ASUME CS:CODE ;This tells the assembler that the logical segment named CODE contains
the instruction statements for the program and should be treated as a code segment.
ENDS - This ENDS directive is used with name of the segment to indicate the end of that logic
segment.
EQU - This EQU directive is used to give a name to some value or to a symbol. Each time the
assembler finds the name in the program, it will replace the name with the value or symbol you
given to that name.
END - END directive is placed after the last statement of a program to tell the assembler that this is
the end of the program module. The assembler will ignore any statement after an END directive.
Program:
CODE SEGMENT
ASSUME CS: CODE, DS: CODE, ES: CODE, SS: CODE
RSTINT EQU 03H
ADR1 EQU 8500H ; Operand 1 address
ADR2 EQU 8502H ; Operand 2 address
ADR3 EQU 8504H ; Result address
ORG 0400H
5
6
START :
MOV BX,ADR1 ;Load BX with operand1 address
MOV AX,[BX] ;Load AX with operand1
MOV BX,ADR2 ;Load BX with operand2 address
ADD AX,[BX] ;Add operand2 to AX
MOV BX,ADR3 ;Load BX with Result address
MOV [BX],AX ;Move the result to Result address
INT RSTINT ;Reset the system
END START
CODE ENDS
END
Observation Table:
Conclusion: The addition of two 16 numbers is done .The result is found to be as expected.
Program for practice: Addition of two eight bit numbers stored in memory locations. Result of
sixteen bit to be stored in memory location.
6
7
EXPERIMENT NO: 02
FACTORIAL OF NUMBER
Aim: Find the factorial of a given number. Store the result in memory location.
Apparatus/software:
1. 8086 micro processor kit/TASM (TURBO ASSEMBLER)
2. Desktop Computer
Objective: To study TASM (Turbo Assembler) & of different Arithmatic instruction of 8086
Processor.
The assembler is used to convert the assembly language instructions to machine code. It is used
immediately after writing the Assembly language program. The assembler starts by checking the
syntax or validity of the structure of each instruction in the source file .if any errors are found, the
assemblers displays a report on these errors along with brief explanation of their nature. However
If the program does contain any errors ,the assembler produces an object file that has the same
name as the original file but with the “obj” extension
Linking the program:
The Linker is used convert the object file to an executable file. The executable file is the final set of
machine code instructions that can directly be executed by the microprocessor. It is the different
than the object file in the sense that it is self-contained and re-locatable. An object file may
represent one segment of a long program. This segment can not operate by itself, and must be
integrated with other object files representing the rest of the program ,in order to produce the final
self-contained executable file
Executing the program
The executable contains the machine language code .it can be loaded in the RAM and executed by
the microprocessor simply by typing, from the DOS prompt ,the name of the file followed by the
carriage Return Key (Enter Key). If the program produces an output on the screen or sequence of
control signals to control a piece of hard ware, the effect should be noticed almost
immediately.However, if the program manipulates data in memory, nothing would seem to have
happened as a result of executing the program.
7
8
↓
C: \TASM> EDIT FILENAME.ASM
Example edit abc.asm
↓
Press ENTER
↓
Then the display shows editor
↓
Type the asm program
↓
Then the save the program
↓
Exit from editor Using Alt+F keys
↓
Then Display shows C: \TASM>
↓
Enter the name TASM FILENAME.ASM
Example
↓
C: \TASM> TASM abc.asm
Then Display shows Errors,(0)Warnings(0)
If there is errors correct them
↓
Enter the name Tlink FILENAME.OBJ
Example
↓
C: \TASM> TLINK abc.obj
↓
Then the display shows
Turbo Link Version 3.0
↓
Enter the name TD FILENAME.EXE
Example
↓
C: \TASM> TD abc.exe
↓
Then the display shows
Program has no symbol table
Choose OK
↓
RUN the Program using F9 Key or Select the RUN Option
↓
See the result in in Registers /Memory locations
8
9
Program:
CODE SEGMENT
ASSUME CS: CODE, DS: CODE, ES: CODE, SS: CODE
RSTINT EQU 03H
NUM EQU 0005H ; Given number
ADR EQU 8500H ; Result address
ORG 0400H
START :
MOV BX,ADR ;Load BX with Result address
MOV CX,NUM ;Load CX with number
MOV AX,CX ;Copy the number in to AX
DEC CX ;Decrement CX
UP; MUL CX ;Multiply AX with CX
LOOP UP ;Decrement CX,repeat the loop till CX is not zero
MOV BX,ADR3 ;Load BX with Result address
MOV [BX],AX ;Move the result to Result address
INT RSTINT ;Reset the system
END START
CODE ENDS
END
Observation Table:
ADDRESS 8500H
CONTENTS
Conclusion: The Factorial of a given number is found .The result is found to be as expected.
Program for practice: Find the factorial of a number stored in memory location.
9
1
Experiment No. 03
STRING DATA TRANSFER
Aim: Transfer the given Byte string from source location in Data segment to destination location in
Extar segment
Apparatus/software:
Theory:
String Manipulation Instructions A series of data byte or word available in memory at consecutive
locations, to be referred as Byte String or Word String. A String of characters may be located in
consecutive memory locations, where each character may be represented by its ASCII equivalent.
The 8086 supports a set of more powerful instructions for string manipulations for referring to a
string, two parameters are required. I. Starting and End Address of the String. II. Length of the
String. The length of the string is usually stored as count in the CX register.The incrementing or
decrementing of the pointer, in string instructions, depends upon the Direction Flag (DF) Status. If it
is a Byte string operation, the index registers are updated by one. On the other hand, if it is a word
string operation, the index registers are updated by two.
MOVSB / MOVSW :Move String Byte or String Word Suppose a string of bytes stored in a set of
consecutive memory locations is to be moved to another set of destination locations.The starting
byte of source string is located in the memory location whose address may be computed using SI
(Source Index) and DS (Data Segment) contents. The starting address of the destination locations
where this string has to be relocated is given by DI (Destination Index) and ES (Extra Segment)
contents.
CMPS : Compare String Byte or String Word The CMPS instruction can be used to compare two
strings of byte or words. The length of the string must be stored in the register CX. If both the byte
or word strings are equal, zero Flag is set. The REP instruction Prefix is used to repeat the operation
till CX (counter) becomes zero or the condition specified by the REP Prefix is False.
LODS : Load String Byte or String Word The LODS instruction loads the AL / AX register by the
content of a string pointed to by DS : SI register pair. The SI is modified automatically depending
upon DF, If it is a byte transfer (LODSB), the SI is modified by one and if it is a word transfer
(LODSW), the SI is modified by two. No other Flags are affected by this instruction.
STOS : Store String Byte or String Word The STOS instruction Stores the AL / AX register contents to
a location in the string pointer by ES : DI register pair. The DI is modified accordingly, No Flags are
affected by this instruction.
1
2
Algorithm:
Program:
2
3
Observed result:
Destination String
Address Data
ES:4000H 12H
ES:4001H 56H
ES:4002H 9AH
ES:4003H 0DEH
ES:4004H 0ABH
Conclusion: As expected the given string has been copied to the destination location.
Program for practice: Write & execute a program Word string transfer.
3
4
Experiment no. 04
Stepper motor control
Aim: ALP in 8086 to rotate the stepper motor in clockwise directions and anti-clockwise direction
continuously, by interfacing stepper motor control module to 8086 microprocessor through
Intel8255 .
Apparatus:
1. 8086 Microprocessor kit
2. Stepper motor module
3. Desktop Computer
Objective: To see the speed & direction control of stepper motor my means of 8086 processor
program.
Theory:
A stepper motor is an electric motor that rotates in discrete step increments. The movement of
each step is precise and repeatable; therefore the motor's position can be controlled precisely
without any feedback mechanism, as long as the motor is carefully sized to the application. This type
of control eliminates the need for expensive sensing and feedback devices such as optical encoders.
The position is known simply by keeping track of the input step pulses. It is one of the most versatile
forms of positioning systems. They are typically digitally controlled as part of an open loop system,
and are simpler and more rugged than closed loop servo systems. Industrial applications include
high speed pick and place equipment and multi-axis CNC machines, often directly driving lead
screws or ballscrews. In the field of optics they are frequently used in precision positioning
equipment such as linear actuators, linear stages, rotation stages, goniometers, and mirror mounts.
Other uses are in packaging machinery, and positioning of valve pilot stages for fluid control
systems. Commercially, stepper motors are used in floppy disk drives, flatbed scanners, computer
printers, plotters, slot machines, image scanners, compact disc drives and many more devices.
Coil Windings and Stepping Mechanism:
There are two common winding arrangements for the electromagnetic coils: bipolar and unipolar
(Fig 4). The described stepping sequence utilizes the bipolar winding. Each phase consists of a single
winding. By reversing the current in the windings, electromagnetic polarity is reversed. A unipolar
stepper motor has one winding with center tap per phase. Each section of windings is switched on
for each direction of magnetic field. Since in this arrangement a magnetic pole can be reversed
without switching the direction of current, the commutation circuit can be made very simple for
each winding.
4
5
Program:
ASSUME CS:CODE,DS:CODE,SS:CODE,ES:CODE
CMDB8255 EQU 27H ;Control register address
PAB8255 EQU 21H ;Port A address
PBB8255 EQU 23H ;Port B address
PCB8255 EQU 25H ;Port C address
;CLOCK WISE 05H,06H,0AH,09H
;ANTI CLOCK WISE 09H,0AH,06H,05H
ORG 400H
CODE SEGMENT
START
MOV AL,80H ;Move control word 80H into AL
OUT CMDB8255,AL ;Send AL contents into Cntrol register.
MOV AL,0FFH ;Move FFH into AL
OUT PAB8255,AL ;Send the AL contents to Port A
START: MOV AL,05H ;Move FFH into AL
OUT PAB8255,AL ;Send the AL contents to Port A
CALL DELAY ;Call delay subroutine.
MOV AL,06H ;Move FFH into AL
OUT PAB8255,AL ;Send the AL contents to Port A
CALL DELAY ;Call delay subroutine.
MOV AL,0AH ;Move FFH into AL
OUT PAB8255,AL ;Send the AL contents to Port A
CALL DELAY ;Call delay subroutine.
MOV AL,09H ;Move FFH into AL
OUT PAB8255,AL ;Send the AL contents to Port A
CALL DELAY ;Call delay subroutine.
JMP START ; Jump to START.
DELAY:
MOV CX,05FFH ; Load CX with 05FFH.
LP: DEC CX ; Decrement CX by one.
JZ EXT ; Jump to EXT if ZF=1.
JMP LP ; Jump to LP.
EXT: RET ; Return to main program
END START
CODE ENDS
END
5
6
Circuit Diagram:
Observed Result: When windings are excited in proper manner, stepper motor rotated in clockwise
directions and anti-clockwise direction continuously,
Conclusion: The stepper motor is driven by the digital inputs and it controls the speed & the
direction of the motor.
Program for practice: Write a program to rotate the stepper motor by the displacement equal to ten
steps.
6
7
Experiment No.05
ANALOG TO Digital Converter
Apparatus:
1. 8086 Trainer.
2. A/D interface module
3. Desktop Computer
Objective: Interfacing an ADC & and acquiring the analog signal & observing the digital equivalent
Theory:
The working of the circuit starts with making ALE and OE pins high which are meant to choose the
channel and also enable output. 5 V was the default reference voltage and it can be altered by
feeding the voltage of our desire to the pins Vref+ and Vref-. The Channel selection should be done
by using the pin ADDA to ADDC pins and here in this circuit diagram input channel 1 was selected.
The below table will give the logic states of all pins and their respective channel selection.
Now the Analog signal is fed into the channel you selected and then the state of the pin START
should be made low from high to start for activation. And after the conversion the EOC pin goes high
and it indicates the conversion is over. The EOC pin retains it low state as soon the next pulse is
encountered. As you can see in the above circuit the EOC pin was connected to start pin which
triggers a chain reaction resulting in continuous conversion to take place.
Finally we will get a 8 bit data from the pins OUT1 to OUT8 which can be used for further
processing and display. You can even connect the LED’s to these pins and visually view the output
binary data, Led On indicates binary 1 and off indicates binary 0 data.
7
8
Program:
ASSUME CS:CODE,DS:CODE,SS:CODE,ES:CODE
MOV AL,DL
MOV CL,04H ; Get the upper nibble
SHR AL,CL
CALL ASCII
MOV DI,DSPBUF+0EH
MOV [DI],AL
MOV AL,DL
AND AL,0FH
CALL ASCII
MOV DI,DSPBUF+0FH
8
9
MOV [DI],AL
INT DISINT
JMP LP2 ; Be in an infinite loop
RESMES:
DB 'Digital O/P : 00'
ASCII:
ADD AL,30H ; If no. < 0AH,add 30H
CMP AL,3AH
JC RET1
ADD AL,07H ; If no. >= 0AH,add 37H
RET1:
RET
CODE ENDS
END
Circuit Diagram:
Observation Table:
Conclusion: The ADC converted the applied Analog I/P into Digital O/P & value of the O/P is equal
to the given I/P
Program for practice: Write program to save the displayed digital value in a memory location.
9
10
Experiment No.06
Block Transfer
Aim: Write a program to copy a block of 5 bytes of data from int RAM locations from address 35H to
ext RAM locations from address40 60H
Apparatus/software:
1. 8051 microcontroller kit/KEIL IDE software
2. Desktop Computer
Theory:
The 8051 microcontroller's memory is divided into Program Memory and Data Memory. Program
Memory (ROM) is used for permanent saving program being executed, while Data Memory (RAM) is
used for temporarily storing and keeping intermediate results and variables.
Up to 256 bytes of internal data memory are available depending on the 8051 derivative. Locations
available to the user occupy addressing space from 0 to 7Fh, i.e. first 128 registers and this part of
RAM is divided in several blocks. The first 128 bytes of internal data memory are both directly and
indirectly addressable. The upper 128 bytes of data memory (from 0x80 to 0xFF) can be addressed
only indirectly.
10
11
Program:
ORG 0000H
MOV R0,#35H ;R0 source pointer
Program for practice: Write & execute the program for block transfer from External program meory
to Register bank 1
11
12
Experiment No.07
Division of 8 bit numbers
Aim: Write a program for division of given 8 bit numbers .Store the quotient in R0 and reminder in
R1
Apparatus/software:
1. 8051 microcontroller kit/KEIL IDE software
2. Desktop Computer
Objective: To study & implementing the multiplication & division operations by 8051
microcontroller.
Theory:
Multiplication of unsigned numbers:
The 8051 supports byte-by-byte multiplication only. The bytes are assumed to be unsigned data.
The syntax is as follows:
In byte-by-byte multiplication, one of the operands must be in register A, and the second operand
must be in register B. After multiplication, the result is in the A and B registers; the lower byte is in
A, and the upper byte is in B. The following example multiplies 25H by 65H. The result is a 16-bit
data that is held by the A and B registers.
When dividing a byte by a byte, the numerator must be in register A and the denominator must be in
B. After the DIV instruction is performed, the quotient is in A and the remainder is in B. See the
following
12
13
example.
Program:
ORG 0000H
MOV A, #2B H ; load the Dividend into A
MOV B, #0A H ; load the Divisor into B
DIV AB ; perform the division A / B
MOV R0, A ; save the Quotient in R0
MOV R1, B ; save the Reminder in R1
LP: SJMP LP ; Be in the loop
END
Observed Result:
Quotient R0=04 H Reminders R1=03 H
Program for practice: Write & execute the program for multiplication of two 8 bit numbers.
13
14
Experiment No.08
Data Monitoring
Aim: Write a program to read the data on port 1 and send it to port 2
Apparatus/software:
1. 8051 microcontroller kit/KEIL IDE software
2. Desktop Computer
Theory:
There are four ports P0, P1, P2 and P3 each use 8 pins, making them 8-bit ports. All the ports
upon RESET are configured as output, ready to be used as output ports. To use any of these ports as
an input port, it must be programmed.
Port 0: Port 0 occupies a total of 8 pins (pins 32-39) .It can be used for input or output. To use the
pins of port 0 as both input and output ports, each pin must be connected externally to a 10K ohm
pull-up resistor. This is due to the fact that P0 is an open drain, unlike P1, P2, and P3.Open drain is a
term used for MOS chips in the same way that open collector is used for TTL chips. With external
pull-up resistors connected upon reset, port 0 is configured as an output port.
Port 0 as Input : With resistors connected to port 0, in order to make it an input, the port must be
programmed by writing 1 to all the bits. In the following code, port 0 is configured first as an input
port by writing 1’s to it, and then data is received from the port and sent to P1.
Dual role of port 0: Port 0 is also designated as AD0-AD7, allowing it to be used for both address
and data. When connecting an 8051/31 to an external memory, port 0 provides both address and
data. The 8051 multiplexes address and data through port 0 to save pins.
Port 1: Port 1 occupies a total of 8 pins (pins 1 through 8). It can be used as input or output. In
contrast to port 0, this port does not need any pull-up resistors since it already has pull-up resistors
internally. Upon reset, Port 1 is configured as an output port.
Port 1 as input: To make port1 an input port, it must programmed as such by writing 1 to all its bits
Port 2 : Port 2 occupies a total of 8 pins (pins 21- 28). It can be used as input or output. Just like P1,
P2 does not need any pull-up resistors since it already has pull-up resistors internally. Upon
reset,Port 2 is configured as an output port.
Port 2 as input : To make port 2 an input, it must programmed as such by writing 1 to all its bits
14
15
Dual role of port 2 : Port 2 is also designed as A8-A15, indicating the dual function. Since an 8051 is
capable of accessing 64K bytes of external memory, it needs a path for the 16 bits of the address.
While P0 provides the lower 8 bits via A0-A7, it is the job of P2 to provide bits A8-A15 of the
address. In other words, when 8031 is connected to external memory, P2 is used for the upper 8 bits
of the 16 bit address, and it cannot be used for I/O.
Port 3 : Port 3 occupies a total of 8 pins, pins 10 through 17. It can be used as input or output. P3
does not need any pull-up resistors, the same as P1 and P2 did not. Although port 3 is configured as
an output port upon reset. Port 3 has the additional function of providing some extremely important
signals such as interrupts
Program:
ORG 0000H
END
Program for practice: Write a program for monitoring the switch status connected to port 0.1 pin on
port 0.1 pin continuously.
15
16
Experiment No.09
Generation of square wave
Aim: Write a program to generate a square wave on p1.5 pin.Use TIMER 0 to generate delay
Apparatus/software:
1. 8051 microcontroller kit/KEIL IDE software
2. Desktop Computer
3.
Objective: Application of on chip Timer for generating square wave.
Theory:
Timers in 8051 Microcontroller: There are two 16-bit timers and counters in 8051 microcontroller:
timer 0 and timer 1. Both timers consist of 16-bit register in which the lower byte is stored in TL and
the higher byte is stored in TH. Timer can be used as a counter as well as for timing operation that
depends on the source of clock pulses to counters.
16
17
Mode select bits: The M1 and M0 are mode select bits, which are used to select the timer
operations. There are four modes to operate the timers.
Mode 0: This is a 13-bit mode that means the timer operation completes with “8192” pulses.
Mode 1: This is a16-bit mode, which means the timer operation completes with maximum clock
pulses that “65535”.
Mode 2: This mode is an 8-bit auto reload mode, which means the timer operation completes with
only “256” clock pulses.
Mode 3: This mode is a split-timer mode, which means the loading values in T0 and automatically
starts the T1.
Program:
ORG 0000H
MOV TMOD,#01 ;Timer 0, mode 1(16-bit mode)
HERE: CPL P1.5 ;Toggle P1.5
ACALL DELAY ;Call delay subroutine
SJMP HERE ;Repeat the loop
DELAY: MOV TL0,#00H ;TL0=00H, the low byte
17
18
Conclusion: The required delay is generated using Timer & square wave is generated.
Program for practice: Write & execute the program for square wave generation without using
Timer.
18
19
Experiment No.10
Data transmission using serial port
Aim:Write a program for the 8051 to transfer COE serially at 9600 baud rate.
Apparatus/software:
1. 8051 microcontroller kit/KEIL IDE software
The 8051 includes an on-chip serial port that can be programmed to operate in one of four
ifferent modes and at a range of frequencies. In serial communication the data is rate is known
as the baud rate, which simply means the number of bits transmitted per second. In the serial
port modes that allow variable baud rates, this baud rate is set by timer 1.
The 8051 serial port is full duplex. In other words, it can transmit and receive data at the same time. The block
diagram above shows how this is achieved. If you look at the memory map you will notice at location 99H the serial
buffer special function register (SBUF). Unlike any other register in the 8051, SBUF is in fact two distinct registers -
the write-only register and the read-only register. Transmitted data is sent out from the write-only register while
received data is stored in the read-only register. There are two separate data lines, one for transmission (TXD) and
one for reception (RXD). Therefore, the serial port can be transmitting data down the TXD line while it is at the
same time receiving data on the RXD line.
19
20
The TXD line is pin 11 of the microcontroller (P3.1) while the RXD line is on pin 10 (P3.0). Therefore, external access
to the serial port is achieved by connecting to these pins. For example, if you wanted to connect a keyboard to the
serial port you would connect the transmit line of the keyboard to pin 10 of the 8051. If you wanted to connect a
display to the serial port you would connect the receive line of the display to pin 11 of the 8051. This is detailed in
the diagram below.
Mode 0
As detailed in the table above, mode 0 is simply a shift register. To put the serial port into mode
0 you clear both SM0 and SM1. The diagram below illustrates the serial port in mode 0.
20
21
As can be seen in the diagram above, the terms TXD and RXD are misleading in mode 0. TXD serves as the clock
while RXD is used for both receiving and transmitting data. In mode 0, the serial port is only half duplex; it cannot
transmit and receive data at the same time because the same line (RXD) is being used for both transmit and
receive.
The serial port in mode 0 is an example of synchronous communication; the clock signal is sent with the data on the
TXD line. TXD pulses at the same frequency as the machine cycle. In other words, TXD runs at 1/12th the frequency
of the system clock. If we are using a 12MHz system clock, then the frequency of TXD is 1MHz, which implies its
cycle length is 1us. Therefore, each bit is active on the RXD line for 1us. To shift the entire 8-bit word along RXD
takes 8us.
Program:
ORG 0000H
MOV TMOD,#20H ;timer 1,mode 2
MOV TH1,#0FDH ;9600 baud rate
MOV SCON,#40H ;8-bit, 1 stop, REN enabled
SETB TR1 ;start timer 1
MOV A,#"M"
CALL TRANS
MOV A,#"."
CALL TRANS
MOV A,#"S"
CALL TRANS
21
22
MOV A,#"c"
CALL TRANS
LOOP: SJMP LOOP
Conclusion: The data transmission is carried out successfully through serial port of 80510 controllers.
Program for practice:
Program for practice: Write a program to send the message “COE OSMANABAD” continuously with baud
rate of 4800.
22
23
23
24
The marking pattern should be justifiable to the students without any ambiguity and teacher should see
that students are faced with just circumstance.
24