Hi,
Since more newer PC´s have no Parallel Port and Serial Port anymore, i need to rewrite a 10 year old MS Visual-C++ program for USB access.
First problem: Visual C++ 6.0 doesn´t support serial ports greater than 5.
On all laptops we cannot use serial ports 3 to 10 ( already occupied ).
How can I gain access to at least ports 3 , 4 or 5 ?
Second problem: On my desktops I can use either COM3: or COM4: depending on PC and Operating System (WIN XP or WIN7), however using CreateFile and WriteFile the Program freezes after approx. 50 seconds. Parallel port operation is still functioning.
I can send Code snippets, if necessary.
regards, René
EDIT - Update From OP ================
I have tried using those 8 $ USB to parallel port adapters, but they only work with real printers.
Since my control box is a write only device it cannot simulate a printer and create the respective feedback signals.
So i bought a 70 $ device USB8-I/O HB628 from H-Tronic, but when using serialport 3 or 4 (only ones available, higher ones show "already occupied" ) on my desktops my timer freezes after appr. 50 seconds. On Laptops only COM1 and COM2 are free, which cannot be used for virtual ports.
Now to the timer freeze. relevant code pieces are:
rcsp = CreateFile(portname,GENERIC_WRITE,FILE_SHARE_WRITE,NULL,OPEN_EXISTING,NULL,NULL);
. . . . . .
if (interf == 0)
{
if (abcd)
{
pdat |= 16;
}
else
{
pdat &= 0xFFEF;
}
if (redjustset==1)
{
pdat |= 64;
Out32(0x378,pdat);
Sleep(100);
pdat &= 0xFF9F;
Out32(0x378, pdat);
}
if (red)
{
pdat |= 8;
redjustset = 0;
}
else
{
pdat &= 0xFFF7;
}
………….
}
else
{
………….
if (red)
{
bWriteRC = WriteFile (rcsp,"c141",4,&iBytesWritten, NULL);
redjustset = 0;
}
else
{
bWriteRC = WriteFile (rcsp,"c140",4,&iBytesWritten, NULL);
}
this program is used in archery contests and controls traffic lights and clocks to inform archers about when and how long they can shoot.