home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.pascal.borland      Borland Pascal was actually pretty neat      2,978 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 1,236 of 2,978   
   Heinrich Wolf to giorgio.bonanni@tin.it   
   Re: rs 232 with pascal   
   18 Jan 05 18:07:11   
   
   From: Me@Privacy.net   
      
   "x"  schrieb im Newsbeitrag   
   news:_xcEd.384835$b5.18791867@news3.tin.it...   
   > hi to everyone   
   > How I can use rs232 with pascal ... I need to read and write bits with   
   > rs232   
   > TY   
   >   
      
   Just some examples:   
      
     const   
     fBinary                       = $0001;   
     fParity                       = $0002;   
     fOutxCtsFlow                  = $0004;   
     fOutxDsrFlow                  = $0008;   
     fDtrControlDisable            = DTR_CONTROL_DISABLE   shl 4;   
     fDtrControlEnable             = DTR_CONTROL_ENABLE    shl 4;   
     fDtrControlHandshake          = DTR_CONTROL_HANDSHAKE shl 4;   
     fDsrSensitivity               = $0040;   
     fTXContinueOnXoff             = $0080;   
     fOutX                         = $0100;   
     fInX                          = $0200;   
     fErrorChar                    = $0400;   
     fNull                         = $0800;   
     fRtsControlDisable            = RTS_CONTROL_DISABLE   shl 12;   
     fRtsControlEnable             = RTS_CONTROL_ENABLE    shl 12;   
     fRtsControlHandshake          = RTS_CONTROL_HANDSHAKE shl 12;   
     fRtsControlToggle             = RTS_CONTROL_TOGGLE    shl 12;   
     fAbortOnError                 = $4000;   
      
      
     var     DCB      : tDCB;   
             Timeouts : CommTimeouts;   
       Port                 : tHandle;   
      
      
       Port := CreateFile('COM1',   
                          Generic_Read or Generic_Write,   
                          0,   
                          Nil,   
                          Open_Existing,   
                          File_Flag_Write_Through   
                          or File_Flag_No_Buffering,   
                          0);   
       if Port = Invalid_Handle_Value then   
         {GetLastError}   
       else   
         begin   
           FillChar(DCB, sizeof(DCB), 0);   
           DCB.DCBlength := sizeof(DCB);   
             DCB.BaudRate := CBR_9600   
           DCB.Flags    := fBinary or fDtrControlDisable or fRtsControlDisable;   
           DCB.ByteSize := 8;   
           DCB.Parity   := NoParity;   
           DCB.StopBits := OneStopBit;   
           DCB.XoffChar := A_Xof;   
           if not SetCommState(Port, DCB) then   
             {GetLastError};   
           Timeouts.ReadIntervalTimeout         := MaxDWord;   
           Timeouts.ReadTotalTimeoutMultiplier  := 0;   
           Timeouts.ReadTotalTimeoutConstant    := 0;   
           Timeouts.WriteTotalTimeoutMultiplier := 0;   
           Timeouts.WriteTotalTimeoutConstant   := 0;   
           if not SetCommTimeouts(Port, Timeouts) then   
             {GetLastError};   
         end;   
      
         CloseHandle(Port);   
      
           if ReadFile(Port,   
                       Buffer[BufferPos],   
                       sizeof(Buffer) - BufferPos,   
                       i,   
                       Nil) then   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca