0% found this document useful (0 votes)
51 views6 pages

MBS Lab 10

This 6-page document describes a microprocessor lab assignment on serial communication. The assignment involves: 1. Writing an assembly code program to transmit serial data through a PIC18F452's TX pin and display on hyperterminal. 2. Calculating baud rates for different speeds and measuring error. 3. Simulating the code in Proteus and testing it on a trainer kit for marks. Documentation like the lab manual, code printout, simulation image, and working hardware are required for submission.

Uploaded by

MuhammadHadi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views6 pages

MBS Lab 10

This 6-page document describes a microprocessor lab assignment on serial communication. The assignment involves: 1. Writing an assembly code program to transmit serial data through a PIC18F452's TX pin and display on hyperterminal. 2. Calculating baud rates for different speeds and measuring error. 3. Simulating the code in Proteus and testing it on a trainer kit for marks. Documentation like the lab manual, code printout, simulation image, and working hardware are required for submission.

Uploaded by

MuhammadHadi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Page 1 of 6

Department of Electrical Engineering

LAB WORK - 10
Microprocessor Based System
Spring/Fall/Summer 20__
Student Name SID Marks

Marks Distribution:
CLO_2
Tasks Total Marks
Marks Obtained
Serial communication Assembly Code. 3
Task Proteus simulation. 2
Home Assignment. 2
Hardware Working. 3
Total Marks 10

CLASS ID: __________________

DATE: ______________________

Signature of Faculty/Lab Engineer: ___________________________________________

Remarks: ________________________________________________________________
Microprocessor Based System Instructor:
College of Engineering Ashar Ali Qureshi
PAF-Karachi Institute of Economics & Technology [email protected]
Page 2 of 6
BASIC THEORY CLO_2
Serial data communication uses two methods, asynchronous and synchronous. The synchronous
method transfers a block of data (character) at a time where as the asynchronous method transfers
a single byte at a time. It is possible to write software to use either of these methods, but the
program can be long. For this reason, special IC chips are made for serial communication and
commonly referred to as UART (universal asynchronous receiver transmitter) and USART (universal
synchronous asynchronous receiver transmitter). The PIC18 chips has a built-in USART.
TYPES OF SERIAL COMMUNICATION

Microprocessor Based System Instructor:


College of Engineering Ashar Ali Qureshi
PAF-Karachi Institute of Economics & Technology [email protected]
Page 3 of 6
BAUD RATE CALCULATION

TXSTA: Transmit Status and Control Register

Microprocessor Based System Instructor:


College of Engineering Ashar Ali Qureshi
PAF-Karachi Institute of Economics & Technology [email protected]
Page 4 of 6
RCSTA: Receive Status and Control Register

Microprocessor Based System Instructor:


College of Engineering Ashar Ali Qureshi
PAF-Karachi Institute of Economics & Technology [email protected]
Page 5 of 6
OBJECTIVE #1
Make a program that transmit output serially through TX and shows the message on hyper terminal-
.
Example Code:
LIST P=PIC18F452, F=INHX32, N=0, ST=OFF, R=HEX ; INCLUDE CONTROLLER TYPE
#include P18F452.INC ; INCLUDE CONTROLLER FILE
; FUSE BIT SETTINGS
CONFIG OSC = HS, OSCS = OFF ; HS=HIGH OSCILATOR
CONFIG WDT = OFF ; WATCH DOG TIMER OFF
CONFIG PWRT = ON, BOR = OFF ; POWER UP TIMER ON
; BROWN OUT RESET VOLTAGE OFF
CONFIG DEBUG = OFF, LVP = OFF, STVR = OFF ; DEBUG OFF
; LOW VOLTAGEPROGRAMMING OFF
ORG 0X00 ; STARTING ADDRESS
MOVLW B'00100000' ; ENABLE TRANSMIT AND CHOOSE
; LOW BAUD
MOVWF TXSTA ; WRITE TO REG
MOVLW D'15' ; 9600 BPS (Fosc / (64 * SPEED) - 1)
MOVWF SPBRG ; WRITE TO REG
BCF TRISC, TX ; MAKE TX PIN AS OUTPUT
BSF RCSTA, SPEN ; ENABLE SERIAL PORT
OVER ; LABEL
MOVLW A'Y' ; ASCII LETTER 'Y' TO BE TRANSMIT
CALL TRANS
MOVLW A'E' ; ASCII LETTER 'E' TO BE TRANSMIT
CALL TRANS
MOVLW A'S' ; ASCII LETTER 'S' TO BE TRANSMIT
CALL TRANS
MOVLW A' ' ; ASCII CHARACTER ' ' TO BE TRANSMIT
CALL TRANS
MOVLW 0x0 ; NULL TO PURGE THE BUFFER
CALL TRANS
CALL DELAY_1S ; DELAY
BRA OVER ; KEEP DOING IT
; ----------------------------------SERIAL DATA TRANSFER SUBROUTINE---------------------------------------------------
TRANS
S1
BTFSS PIR1, TXIF ; WAIT UNTIL THE LAST BIT IS GONE
BRA S1 ; STAY IN LOOP
MOVWF TXREG ; LOAD THE VALUE TO BE
; TRANSMITTED
RETURN ; RETURN TO CALLER
#INCLUDE <DELAY_20MHZ.ASM> ; DELAY FILE
END ; END PROGRAM
Microprocessor Based System Instructor:
College of Engineering Ashar Ali Qureshi
PAF-Karachi Institute of Economics & Technology [email protected]
Page 6 of 6
Home Assignment: CLO_2
• Repeat this lab at 3 different baud rate.
• Calculate baud rate and its error.
Submission Details:
• Lab manual
• Print of code in assembly language.
• Proteus simulation circuit bitmap image (print screen and sniping tool’s images are not
acceptable)
• Code simulate on trainer kit.

Microprocessor Based System Instructor:


College of Engineering Ashar Ali Qureshi
PAF-Karachi Institute of Economics & Technology [email protected]

You might also like