I have been given the unenviable task of making one of our legacy (DOS 5.0) systems work with current technology. Specifically, I need to be able to have 4 COM ports on a system. Well 2 of them are ok, since they are hard-wired into the motherboard. The other 2 have to be obtained through a PCI serial card.
The issue I am having is that I have been COMPLETELY unable to programmatically access the Com 3&4 that are created with this PCI card. The ports are there, and I can detect them, but whenever I try and send data to them, it does not work. However, I can ‘echo’ commands to the port through DOS, and the device receives the data just fine. Below I am posting the 2 versions code that I have written to try & access the ports.
‘-=-=- BEGIN CODE SAMPLE #1 -=-=-
DEFINT A-Z
Open$ = "COM1: 1200,E,7,1,BIN,CD0,CS0,DS0,OP0,RS,TB2048,RB2048"
OPEN Open$ FOR RANDOM AS #1
CLOSE #1
‘-=-=- BEGIN CODE SAMPLE #1 -=-=-
This code generates the message “Bad file name in line…”.
‘-=-=- BEGIN CODE SAMPLE #2 -=-=-
DEFINT A-Z
DIM PortAdd
DEF SEG = 0
PortAdd = PEEK(&H404) + 256& * PEEK(&H405) 'For COM3
DEF SEG
Packet$ = CHR$(2) + CHR$(90) | CHR$(3)
FOR x = 1 TO LEN(Packet$)
OUT PortAdd, ASC(MID$(Packet$, x, 1))
NEXT x
‘-=-=- BEGIN CODE SAMPLE #2 -=-=-
With example #2, the data never actually reaches the device. I have also plugged in a packet analyzer in, and I know I am sending the data, but the COM port (3 in this case) never gets it.
Anyone got any ideas?
Thanks in advance
Thought for the day: Beware of Gods who cannot laugh...
The issue I am having is that I have been COMPLETELY unable to programmatically access the Com 3&4 that are created with this PCI card. The ports are there, and I can detect them, but whenever I try and send data to them, it does not work. However, I can ‘echo’ commands to the port through DOS, and the device receives the data just fine. Below I am posting the 2 versions code that I have written to try & access the ports.
‘-=-=- BEGIN CODE SAMPLE #1 -=-=-
DEFINT A-Z
Open$ = "COM1: 1200,E,7,1,BIN,CD0,CS0,DS0,OP0,RS,TB2048,RB2048"
OPEN Open$ FOR RANDOM AS #1
CLOSE #1
‘-=-=- BEGIN CODE SAMPLE #1 -=-=-
This code generates the message “Bad file name in line…”.
‘-=-=- BEGIN CODE SAMPLE #2 -=-=-
DEFINT A-Z
DIM PortAdd
DEF SEG = 0
PortAdd = PEEK(&H404) + 256& * PEEK(&H405) 'For COM3
DEF SEG
Packet$ = CHR$(2) + CHR$(90) | CHR$(3)
FOR x = 1 TO LEN(Packet$)
OUT PortAdd, ASC(MID$(Packet$, x, 1))
NEXT x
‘-=-=- BEGIN CODE SAMPLE #2 -=-=-
With example #2, the data never actually reaches the device. I have also plugged in a packet analyzer in, and I know I am sending the data, but the COM port (3 in this case) never gets it.
Anyone got any ideas?
Thanks in advance
Thought for the day: Beware of Gods who cannot laugh...