Software Engineering Coursework: RS232 Ports & RobotServer.c Program

Verified

Added on  2023/04/03

|9
|2685
|127
Report
AI Summary
This report provides a comprehensive analysis of RS232 ports and the RobotServer.c program used in a climbing robot's control system. The first section details the RS232 serial communication protocol, its historical development, applications, and data transmission methods, including the client-server model and interrupt-driven processes. The second section delves into the RobotServer.c code, explaining the functions of key parts, including header files, define statements for initializing robot parameters, and individual functions for robot control, movement, and status checking. The report concludes by summarizing the functionalities and importance of each component in the robot's operation.
Document Page
Running head: SOFTWARE ENGINEERING
SOFTWARE ENGINEERING
Name of the Student:
Name of the University:
Author Note:
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
1SOFTWARE ENGINEERING
Table of Contents
Aims and Objectives..................................................................................................................3
Review of the methods to read data from/write data to a RS232 port.......................................3
Introduction............................................................................................................................3
Historic development of computer I/O ports.........................................................................3
Main applications of RS 232 ports.........................................................................................4
The methods for using RS232 ports for data transmission....................................................4
What is the Client and Server Model?...................................................................................5
The server is interrupt driven, explain what interrupt is?......................................................5
Summary................................................................................................................................6
Study of RobotServer.c in your VLE module site.....................................................................6
Explain the functions of the first 6 parts in the programming point of view.........................6
Part 1:.....................................................................................................................................6
Part 2:.....................................................................................................................................7
Part 3:.....................................................................................................................................7
Part 4......................................................................................................................................8
Part 5......................................................................................................................................8
Part 6......................................................................................................................................8
Summary................................................................................................................................9
Conclusion..................................................................................................................................9
Document Page
2SOFTWARE ENGINEERING
Aims and Objectives
This report is divided into two main parts. The first part discusses the use and
application of the RS232 ports. The second part discusses the working of a RobotServer.c
program which contains multiple functions that help in the working of a mechanical robot.
The first part will talk about the RS232 ports, their use, their development, primary
applications, data transmission and client server model based on these ports. The second part
will consist of analysis of the Robot Server program code and will be divide into four main
parts describing various functions of the robot program and two other parts describing the
main controller function and the selectcom() function. Both the sections will have a summary
and the report will conclude with a conclusion.
Review of the methods to read data from/write data to a RS232 port
Introduction
The RS232 port is a serial communication protocol port. In telecommunication, the
method of sending data in a sequence through a computer is called as serial communication.
In this method, the data transmission is done bits by bits. The opposite of serial
communication is parallel communication in which the data is send in a byte or 8 bits. The
serial communication process is practically slower than the parallel process but is generally
preferred for long distance communications due to its lower costs and more practical ability.
The RS232 is a standard protocol which is mainly used for serial communication. It mainly
acts as an input output port to connect and allow serial data transfer between the peripheral
devices connected to the main computer. The RS232 can be used for devices at a distance of
up to 50 feet and has a data rate of 1492 Kbps. The R232 is mainly used for data
communication equipment (DCE) and data transmission equipment (DTE). The R232 serial
ports are known as DB-9 connectors and are of two types, one female connector (DCE) and
one male connector (DTE).
Historic development of computer I/O ports
The first development of RS232 I/O serial communication ports started in the early
1980s when the company IBM first introduced the IBM personal computer. Following this
release, all other companies also made RS232 serial communication ports and add-on
hardware boards in their own PCs to allow connection with external devices. The first PC to
run these ports ran on MS DOS. The first standard serial ports were designed such that they
Document Page
3SOFTWARE ENGINEERING
were wired to specific interrupts and had fixed I/O addresses. Then came the ISA cards in
1981 to 1997. In these cards the serial ports were controlled using jumpers and DIP switches.
The plug and play option was not available at that time. There was no way for the PC to
know what resources it needed. After that came the windows 3.1 in the early 1990s which
became very successful. They brought along with them the first application programming
interfaces or the device driver APIs. Finally came the ISA to PCI transition. During the late
1990s most of the hardware ISA cards were replaced by PCI cards which offered much better
I/O address and device management functionalities. The final improvement of the RS232
serial ports led to the upgrade in which data being transferred are no longer sent in bits but in
FIFO sized packets of 16 to 256 bytes.
Main applications of RS 232 ports
The RS232 ports are used in many different applications. The RS232 standard is used in both
custom built devices and specialised devices. The main applications of RS232 are:
1. Dial up modems
2. LCD and LED text displays
3. Serial mouse
4. Printers
5. Networking equipment
6. CNC controllers
7, Uninterruptible power supply
8. Satellite phones
The methods for using RS232 ports for data transmission
The RS232 works on a very simple data communication method in which data is
exchanged with one another in a two way communication system. The two devices that are
connected to each other are Data communication equipment and Data transmission
equipment. These devices have special pins like RXD, TXD, CTS and RTS. The following
process is followed in the data transmission:
1. From the source DTE, the RTS sends a request to send the data.
2. Then the other side of DCE, the CTS makes a clear path for receiving the data.
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
4SOFTWARE ENGINEERING
3. Once a path is cleared it will give a signal to the RTS of the DTE to transmit or send the
signal.
4. After this only the bits are transferred from DTE to DCE.
5. Now the DCE becomes the source and the RTS generates a request to send the data.
6. The CTS of DTE source then clears the path for receiving of the data and then again gives
a signal to send the data once the previous data is received.
This is the entire process for data transmission in RS232 ports.
What is the Client and Server Model?
The client server model is a type of communication framework which is distributed in nature.
This framework contains clients, service requestors and service providers. The client server
connection is generally established through a network or the internet. This model is a core
networking computing concept which builds functionality for web or database access and
email exchange. The main protocols built around the client server model are:
1. Hypertext Transfer Protocol (HTTP)
2. Simple Mail Transfer Protocol (SMTP)
3. Telnet
4. Domain Name System (DNS)
The clients in the client server protocol consists of chat applications, email software and web
browsers. On the other hand, the servers include application chat, email, database and web.
The server is interrupt driven, explain what interrupt is?
An interrupt is a type of signal sent form a peripheral device attached to a computer or
from a server hosted within the computer that requires the OS to stop in between and figure
out the next step. In today’s world, almost all the computers have become interrupt driven.
Once an interrupt signal is sensed by a device or process, the process stops and the computer
then decides whether to run this program or rather run another program. The interrupt driven
aspect denotes a process which is restarted when an interrupt occurs. This part mainly
happens when an auxilarry action is done by some other process and the main process needs
to stop its activities until the second task completes. In the interrupt driven process, some
Document Page
5SOFTWARE ENGINEERING
other process is allowed to run and the machine responsible is able to send a signal with an
interrupt which denotes the task has completed.
Summary
Overall, in this section, the report has discussed the use of RS232 ports and their uses.
The report has also illustrated the use of RS232 ports in major devices and their applications.
The report has also demonstrated the historic development of the RS232 I/O ports over the
years and the improvements made in it. The report also illustrated the method through which
data is transferred in RS232 standard and ports. The report also stated the main concept of the
client server model and the also discusses the interrupt driven approach in servers.
Study of RobotServer.c in your VLE module site
Explain the functions of the first 6 parts in the programming point of view
Part 1:
The first part of the code comprises of a set of header files that is included by default and
some extra headers which are added because of the program requirements. The headers
involved and their uses are:
1. #include <dos.h>: This header file is used to handle interrupts, date and time functions and
producing sounds primarily.
2. #include <dir.h>: This header file contains certain constructs that help in facilitating
directory traversing.
3. #include <conio.h>: This header file contains functions that helps in console based input
and output operations.
4. #include <stdlib.h>: This header file is a general purpose standard library header which
contains general utility functions like process control, conversions and memory allocations
among main functions.
5. #include <stdio.h>: This is the basic library which contains multiple functions needed for
the basic functions of input and output. Without this header the scanf and printf operations
would not be possible.
Document Page
6SOFTWARE ENGINEERING
6. #include <ctype.h>: This header file is mainly composed of many standard library
functions which are useful in handling characters.
7. #include <string.h>: This header file is mainly used to handle string functions like
concatenate or append various strings.
8. #include <fcntl.h>: This header file is part of the C POSIX library which contains
functions relating to file control such as opening a file, locking a file, changing permissions
and retrieving a file.
9. #include <io.h>: The io.h header is part of the GNU libc standard which is mainly used to
perform operations like iopl(), outb(), ioperm(), etc.
Part 2:
The most of the lines of code written here are the Define statements which are used to
initialize certain values or define certain constants in a program. These values are meant to be
fixed and does not need changes unless deemed fit by the programmer. As can be seen from
the code, the set of define values refers to various ports and mechanisms that are needed to
get the robot initialised with all parameters. The #define packet size 50 states the amount of
data bits needed to start the robot. This data acts as a signal to the robot to start operating. It is
possible that a value other than 50 will not trigger the functioning of the robot. The maximum
of the #define UPD2PORT values given in the code are addresses or initializes certain ports
or connections in the robot with proper values in order to correctly identify the hardware
programmed to the robot software code. The input and output are critical parts of controlling
the robot or make it function as without these input or output parameters it would be
impossible to transmit action orders to the robot and operate it. The #define FWD and REV
are most likely values that affect the direction of the robot while going forward and reversing.
The #define TRUE or FALSE statements are used to validate something based on the results
initialised.
Part 3:
The third part is comprised of all the individual functions which are needed for the
proper functioning of the robot. These functions can be anything starting from initialising the
robot to describing the movement directions and giving parameters for the robot to respond.
The use of enable, disable and interrupt functions are there to make the robot client server
model interrupt depended so as to respond to sudden changes more accurately. The send,
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
7SOFTWARE ENGINEERING
prompt and receive functions are mainly used here to check the status of the connecting
modem and the network which is needed for proper control of the robot. These functions look
after the sending of signals and correcting the modem link based on the output. The next set
of check functions are there basically to measure and check the proper movements of the
robot against the set functions. These functions validate each of the commands given to the
robot starting from moving forward to rotating to change direction. The check functions also
helps in checking the condition and status of both the front end motor and the back motor of
the robot. The check functions are also there to check the calibration of the robot and its
movement axes. These functions also helped in checking the status of the display of the
robot.
Part 4
The fourth part consists of codes which deal in the initialising part of the array and
helping the robot get initialised with all the values. This section of the code deals with the
loading of parameters in to the robot program. The code includes variables for loops and
vectors to start and terminate operations. The code segment also contains some codes that
track the movement of the robots in both the forward and the reverse directions and also
count the number of turns the robot took and in which directions. These data is stored in a
separate variable. The robot axis positions and there values are also stored by the program.
Part 5
This part contains the main driver of the robot program code and the functions that are
responsible for signalling the start of the robot and coordinating its movements. The main
check functions and the packet receiving parts of the program are coded in this segment. In
this segment, the code written helps in receiving a signal and based on the packet value of the
signal decides whether to start the robot or not. The program checks all the parts and
components of the robot and validates them before giving the signal to start. If the main
packet receives turns out to be false the process is terminated.
Part 6
In this part, the code is mainly written for the RS232 ports that are being used to
connect to the robot. The code mentions all the port numbers and loads the assigned values to
signal the input and output devices where to connect. The code segment also initialises the
interrupt driven RS232 protocols and starts up all its components like the DCE, DTR, CTS,
RTS, OUT1 and OUT2 in diagnostic mode. The interrupt helps the program control the robot
Document Page
8SOFTWARE ENGINEERING
and help change functions based on task priority. This segment mainly helps in the selection
of the RS232 port.
Summary
To conclude, this sections discusses the main aspects of the robot server code and
divides the description into six parts. The first four parts talks about the various headers files
used in this program, the various constants defined, the different functions created for the
robot and the codes written to initialise the robot and its components. The fifth and the sixth
part describes the main function and the RS232 port selection procedure.
Conclusion
To conclude, the report discusses the RS232 ports and its uses. The main areas of its
applications are highlighted in this report. The report also discusses the history of the RS232
ports and their development along with the methods used by this protocol for data
transmission. The report also gives a brief description of the server client model and
illustrates on the interrupt driven approach in a server by explaining the function of the
interrupt. The report also analyses the provided robot server code in detail and provides
critical evaluation of the codes written for the program. The report discusses each segment of
the code individually and explains the use of each and every part. The code is divided into six
segments which are explained sequentially.
The first part describes the header files of the program. The second part describes the
defined constants and their values. The third part is based on the functions used in this
program, the fourth part illustrated the values and the variables used to initialise and check
the robot, The fifth part is the main functions which consists of the code for starting up the
robot and also check the parts of the robot and the status of its configuration before starting it
up. The sixth part describes the port selecting procedure followed by the program. Overall,
the report summarizes all the aspects of a RS232 port and provides an analysis of the
programming of a server based robot using those RS232 ports written in C language.
chevron_up_icon
1 out of 9
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]