Working with COM1

When I receive data thru COM1 everything is OK, but the situation when I gotta receive BYTE = 00

For example when the other machine
sends:
      66 44 55 00 A4 FD FF
My computer receives:
      66 44 55 A4 FD FF

I am using the Win API function :
         ReadFile

What's going on here?
Can you help me, please ?
It's very urgent!!!
         
             Alexander Hristov
        email : a_christ77@yahoo.com
LVL 1
ZashAsked:
Who is Participating?
 
VovbagerConnect With a Mentor Commented:
hi

try to inicialize your comm in this way

var DCB: TDCB;

DCB.DCBlength:=SizeOf(TDCB);
DCB.BaudRate:=9600;


DCB.Flags:=3;  // this is very important value, sets don't use EOF char, EVT char, XON char, XOFF char, ERROR char


DCB.wReserved:=256;
DCB.XonLim:=49152;
DCB.XoffLim:=49152;
DCB.ByteSize:=8;
DCB.Parity:=0;
DCB.StopBits:=0;
DCB.XonChar:=#0;
DCB.XoffChar:=#0;
DCB.ErrorChar:=#0;
DCB.EofChar:=#3;
DCB.EvtChar:=#0;
DCB.wReserved1:=0;
Result:=SetCommState(ComHandle, DCB);

Your computer have sets 00 as ErrorChar perhaps. You must disable use this char in Flags.

0
 
rwilson032697Commented:
Can you post your code? It almost sounds like it is being treated as a null terminated string...

Also, which platform are you using?

Cheers,

Raymond.
0
 
ZashAuthor Commented:
Vovbager, 10x a lot!
DCB.Flags:=3 solved my problem!

Can you tell me where I can read information about DCB.Flags, because in the help I didn't find anything about DCB.Flags

          Alexander Hristov
      email:a_christ77@yahoo.com
0
 
VovbagerCommented:
You can see this information in win32 SDK Help, if you haven't this help file I can send this file via e-mail.

there are informations about Flags from WIndows SDK Help, there are more informations about this flags

    DWORD fOutxCtsFlow:1;      // CTS output flow control
    DWORD fOutxDsrFlow:1;      // DSR output flow control
    DWORD fDtrControl:2;       // DTR flow control type
    DWORD fDsrSensitivity:1;   // DSR sensitivity

    DWORD fTXContinueOnXoff:1; // XOFF continues Tx
    DWORD fOutX: 1;            // XON/XOFF out flow control
    DWORD fInX: 1;             // XON/XOFF in flow control
    DWORD fErrorChar: 1;       // enable error replacement
    DWORD fNull: 1;            // enable null stripping
    DWORD fRtsControl:2;       // RTS flow control
    DWORD fAbortOnError:1;     // abort reads/writes on error
    DWORD fDummy2:17;          // reserved
 
0
All Courses

From novice to tech pro — start learning today.