OBJECTIVE: The first objective is to determine the baud rate, number of data bits, parity generation method, and number of stop bits experimentally by observing the transmitted serial waveform with the CRO (optional -- extra credit to students that successfully demonstrate this). The second objective is to use the serial ports (COM1) of two computers and application software implemented by the student to create a talk session between the two computers
EQUIPMENT NECESSARY:
| 2 PCs |
| Null Modern Cable |
| CRO |
| Borland Turbo C |
PRE-LAB:
1. Read the course notes so that you can sketch the transmitted
serial waveform to scale for a given character code, number of data bits,
number of stop bits, and parity method (quiz hint hint).
2. Write the application software using C to implement that talk
program as described in the LAB
DESCRIPTION
section below. The information provided here and in the course notes
are sufficient to initialize and program the internal serial port.
LAB
DESCRIPTION(TALK
PROGRAM):
(part of the prelab)
Each student must write a program that will enable two computers to
communicate via COM1 with a Null Modem Cable. The program should
support the following features:
1. Initialize COM1 to 8 data bits, 2 stop bits, no parity bits,
and 7200 Baud. ( i.e. 8N1-7200)
2. The program must support XON (cntrl Q, 0x11) and XOFF (cntrl
S, 0x13) flow control signals. When your program is ready to receive,
it sends XON to signal the remote computer to start sending . Likewise,
your program sends the XOFF command to signal for the remote computer to
stop sending until it receives an XON signal. (NOTE: Don't worry
about this at first)
3. The program must properly use the handshaking signals: RTS,
CTS, DTR, DSR. These signal insure that a physical connection is
present between the connected computers. (NOTE: Leave this for the end,
but be sure you understand the concept)
4. Diagnostic loop-back mode.
5. Transmit and receive messages (half duplex is fine, but try
to get the systems to work in full duplex) until the EOF character (ctrl
Z, 0x1A) is pressed. When the EOF key is pressed, transmit the EOF character
before you quit, so that the receiver receives the EOF character.
6. The program should provide the appropriate status messages
to identify the state of the program. Characters entered via the
keyboard should be transmitted while characters received should be displayed.
ONE
program should provide ALL aforementioned functionality.
7. Bonus: Look us the "gotoxy" function in the Turbo C on-line
help. Use this function to create a split-screen chat program, similar
to the UNIX "talk" command.
DURING
LAB:
1. Demonstrate that your program operates correctly in loop-back
mode.
2. Connect COM1 on two different machines using a null modem.
Run your program on both machines to insure that your communications scheme
works on both sides. Once this is accomplished, you should try using your
program with other students' programs.
POST-LAB:
1. Write a lab report that includes your well-commented
program.
2. The lab report should include a flow diagram of the complete
functionality of your program.
HINTS:
1. Your program must provide some concurrency by avoiding busy
waits. The general concept is provided in the following pseudo-code fragment:
------------------------------------
while(TRUE)
{
if(condition_1 is TRUE) then
do function_1;
if(condition_2 is TRUE) then
do function_2;
..................
if(condition_N is TRUE) then
do function_N;
}
------------------------------------
2. The example
laboratory report provides some examples of 8250 programming.