CS609 System Programming Assignment 5 solution Fall 2012


Read carefully the C-language program in your course handouts (page 127-129). In this program, you are told how to set various serial port parameters. Based on the knowledge you gain here, answer the following by writing appropriate C-language instruction with single line comments to achieve stated task.

S.No. Task C-Language Instruction with single line comments
1 Write a single line of code to set the com pointer variable to COM port 3.  outportb ((*com)+3)


2 Write a single line of code to set the size of Word Length to     8-bits to be used in serial communication for data transmission.   outportb ((*com)+3,0×03)


3 Write a single line of code to set the size of Stop bits equals 3 in serial port communication.  In serial communication we cannot sets stop bit to 3.Only we can set stop bit 1 or 1.5 or 2 through setting.


4 Write a single line of code to turn ON the parity bit and use Even parity.
outportb ((*com)+3,0×18)

5 In the following piece of code, the Baud rate being used is 1200. Modify it in a way such that we shall have Baud Rate of 2400. 

outportb ((*com)+3,inport((*com)+3)|0x80);

outportb ( (*com),0x60);

outportb( (*com) +1, 0x00);


 outportb ((*com)+3,0×05)