Upload
bhuvangu
View
223
Download
0
Embed Size (px)
Citation preview
8/6/2019 Minor 2 Report
1/24
Parallel and Serial Communication
Name of Student- Keshav Maheshwari (8102163)
Bhuvan Gupta (8102323)
Name of Supervisor- Mr Saurabh Chaturvedi
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
JAYPEE INSTITUTE OF INFORMATION TECHNOLOGY, NOIDA
8/6/2019 Minor 2 Report
2/24
TABLE OF CONTENTS
Chapter No. Topics Page No.
Certificate from the Supervisor 3
Acknowledgement 4
Abstract 5Chapter No.1 Introduction
Basic knowledge about Parallel and Serial Ports 6
Chapter No. 2 Parallel Port Communication 7
2.1 Basic knowledge of parallel port
2.2 Programming at C Platform
2.3 Problem encountered in C language
2.4 Programming in Matlab
Chapter No. 3 Application of Parallel port (IC Tester) 16
Chapter No. 4 Serial Port communication
4.1 Basic knowledge of Serial Communication
4.2 Line Registers
4.3 Programming in C language
4.4 Bascom codes
Chapter No. 5 Application of Serial port (Touchpad) 23
Chapter No. 7 Final circuit diagram 39
References....40
8/6/2019 Minor 2 Report
3/24
CERTIFICATE
This is to certify that the work titled Parallel and Serial Communication submitted by
Keshav Maheshwari and Bhuvan Gupta in minor project of degree of Bachelor of
Technology of Jaypee Institute of Information Technology, Noida has been carried out
under my supervision. This work has not been submitted partially or wholly to any other
University or Institute for the award of this or any other degree ordiploma.
Signature of Supervisor.
Name of Supervisor: Mr. Saurabh Chaturvedi
Designation: Lecturer
Department of Electronics and Communications Engineering
Jaypee Institute of Information Technology,Noida
8/6/2019 Minor 2 Report
4/24
ACKNOWLEDGEMENT
First and foremost, we would like to thank God for blessing us with the strength, intelligence, and
patience to complete this project. We would like to express my sincere thanks to Mr.
Saurabh Chaturvedi and Mr. Sandeep Joshi who have been helping us by giving their valuable
suggestions and guiding us right way throughout theproject.
We are extremely thankful to the HOD of Electronics and Communication Engineering
Department, Prof. R. C. Jain for providing the infrastructural facilities to work in, without
which this work would have not been possible and Veer Bahadur Singh for providing his
desktop.
Signature of Students
Name of Student: Keshav Maheshwari , Bhuvan Gupta
Date: ..
4
8/6/2019 Minor 2 Report
5/24
Abstract
We believe that learning in Electronics Engineering should reflect the current state of field as
well as introduce the principles that are shaping computing.
As in engineering course and during daily life also, we use parallel and serial ports knowingly
and unknowingly. Parallel ports are generally used in printer interfacing and serial ports have
greatly revolutionized the communication between devices so we are just studying them and
working on their application.
The first chapter gives an introduction to the project stating the structure of Parallel and
Serial ports. Second chapter discusses about the Matlab and C++ software which we have used
to implement our project work. Third and fourth chapter is about Parallel port
communication and their application. Chapter fifth and sixth, h o w we are handling Serial
port and its application that is touch pad.
5
8/6/2019 Minor 2 Report
6/24
CHAPTER
1IntroductionProject IC tester - As the name suggest, our I.C tester will test digital integrated chips of 74
series. The basic idea of making ic tester came from digital electronics lab in 4th
semester. Whileusing those ics, we generally encountered with the problem of having wrong ics, which we got
to know after making whole circuit. So , this project is having real practical application.
We are using parallel ports to make ic tester, which we generally find in desktop not on modern
laptops. So whats the idea ?
Put the IC in, IC holder which will already be connected to our DB-25 i.e. parallel port
according to our program. Program will check each and every combination of the I.C and
produce the Output in details. Like "Gate 1 is good", "Gate is Bad etc .
Project Touchpad -The National Semiconductor Corporation PC 16550D is a programmable
communication interface designed to connect to virtually any type of serial interface. The 16550
is a universal asynchronous receiver/transmitter (UART) that is fully compatible with the Intel
microprocessors. The 16550 is capable of operating at 0 1.5 M baud rate. Baud rate is the
number of bits transferred per second, including start stop data and parity . The 16550 also
includes a programmable Baud rate generator and separates FIFO for input and output data to
ease the load on the microprocessor. E ach FIFO contain 16 bytes of storage . This is the most
common communications interface found in modern microprocessor based equipment including
the personal computer and many modems.
6
8/6/2019 Minor 2 Report
7/24
CHAPTER
2Parallel Port
Parallel ports are the 25 pin cute things that you will find behind your computer panel. Here is a
picture below to show you the pin categories. Basically they are split into three categories. Thecontrol pins, status and data pins (as shown below).
Snapshot 2.1 : Pins of Parallel Port
Now data ports and status ports (pins actually) can be used for input and output data and the
status are used by the computer to find out the status of an external device and thus can serve a
good input port. Actually speaking mostly all these can be used for input and output but you can't
use output to status pins. (If your ports don't work just check your BIOS there will be a option toelect ports as bidirectional so just enable that option).
7
8/6/2019 Minor 2 Report
8/24
Programming in Turbo C
Snapshot 2.1: Snapshot is showing output programme in Turbo C
Snapshot 2.2: Snapshot is showing parallel port
8
8/6/2019 Minor 2 Report
9/24
Problem encountered in C
language:
Outportb is not working properly i.e
Not working Working
Include
Include
Void main()
{
Outportb(0x378,0xff);
}
Include
Include
Void main()
{
Outportb(0x378,0xff);
Outportb(0x378,0xff);
}
Very less documentation on i.c driving parallel port.
Never able to take input from parallel port.
not working Working
Include
Include
Void main()
{
inportb(0x378);
inportb(0x378);
Include
Include
Void main()
{
Outportb(0x378,0xff);
Outportb(0x378,0xff);
9
8/6/2019 Minor 2 Report
10/24
8/6/2019 Minor 2 Report
11/24
CHAPTER
3Matlab codes for IC tester
B = zeros(1,4);
open = daqhwinfo('parallel')
DIO1 = digitalio('parallel','LPT1');DIO2 = digitalio('parallel','LPT1');
outreg = addline(DIO1, 0:7, 0, 'out');
inreg = addline(DIO2, 0:4, 1, 'in');
function and ()
{
putvalue(dio.Line(1:7), [ 1 1 1 1 1 1 1 1])
B = getvalue(DIO2.Line(1:4))
IF B ~= [1 1 1 1]
putvalue(dio.Line(1:7), [ 1 0 1 0 1 0 1 0])
B=getvalue(DIO2.Line(1:4))IF B~= [0 0 0 0 ]
putvalue(dio.Line(1:7), [ 0 1 0 1 0 1 0 1])
B=getvalue(DIO2.Line(1:4))
IF B~= [0 0 0 0]
putvalue(dio.Line(1:7), [ 0 0 0 0 0 0 0 0])
B=getvalue(DIO2.Line(1:4))
IF B~= [0 0 0 0 ]
}
OR () % or implementation{
putvalue(dio.Line(1:7), [ 1 1 1 1 1 1 1 1])
B = getvalue(DIO2.Line(1:4))
IF B ~= [1 1 1 1]
putvalue(dio.Line(1:7), [ 1 0 1 0 1 0 1 0])
B=getvalue(DIO2.Line(1:4))
11
8/6/2019 Minor 2 Report
12/24
IF B~= [1 1 1 1 ]
putvalue(dio.Line(1:7), [ 0 1 0 1 0 1 0 1])
B=getvalue(DIO2.Line(1:4))
IF B~= [1 1 1 1]
putvalue(dio.Line(1:7), [ 0 0 0 0 0 0 0 0])
B=getvalue(DIO2.Line(1:4))
IF B~= [0 0 0 0 ]
}
NAND () % nand implementation
{
putvalue(dio.Line(1:7), [ 1 1 1 1 1 1 1 1])
B = getvalue(DIO2.Line(1:4))
IF B ~= [0 0 0 0]
putvalue(dio.Line(1:7), [ 1 0 1 0 1 0 1 0])
B=getvalue(DIO2.Line(1:4))
IF B~= [1 1 1 1 ]
putvalue(dio.Line(1:7), [ 0 1 0 1 0 1 0 1])
B=getvalue(DIO2.Line(1:4))
IF B~= [1 1 1 1]
putvalue(dio.Line(1:7), [ 0 0 0 0 0 0 0 0])
B=getvalue(DIO2.Line(1:4))
IF B~= [1 1 1 1 ]
}
NOR () % nor implementation
{
putvalue(dio.Line(1:7), [ 1 1 1 1 1 1 1 1])
B = getvalue(DIO2.Line(1:4))
IF B ~= [0 0 0 0]
putvalue(dio.Line(1:7), [ 1 0 1 0 1 0 1 0])
B=getvalue(DIO2.Line(1:4))
IF B~= [0 0 0 0 ]
putvalue(dio.Line(1:7), [ 0 1 0 1 0 1 0 1])
B=getvalue(DIO2.Line(1:4))IF B~= [0 0 0 0]
putvalue(dio.Line(1:7), [ 0 0 0 0 0 0 0 0])
B=getvalue(DIO2.Line(1:4))
IF B~= [1 1 1 1 ]
}
12
8/6/2019 Minor 2 Report
13/24
CHAPTER
4Serial Port:Serial communication is a popular means of transmitting data between a computer and a
peripheral device such as a programmable instrument or even another computer. Serial
communication uses a transmitter to send data, one bit at a time, over a single communication
line to a receiver. You can use this method when data transfer rates are low or you must transferdata over long distances. Serial communication is popular because most computers have one or
more serial ports, so no extra hardware is needed other than a cable to connect the instrument to
the computer or two computers together.
Snapshot 4.1 : Serial Port
ASYNCHRONOUS SERIAL DATA
Asynchronous serial data are transmitted and received without a clock or timong signal. Figure
illustrate two frame of asynchronous serial data. each frame contains a start bit and seven data
bits parity and one stop bit. in this figure a frame which conatin ascii chatacter has 10 bits. ,most
dial up connection system such as prodigy and America online use 10 bits for asynchronous
serial data with even parity. Most internet and bulletinboard service also use 10 bits but they
makes byte transfers of non ascii dat much easier to accomplish normally do not use parity.
13
8/6/2019 Minor 2 Report
14/24
Different line register:
Fig: Line Control Register
outportb(PORT1 + 3 , 0x03); /* 8 Bits, No Parity, 1 Stop Bit */
we are giving value 00000011 at the address base+3 ie of line control register
14
8/6/2019 Minor 2 Report
15/24
Fig: outportb(PORT1 + 2 , 0xC7); /* C7=10100111*/
we are giving value 10100111 at the address -Baseaddress+2 ie for FIFO control register
15
8/6/2019 Minor 2 Report
16/24
Codes in C Language
#include
#include
#include #include
8/6/2019 Minor 2 Report
17/24
errorcode = graphresult();
if (errorcode != grOk) /* an error occurred */
{
printf("Graphics error: %s\n", grapherrormsg(errorcode))
printf("Press any key to halt:");
getch();
exit(1); /* terminate with an error code */
}
outportb(PORT1 + 1 , 0); /* Turn off interrupts - Port1 */
/* PORT 1 - Communication Settings */
outportb(PORT1 + 3 , 0x80); /* SET DLAB ON */
outportb(PORT1 + 0 , 0x0c); /* Set Baud rate - Divisor Latch Low Byte */
/* Default 0x03 = 38,400 BPS */
/* 0x01 = 115,200 BPS */
/* 0x02 = 57,600 BPS */
/* 0x06 = 19,200 BPS */
/* 0x0C = 9,600 BPS */
/* 0x18 = 4,800 BPS */
/* 0x30 = 2,400 BPS */
outportb(PORT1 + 1 , 0x00); /* Set Baud rate - Divisor Latch High Byte */
outportb(PORT1 + 3 , 0x03); /* 8 Bits, No Parity, 1 Stop Bit */
outportb(PORT1 + 2 , 0xC7); /* FIFO Control Register */
outportb(PORT1 + 4 , 0x0B); /* Turn o.n DTR, RTS, and OUT2 */
do {c = inportb(PORT1 + 5);
if (c & 1)
{
ch[i] = inportb(PORT1)-48;
a=inportb(PORT1);
a=inportb(PORT1);
i=i++;
if(i==2)
{
i=0;
drawline(ch);
ch[2]=ch[0];
ch[3]=ch[1];
}
17
8/6/2019 Minor 2 Report
18/24
delay(50);
}
}while(!kbhit());
/*ch[0]=10;
ch[1]=10;
ch[2]=200;
ch[3]=200;
drawline(ch);getch();
*/
}
18
8/6/2019 Minor 2 Report
19/24
Bascom codes:
$regfile = "m16def.dat"
$crystal = 8000000
$baud = 9600
$prog &HFF , &HC4 , &HD9 , &H00
Config Lcd = 16 * 2
Config Porta = Input
Config Portb = Output
Config Portd = Input
Config Portc = Input
Config Lcdpin = Pin , Db4 = Portb.4 , Db5 = Portl = B.5 , Db6 =
Portb.6 , Db7 = Portb.7 , E = Portb.3 , Rs = Portb.2
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Config Timer1 = Pwm , Pwm = 8 , Prescale = 1 , Compare A Pwm = Clear
Down , Compare B Pwm = Clear Down
Dim X As Integer
Dim Y As Integer
Dim Flag As Integer
Start Adc
Start Timer1
Cls
Lcd "hello8"
If Pind = 0 Or Pina = 0 Then
Cls
Else
X = 3
Y = 2
Print X
Print Y'End If
End
19
8/6/2019 Minor 2 Report
20/24
CHAPTER
5Application of Serial Port (Touchpad):
Snapshot 5.1 : Assembly Board containg Microcontroller.
20
8/6/2019 Minor 2 Report
21/24
Snapshot 5.2 : Touchpad Board showing fixed Laser and LDR
Snapshot 5.3: Connection between touchpad board and development board containing
microcontroller
21
8/6/2019 Minor 2 Report
22/24
22
TOUCHPAD
CONTAINING
LASERS AND LDR
DEVELOPMENTBOARD
Microcontroller
Ports
CPU
Containing
SERIAL PORT ANDUART
Computer
Screen
Block
Diagram
8/6/2019 Minor 2 Report
23/24
8/6/2019 Minor 2 Report
24/24
References:
1. http://madan.wordpress.com/parallel-port/
2. Jan Axelson, Programming, Interfacing & Using the Pcs Parallel Port, 4th edition,
USA,2000
3. http://www.robosapiensindia.com/resources/Robosapiens%20ATMEGA
%208%20Development%20Board.pdf
4. Barry.B.Brey, Intel. Microprocessors 8086-8088,4th ed,Prentice Hall Inc ,PP 412-419 ,
1997
24
http://madan.wordpress.com/parallel-port/http://www.robosapiensindia.com/resources/Robosapiens%20ATMEGA%208%20Development%20Board.pdfhttp://www.robosapiensindia.com/resources/Robosapiens%20ATMEGA%208%20Development%20Board.pdfhttp://madan.wordpress.com/parallel-port/http://www.robosapiensindia.com/resources/Robosapiens%20ATMEGA%208%20Development%20Board.pdfhttp://www.robosapiensindia.com/resources/Robosapiens%20ATMEGA%208%20Development%20Board.pdf