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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
VovbagerCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.