Stopbits are a bit strange. Here's code from my serial tester that works:
oDevice:StopBits := IIF(oCCZeroButton:Checked, 0, 2)
Let me know if you need my tester code. It uses ClassMate but I'm including
the BeginButton code here so you can see how it works:
METHOD BeginButton() CLASS CommWindow
LOCAL cErr AS STRING
LOCAL dwBaud, dwParity AS DWORD
LOCAL cPort AS STRING
LOCAL oDevice AS Serial
oDevice := oDCCommEdit:Device
// Set the comm MLE to empty again
oDCCommEdit:TextValue := ""
oDCCommEdit:SetFocus()
BEGIN SEQUENCE
// Set comm port with values from the window's controls
cPort := oDCPortListBox:CurrentItem
IF !oDevice:Open(cPort)
cErr := "Cannot open port "+oDCPortListBox:CurrentItem + CRLF+ ;
"Error code "+oDevice:ErrorCode+": "+oDevice:ErrorDesc
BREAK
ENDIF
// Set timeout values for read
//oDCCommEdit:Device:ReadIntervalTimeout := MAXDWORD
oDevice:ReadIntervalTimeout := 0 // Disable read interval
timeouts
oDevice:ReadTimeoutMultiplier := 500
oDevice:ReadTimeoutConstant := 1000
oDevice:WriteTimeoutMultiplier := 0
oDevice:WriteTimeoutConstant := 1000
IF !oDevice:SetTimeOut()
cErr := "Can't set timeout values for scale port"
BREAK
ENDIF
dwBaud := Val(oDCBaudListBox:CurrentItem)
oDevice:Baud := dwBaud
dwParity := oDCParityListBox:CurrentItemValue
oDevice:Parity := dwParity
oDevice:ByteSize := BYTE(IIF(oCCSevenButton:Checked, 7, 8))
oDevice:StopBits := IIF(oCCZeroButton:Checked, 0, 2)
IF !oDevice:SetProtocol()
cErr := oDevice:ErrorDesc
BREAK
ENDIF
// Start receiving comm events in the MLE
oDevice:EnableEvents(EV_RXCHAR)
// Disable Begin and Exit buttons and enable End button
oCCBeginButton:Enabled := FALSE
oCCExitButton:Enabled := FALSE
oCCEndButton:Enabled := TRUE
RECOVER
// Display error message
MessageBox(0, PSZ(cErr), PSZ("Error"), MB_OK)
END SEQUENCE
CLASS SerialMLE INHERIT MultiLineEdit
PROTECT oComm AS Serial // the serial object used by this MLE
EXPORT CancelRequested AS LOGIC
DECLARE ACCESS Device
Ginny
"Martin" wrote in message news:Lsqit.23306$sr.2...@fx09.fr7...