Pages

About Lan Ahmad

My photo
Pendang, Kedah, Malaysia
It's all about my real life!!!

Serial Communication


Introduction
Serial communication is a way enables different equipments to communicate with their outside world. It is called serial because the data bits will be sent in a serial way over a single line.

A personal computer has a serial port known as communication port or COM Port used to connect a modem for example or any other device, there could be more than one COM Port in a PC.

Advantages of Serial Communication

Serial communication has some advantages over the parallel communication. One of the advantages is transmission distance, serial link can send data to a remote device more far then parallel link. Also the cable connection of serial link is simpler then parallel link and uses less number of wires.

Serial link is used also for Infrared communication, now many devices such as laptops & printers can communicate via inferred link.


Example coding for Serial Communication:-
#include <pic.h>
#use delay(clock=20000000)
#fuses hs,nowdt,nolvp,noprotect, nobrownout
#use rs232(baud=9600,xmit=pin_c6,rcv=pin_c7, parity=n)


void main()
{
int count=0;
while(true)
{
printf("\f**Welcome to Malaysia**\n\r");
printf("**counter value is %u **", count);
count+=1;
delay_ms(1000);
}
}


Compiler: PIC C Compiler