Serial Port and Device Control Block Help 
Author Message
 Serial Port and Device Control Block Help

Need some urgent help with initializing of the Device Control Block
(DCB) for serial communications.

I based my code on the Dan Appleman example(CommDemo) for a serial
device which has 9600baud rate, RTS/CTS handshaking, 7 data bits, 1
stop bit and even parity

The code below was used to initialize the DCB however, when the API
function SetCommState is called the device is not responding(this is
before we even send the command to establish a link).

The initialize code is below, any help would be great thanks:

Private Sub Class_Initialize()
    ' The structure length must always be set
    DCB.DCBlength = Len(DCB)
    ' Set some default values
    BufferSize = 1024
   ' fBinary = 1
    fParity = 1
    fOutxCtsFlow = 1
    fOutxDsrFlow = 1
    fDtrControl = 1
    fDsrSensitivity = 1
    fTXContinueOnXoff = 0
    fOutX = 0
    fInX = 0
    fErrorChar = 1
    fNull = True
    fRtsControl = 1
    fAbortOnError = 1
    DCB.XonLim = 100
    DCB.XoffLim = BufferSize - 100
    DCB.ByteSize = 7
    DCB.Parity = 2
    DCB.StopBits = 0
    DCB.XonChar = 17
    DCB.XoffChar = 19
    DCB.ErrorChar = Asc("~")
    DCB.EofChar = 26 ' ^Z
    DCB.EvtChar = 255
    ' Set some default value
    DCB.BaudRate = 9600
End Sub

Sent via Deja.com http://www.*-*-*.com/
Share what you know. Learn what you don't.



Wed, 06 Feb 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. vb5 &controlling devices via serial ports

2. ActiveX Controls for Serial Devices - Port Contention

3. ActiveX Controls for Serial Devices - Port Contention

4. Talking to external devices via Serial Port (MSCOM.OCX)

5. Efficient handling of strings from serial port device?

6. How to loop comm port control to read text files through serial port in VB3

7. need help with basic and controlling serial ports

8. I/O port, Parallel port, Serial port

9. Open ports / Blocking ports

10. Controlling external device on parallel port

11. Using Parallel Port I/O to control external devices

12. Help reqd on ports identifying different hardware devices connected to the system in vb.net

 

 
Powered by phpBB® Forum Software