Hi there folks
I have done quite a bit of C programming for embedded environments and PC console programs but never for windows applications and only once before with the PC COM port.
When I did program for the COM port before it was on older machine, and used conio.h and dos.h. I understand these header files are no use anymore on newer windows machines as they worked with DOS.
I now need to be able to communicate with a USB device (USB to I2C converter) that appears as a COM port when plugged into the machine
Are there any good resources online for explaining how to use the COM port in C available online? Or even a bare bones example program?...
I've not had much luck with google etc, everyone these days seems to be using C# or VB :(
Also are there any good online resources available for an amateur to show how to create C windows applications?? again googling gives me only C# or VB :(
An old example program where I used conio.h and dos.h
/* Prog to send 'G' to Serial Com Port1 */
#include <stdio.h>
#include <conio.h>
#include <dos.h>
int com2Address = 0x2f8; /* Assign a var name to com2*/
int lCR = 0x2FB; /* Assign a var name to line control register*/
int dLLB = 0x2f8; /* Assign a var name to divisor latch low byte */
void main(void)
{
outp(lCR, 0x8a); /* Set line control register to 10001010 */
outp(dLLB, 0x18); /* Set divisor latch low byte to 18h for 4800 bps */
outp(lCR, 0x0a); /* Set line control register to 00001010, turning off DLAB */
outp(com2Address, 'G'); /* Set com2 to G */
}