Sunday, 21 October 2012

PROGRAM HYPERTERMINAL TURBO C BY ADRI FD

PROGRAM HYPERTERMINAL MENGGUNAKAN TURBO C BY ADRI FAKHRI D

#include <dos.h>
#include <conio.h>
#include <stdio.h>

#define PORT1 0X3F8

/*
KETERANGAN:
COM1 0X3F8
COM2 OX2F8
COM3 0X3E8
COM4 0X2E8
*/

void main(void)
{

int c;
int ch;
outportb(PORT1+1,0); //matikan interupt port 1
outportb(PORT1+3,0X80); //set dlab on
outportb(PORT1+0,0X0C);
/* SETTING BAUDRATE PORT1+0
0X01=115,200 BPS
0X02=57,600 BPS
0X06=19,200 BPS
0X0C=9,600 BPS
0X18=4,800 BPS
0X30=2,400 BPS
*/

outportb(PORT1+1,0X00); //Set baudrate -divisor latch high byte
outportb(PORT1+3,0X03); //8 Bit , No Paritiy, 1 Stop Bit
outportb(PORT1+2,0XC7); //FIFO control register
outportb(PORT1+4,0X0B); //Turn on DTR,RTS dan Out2

clrscr();
gotoxy(25,1); printf("PROGRAM CHECK KOMUNIKASI SERIAL \n");
gotoxy(38,2); printf("RS232 \n");
gotoxy(30,3); printf("ADRI FAKHRI DHAIFULLAH \n");
gotoxy(31,4); printf("PRESS ESC TO QUIT \n\n");
gotoxy(38,5); printf("COM1\n\n\n");

do
{
c=inportb(PORT1+5);

if (c&1)
{
ch=inportb(PORT1);
printf("%c",ch);
}

if (kbhit())
{
ch=getch();
outportb(PORT1,ch);
}

}

while(ch!=27);

}

No comments:

Post a Comment