Извините что отвлекаю.
Помогите, кто чем может.
Смешная ситуация
Написал программу (C55,WinXP), которая работает через Com порт с
контроллером.
Ну все было хорошо, (Read- ok Write - ok) пока не выключил машину.
Делаю Init port
APICreateFile...ok
GetCommState....ok
!--------------------
DCB.BaudRate = CBR_4800
DCB.Parity = None
DCB.ByteSize = 8
DCB.StopBits = 1
!-----------------
SetCommState....ok
SetCommTimeouts....ok
Пишу в контроллер (вернуть статус)
Тот должен ответить типа FF FF ....... и т.д.
Начинаю читать 7F 7F........и т.д.
Программа пишет, читает все вроде нормально, но везде замена или концовка на Hex: 7F Dec: 127
Запускаю любую другую Com программу на этот порт.
Потом захожу своей, все прекрасно.
Timeouts настроил.
Может DCB у меня с ошибкой?
Ниже описание DCB
Код: Выделить всё
DCB GROUP
DCBlength ULONG ! sizeof(DCB)
BaudRate ULONG ! current baud rate
fBinary ULONG ! binary mode, no EOF check
fParity ULONG ! enable parity checking
fOutxCtsFlow ULONG ! CTS output flow control
fOutxDsrFlow ULONG ! DSR output flow control
fDtrControl ULONG ! DTR flow control type
fDsrSensitivity ULONG ! DSR sensitivity
fTXContinueOnXoff ULONG ! XOFF continues Tx
fOutX ULONG ! XON/XOFF out flow control
fInX ULONG ! XON/XOFF in flow control
fErrorChar ULONG ! enable error replacement
fNull ULONG ! enable null stripping
fRtsControl ULONG ! RTS flow control
fAbortOnError ULONG ! abort reads/writes on error
Dummy2 ULONG ! reserved
wReserved USHORT ! not currently used
XonLim USHORT ! transmit XON threshold
XoffLim USHORT ! transmit XOFF threshold
ByteSize BYTE ! number of bits/byte, 4-8
Parity BYTE ! 0-4=no,odd,even,mark,space
StopBits BYTE ! 0,1,2 = 1, 1.5, 2
XonChar BYTE ! Tx and Rx XON character
XoffChar BYTE ! Tx and Rx XOFF character
ErrorChar BYTE ! error replacement character
EofChar BYTE ! end of input character
EvtChar BYTE ! received event character
wReserved2 USHORT
END