E4019 - Geodetic A

Download Report

Transcript E4019 - Geodetic A

Computers in Surveying
SVY2301 / E4006
Automated Surveying
Communication Ports
• There are two basic types of
communication ports available in most
computers. These are:
• • serial port; and
• • parallel port.
Communication Ports
• serial ports (COM1 or COM2) are generally
used for connection of peripherals such as:
– Digitisers
– Mice
modems;
plotters.
• parallel ports (LPT1 and LPT2) are generally
used for connection to printers or external
disk drives.
Interfacing & Communication
• Surveyors can be faced with interfacing problems
when trying to establish a connection between a
data recorder and a computer.
• Survey equipment manufacturers usually supply
standard interfacing cables for the most popular
brands of computer but these may not be
satisfactory in all cases.
• In addition to these problems interfacing
problems can also occur when a surveyor tries to
do something different such as connect his total
station directly to a computer.
Interfacing & Communication
• Surveyors require a good understanding of
at least the basic principles of interfacing
and communications
Interfacing & Communication
Number System & Codes
• A byte consisting of 8 bits can represent a total of
256 numbers in the range 0–255.
– 00000000
–
11111111
=
=
decimal 0, and
decimal 255.
• a character code system based on an 8-bit byte
would allow 256 characters to be coded.
• The ASCII-8 character code system is normally
only used internally in the computer.
Interfacing & Communication
Number System & Codes
• ASCII 7-bit code is the recommended data
representation code for communications
between devices.
– allows 128 characters to be represented by the
numbers 0–127.
• 1111111 is the binary representation of 127.
• 8th bit of the byte is often used for error
detection purposes.
– providing a check that the other 7 bits were not
corrupted during transmission.
Interfacing & Communication
Signal Devices
• a number of standard interfaces are
adopted by the computing and electronics
industries.
• These standards fall into two categories,
– serial interfaces, and
– parallel interfaces.
• Serial communication interfaces can
support longer distances between devices.
– telephone is a serial communication device.
Interfacing & Communication
Signal Devices – Serial Interfaces
• data signals are transmitted over a two wire
line by sending each bit one after the other
as either a high or low voltage
• A standard signal code such as the ASCII 7bit character code is used to control the
data transfer.
Interfacing & Communication
Signal Devices – Serial Interfaces
• The most common standard serial interface
in the computer industry is the RS232C
standard.
• It was intended to describe the interface
between data terminal equipment (DTE) and
data communications equipment (DCE).
– A ‘dumb’ computer terminal is a DTE
– a modem is an example of a DCE.
Interfacing & Communication
Signal Devices – Signal Format (RS232C)
• The RS232C is actually a voltage standard.
• Logic state 0 is defined by a voltage
between +5V and +15V whilst logic state 1 is
defined by a voltage between –5V and –15V.
A line is in logic state 1 or ‘high’ during idle
time. The transmission of a data signal can
be represented by a block diagram with the
1’s represented as highs and the zeros as
lows.
Interfacing & Communication
Signal Devices – Signal Format (RS232C)
• The RS232C is actually a voltage standard.
• Logic state 0 is defined by a voltage
between +5V and +15V
Interfacing & Communication
Signal Devices – Signal Format (RS232C)
• logic state 1 is defined by a voltage between
–5V and –15V.
• A line is in logic state 1 or ‘high’ during idle
time.
Interfacing & Communication
Signal Devices – Signal Format (RS232C)
• The 7-bit binary code for the character ‘A’ is
1000001.
Interfacing & Communication
Signal Devices – Signal Format (RS232C)
• To advise the receiver that a character is
being sent the transmitter prefaces each
character with a start bit, a zero.
– the line switches from a negative voltage to a
positive voltage.
Interfacing & Communication
Signal Devices – Signal Format (RS232C)
• The character bits are followed by;
– a parity bit, and
– one or two stop bits that leave the signal high
until the next character is sent
Interfacing & Communication
Signal Devices – Signal Format (RS232C)
• The transmitting device must have at least
as many stop bits as the receiver requires.
• When two way communication occurs both
must have the same number of stop bits.
Interfacing & Communication
Signal Devices – Signal Format (RS232C)
• The parity bit is often used for a simple
error checking technique.
Interfacing & Communication
Signal Devices – Signal Format (RS232C)
• even parity
– The transmitting device counts the number of 1s in
each character and if there are an even number then
the parity bit is set to 0.
– If the number of 1s added to an odd number then the
parity bit would be set to 1 so the total was even.
• When the data bits are received the receiving
device counts the number of 1s and if they add up
to an even number the character is accepted. If
they total to an odd number the transmitter may
be asked to re-transmit the character. It should be
noted that this simple check only checks an error
in one bit as errors in two or more bits may cancel
Interfacing & Communication
Signal Devices – Signal Format (RS232C)
• even parity
– The transmitting device counts the number of 1s in
each character and
• if there are an even number then the parity bit is set to 0.
• If the number of 1s added to an odd number then the parity bit
would be set to 1 so the total was even.
– the receiving device also counts the number of 1s and
• if they add up to an even number the character is accepted.
• If they total to an odd number the transmitter may be asked to
re-transmit the character.
– only checks an error in one bit as errors in two or more
bits may cancel each other and the wrong character is
then accepted.
Interfacing & Communication
Signal Devices – Signal Format (RS232C)
• Odd parity
– the parity bit is set such that the number of 1s in the
data bits (including the parity bit) add up to an odd
number.
• No Parity
– If ‘none’ is selected then no parity check is carried out
by the receiver.
– This option is only available when 8-bit words are used
as a parity bit is not sent.
Interfacing & Communication
Signal Devices – Signal Format (RS232C)
• Communication Parameters
• Basic Characteristics.
– Most equipment that surveyors use would
communicate using asynchronous, half-duplex
signals at RS232C voltage levels.
• Baudrate.
– Both devices must be set to the same baud rate
– i.e. bits per second.
Interfacing & Communication
Signal Devices – Signal Format (RS232C)
• Communication Parameters
• Parity.
– Both devices must be set to the same parity.
• Start and stop bits.
– All devices attach one start bit to the data bits
and either one or two stop bits.
– Some devices allow the user to select either
one or two stop bits.
– Both devices must be set to the same number
of stop bits.
Interfacing & Communication
Signal Devices – Signal Format (RS232C)
• Communication Parameters
• Word length.
– The standard word length is 8 bits (7 data bits +
1 parity bit).
– Many devices however allow the user to select
a 9 bit word (8 data bits for the character + 1
parity bit). In this case if a parity bit is selected
then only one stop bit may be used.
Interfacing & Communication
Signal Devices – Signal Format (RS232C)
• Communication Parameters
• ACK/NAK.
– Normally the transmitting device sends all of the data
continuously, one block after another.
– When protocol is selected as a parameter however, the
transmitter waits at the end of each block of data until
it receives acknowledgement from the receiver that
the data has been received. The character ACK is sent
from the receiver to the transmitter in this case.
– If the data block was not received or was corrupted
then the character NAK is sent to the transmitter. In this
case the transmitter re-transmits the data block.
Interfacing & Communication
Signal Devices – Signal Format (RS232C)
• Communication Parameters
• XON/XOFF.
– Some devices use these control characters to
control the flow of characters.
– When a device receives an XOFF character
(DECIMAL 19) during output, it suspends
transmission until an XON character (Decimal
17) is received from the other device, after
which it continues with the transmission.
Interfacing & Communication
Signal Devices – Signal Format (RS232C)
• Communication Parameters
• Last characters.
– The user is often able to select the last
characters that will be transmitted after a
block of data.
– Normally the characters CR and LF (carriage
return and line feed) are sent to end the data
block.
– With some devices the user may select CR only
as the last character.
Interfacing & Communication
Signal Devices – Signal Format (RS232C)
• Communication Parameters
• Most devices have a set-up or configuration
program that enables the user to select the
required parameters from a menu that can
be scrolled through all of the alternative
settings.
• Alternatively the user must carefully set a
series of microswitches on the device.
These switches are often called dip
switches.
Interfacing & Communication
Signal Devices – Pin & Line Assignment
(RS232C)
• The Canon D range of 25 way connectors
– only between 3 and 10 wires are used for
computer communications.
Interfacing & Communication
Signal Devices – Pin & Line Assignment
(RS232C)
Pin
Signal
Function
1
2
PG
TXD
RXD
RXD
TXD
RTS
CTS
DSR
SG
DCD
DTR
Protective Ground
DTE TRANSMITS DATA
DCE RECEIVES DATA
DTE RECEIVES DATA
DCE TRANSMITS DATA
REQUEST TO SEND
CLEAR TO SEND
DATA SET READY
SIGNAL GROUND
DATA CARRIER DETECT
DATA TERMINAL READY
3
4
5
6
7
8
20
Interfacing & Communication
Signal Devices – Pin & Line Assignment
(RS232C)
• The connector may be male or female i.e.
having pins or holes respectively. Generally
– a DTE device will have a male connector, and
– a DCE will have a female connector
Interfacing & Communication
Signal Devices – Pin & Line Assignment
(RS232C)
• An RS232 interface may be successfully
achieved with just three wires if no
hardware ‘handshaking’ is required.
• The lines used in this case are lines 2, 3 and
7.
DTE DEVICE
DCE DEVICE
Comment
Signal
P in
Transm its Data
T XD
Receives Data
Signal Ground
Data F low
P in
Signal
Comment
2
2
RX
Receives Data
RXD
3
3
TX
Transm its Data
SG
7
7
SG
Signal Ground
Interfacing & Communication
Signal Devices – Pin & Line Assignment
(RS232C)
• the transmit pin on one device is connected to the
receive pin of the other device.
– Obviously this must also be the case if communication
is to occur.
• both devices may be configured as DTEs.
• In this case both transmit on pin 2 and receive on
pin 3. The normal solution is to cross the lines to
DTE DEVICE
achieve a successful interface, DCE DEVICE
Comment
Signal
P in
Transm its Data
T XD
Receives Data
Signal Ground
Data F low
P in
Signal
Comment
2
2
RX
Receives Data
RXD
3
3
TX
Transm its Data
SG
7
7
SG
Signal Ground
Interfacing & Communication
Signal Devices – Pin & Line Assignment
(RS232C)
• both devices may be configured as DTEs.
– both transmit on pin 2 and receive on pin 3.
• The normal solution is to cross the lines to
achieve a successful interface,
DTE DEVICE
DCE DEVICE
Comment
Signal
P in
Transm its Data
T XD
Receives Data
Signal Ground
Data F low
P in
Signal
Comment
2
2
RX
Receives Data
RXD
3
3
TX
Transm its Data
SG
7
7
SG
Signal Ground
Interfacing & Communication
Signal Devices – Pin & Line Assignment
(RS232C)
• both devices may be configured as DTEs.
– both transmit on pin 2 and receive on pin 3.
• The normal solution is to cross the lines to
achieve a successful interface,
DTE DEVICE
Signal
P in
T XD
DTE DEVICE
Data F low
P in
Signal
2
2
T XD
RXD
3
3
RXD
SG
7
7
SG
Interfacing & Communication
Signal Devices – Pin & Line Assignment
(RS232C)
• the flow of characters can only be in one direction
at a time
– Communications would normally have to be software
controlled
• Normally other lines on the interface are used to
control
lines are
DTE
DEVICE the flow. When these control
DTE DEVICE
used
term ‘handshaking’
is used
to describe
Data F low
Signal Pthe
in
P in
Signal
their
function
T XD
2
2
T XD
RXD
3
3
RXD
SG
7
7
SG
Interfacing & Communication
Signal Devices – Pin & Line Assignment
(RS232C)
• Normally other lines on the interface are
used to control the flow. When these control
lines are used the term ‘handshaking’ is
used to describe their function
Interfacing & Communication
Signal Devices – Pin & Line Assignment
(RS232C)
DATA
RECO RDER
CO M PUTER
PG
1
1
PG
TXD
2
2
TXD
RXD
3
3
RXD
RTS
4
4
RTS
CTS
5
5
CTS
DCD
8
8
DCD
DSR
6
6
DSR
DTR
20
20
DTR
SG
7
7
SG
Protective Ground
DTE transmits data
DCE receives data
Request to send
Clear to send
Data carrier detect
Data set ready
Data terminal ready
Signal ground
Interfacing & Communication
Signal Devices – Pin & Line Assignment
(RS232C) Pin 20 is set high by
DATA
RECO RDER
CO M PUTER
PG
1
1
PG
TXD
2
2
TXD
RXD
3
3
RXD
RTS
4
4
RTS
CTS
5
5
CTS
DCD
8
8
DCD
DSR
6
6
DSR
DTR
20
20
DTR
SG
7
7
SG
each device when
it is switched on.
Thus each device
informs the other
that it is ready
Data terminal ready
Signal ground
Interfacing & Communication
Signal Devices – Pin & Line Assignment
(RS232C) When a device is
DATA
RECO RDER
CO M PUTER
PG
1
1
PG
TXD
2
2
TXD
RXD
3
3
RXD
RTS
4
4
RTS
CTS
5
5
CTS
DCD
8
8
DCD
DSR
6
6
DSR
DTR
20
20
DTR
SG
7
7
SG
ready to transmit
data pin 4 is set
high
DCE receives data
Request to send
Clear to send
Data carrier detect
detected on pin 8 of
the other device
Interfacing & Communication
Signal Devices – Pin & Line Assignment
(RS232C) If it is ready to receive a
DATA
RECO RDER
CO M PUTER
PG
1
1
PG
TXD
2
2
TXD
RXD
3
3
RXD
RTS
4
4
RTS
CTS
5
5
CTS
DCD
8
8
DCD
DSR
6
6
DSR
DTR
20
20
DTR
SG
7
7
SG
message it will
respond with a clear
to send (CTS) on pin 5
DCE receives data
Request to send
Clear to send
Data carrier detect
detected on pin 8 of
the first device
Interfacing & Communication
Signal Devices – Parallel Interfaces
• each bit of a data byte travels down its own wire.
– for an 8-bit byte the interface would consist of at least
8 wires.
• Normally used for one way communication
between a computer and an output device such as
a printer or plotter.
• If two-way parallel communication is required
then additional cables are required for hardware
handshaking.
• The Centronics pin connectors have become the
standard parallel interface for printers. This
connector has 36 pins.