> > I am trying to get my handyboard communicating with a TurboC program through
> > the com2 port on my >>computer. I have been attempting to use the routine
> > found in serialio.c on the website. Say I have an
> > infinite loop setup on my...
Nevermind folks, I figured it out. It was my setup of the com port in
TurboC. Here is the code I used to solve the problem if anyone is interested...
#define PORT1 0x2F8 /* com2 */
void initialize_comport(void)
{
outportb(PORT1+1,0); /* turn off interrupts */
outportb(PORT1+3,0x80); /* set DLAB on */
outportb(PORT1+0,0x0C); /* set baud rate - divisor latch low byte */
/* 0x01 = 115,200 BPS */
/* 0x02 = 56,700 BPS */
/* 0x03 = 38,400 BPS */
/* 0x06 = 19,200 BPS */
/* 0x0C = 9,600 BPS */
/* 0x18 = 4,800 BPS */
/* 0x30 = 2,400 BPS */
outportb(PORT1+1,0x00); /* set baud rate - divisor latch high byte */
outportb(PORT1+3,0x03); /* 8 bits, no parity, 1 stop bit */
outportb(PORT1+2,0xC7); /* FIFO control register */
outportb(PORT1+4,0x0B); /* turn on DTR, RTS, and OUT2 */
}
now just use inportb(PORT1) to read an integer ascii character and
outportb(PORT1, int ch) to transmit an integer ascii char ch on the PC's serial
port. Joe
|