I would like to ask deanlwvu (TechnicalUser) about this email:
"I was successful in getting this to work using the inportb and outportb functions.
/* This program is used to pull data from the serial port */
#include <dos.h>
#include <stdio.h>
#include <conio.h>
#define PORT1 0x3F8 /* Defines Serial Port Base Address (COM1 */
void main(void){
unsigned char c = 0;
unsigned char chrctr = 0;
/*int exit = 1; */
outportb(PORT1 + 1, 0); /* Turn off interrupts */
/* PORT1 Communication Settings */
outportb(PORT1 + 3, 0x80); /* Set DLAB ON */
outportb(PORT1 + 0, 0x0C); /* Set the baud rate to 9600 */
outportb(PORT1 + 1, 0x00); /* Set Baud - Divisor latch HIGH */
outportb(PORT1 + 3, 0x03); /* 8 bits, no parity, 1 stop */
outportb(PORT1 + 2, 0xC7); /* FIFO Control Register */
outportb(PORT1 + 4, 0x0B); /* Turn on DTR, RTS, and OUT2) */
printf("Waiting on transmission from source.\nPress ESC to quit.\n"

;
while(chrctr != 27){ /* Execute the loop if ESC has been hit */
c = inportb(PORT1 + 5);
if (c & 0x01){
chrctr = inportb(PORT1);
printf("%d",chrctr);
}
if (kbhit()){
chrctr = getch();
outportb(PORT1, chrctr);
}
}
}"
I'm trying to communicate (write) serially to a device and believe the stated code might work; but, the operating system I'm using is Windows XP. My question is, do you think the code above will work?
Thanks