Cigojlo
Cigojlo

Reputation: 1

Turbo Pascal serial port

I want to help my friend with an old CNC machine. There is a program written in TP. It doesn’t support the RS232 standard port on the motherboard. It only works with a serial card with ISA port. The card in that old PC is a Winbond I/O 2X COM card SPC21XX 16 bit (ISA)​. There are almost no more PCs with ISA slot …

There is no error but when I switch to RS232 on the motherboard, it won’t work with the CNC machine. That machine uses two RS232’s on the ISA card and works great, but on the standard RS232 or PCI2 port of the serial card, the CNC won’t work. Any help please?

Here is what I found in the source code:

procedure BIOS_RS232_Init(ComPort, ComParm : Integer);
{ Issue Interrupt $14 to initialize the UART }
{ See the IBM PC Technical Reference Manual for the format of ComParm }
var
  Regs : registers;
begin
  with Regs do
    begin
      ax := ComParm and $00FF;  { AH=0; AL=ComParm }
      dx := ComPort;
      Intr($14, Regs)
    end
end; { BIOS_RS232_Init }
{$I terminal.in1}   {Terminal Program Part 1}
{$I terminal.in2}   {Terminal Program Part 2}
{$I terminal.in3}   {Terminal Program Part 3}

{-------------------------------------------------------------------------}
{Main Program                                                             }
{Variables and constants                                                  }
{                                                                         }
{Baud        :Baudrate          Global Variables of RS232 routines        }
{SER         :COM-Interface     Global Variables of RS232 routines        }
{BitCount    :Char length       Global Variables of RS232 routines        }
{Parity      :Parity   G,K,U    Global Variables of RS232 routines        }
{Handshake   :Handshake G,H,S   Global Variables of RS232 routines        }
{Stopbit     :Stopbit 1,2       Global Variables of RS232 routines        }
{Duplex      :Terminal echo mode V=no Echo H= Echo                        }
{RXAttr      :Attribute for RX data                                       }
{TXAttr      :Attribute for TX data                                       }
{Receive     :Status variable  TRUE = Read File opened                    }
{InChar      :Character read from the interface                           }
{OutChar     :Character read  from kybd the normal way                    }
{CtrlChar    :Extended ctrl codes read  CHR(0)+..                         }
{-------------------------------------------------------------------------}

BEGIN

  StartUpSelectiveCapture;
{***************** Standard parameters at program start ****************}

  AttrSet;             {Screen attributes setup}

IF ReadPar=False THEN
  BEGIN
    SER:=1;
    Baud:=9600;
    BitCount:=8;
    Parity:='N';
    Stopbit:=1;
    Handshake:='S';
    Duplex:='F';
  END;

  {Parameters for Turbo Pascal Unit CRT                             }

  DirectVideo:=true;    {directs write to video RAM                 }
  CheckSnow:=false;     {no snow check                              }


  TextAttr:=RXAttr;
  ClrScr;
  IF V24Install=False THEN
    BEGIN
      While V24Install=False DO
         BEGIN
            Write (#7);
        WriteSta('Error: COM'+CHR(48+SER)+' is not installed!!');
            V24Param;
         END;
    END
  ELSE V24OPEN;
  StatusLine;
  CtrlChar:=Chr(0);
  OutChar:=Chr(0);
  Receive:=False;

  REPEAT
    IF (KeyPressed) THEN
       BEGIN
         Keyboard;
         IF CtrlChar=CHR(25) THEN V24Param                      {ALt-P}
         ELSE IF CtrlChar=chr(48)  THEN SendBreak(BreakPeriod)  {Alt-B}
         ELSE IF CtrlChar=chr(31)  THEN FileSend                {Alt-S}
         ELSE IF CtrlChar=chr(46)  THEN WritePar                {Alt-C}
         ELSE IF CtrlChar=chr(19)  THEN                         {Alt-R}
           BEGIN
             IF Receive THEN
               RXFileClose
             ELSE
               RXFileOpen;
           END
         ELSE IF CtrlChar=chr(35)  THEN Help                    {Alt-H}
         ELSE IF CtrlChar<>Chr(45) THEN
           BEGIN
             V24Out(OutChar);
             IF Duplex='H' THEN
               BEGIN
                 TextAttr:=TXAttr;
                 Write(OutChar);
                 IF OutChar=CHR(13) THEN Writeln;               {CR+LF}
                 TextAttr:=RXAttr;
               END;
           END;
       END;

    IF V24Data THEN
      BEGIN
        InChar:=V24In;
        If InChar=OutChar THEN
          BEGIN
            TextAttr:=TXATTR;
{***************************************************************************}
{            SelectiveCapture;}
{***************************************************************************}
            Write (InChar);
            TextAttr:=RXATTR;
          END
        ELSE Write(InChar);
{****************************************************************************}
        SelectiveCapture;
{****************************************************************************}
        IF Receive THEN WriteRX;
      END;

  UNTIL CtrlChar=Chr(45);                                       {Alt-X}

  V24CLOSE;

  Window(1,1,80,25);
  TextAttr:=07;
  ClrScr;

END.

I didn’t try anything in the source code; I am expecting a little help!

Upvotes: -3

Views: 102

Answers (0)

Related Questions