• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 

Why can't I send a hexadecimal character with a high bit of 1?

Started by sxbug, December 31, 2020, 10:08:17 pm

Previous topic - Next topic

sxbug

I used nrComm and data processor  to send and receive data(dataprocessor DEMO ,delphi 10.2 ). After testing on a computer, the RX and TX of the serial port are short circuited. The memo is used as the terminal of nrComm, and the nrComm is set to 115200bps,parity=none,stopbits=1,streamprotocol=none,bytesize=8。
  nrDataProcessor1.DataPackets[0].PacketBegin:=#$5A;
  nrDataProcessor1.DataPackets[0].Packetend:=#$FE;
  nrDataProcessor1.DataPackets[0].Active:=True;

Send with the following command:
mystr:=#$5A#$31#$80#$32#$33#$34#$FE#$EF;
  if nrComm1.Active then
    nrComm1.SendString(mystr)
  else
    ShowMessage('serial not open');

send:5A 31 32 33 34 FE EF
recv:5A 31 32 33 34 C3 BE C3 AF

send:5A 31 80 32 33 34 FE EF
recv:5A 31 C2 80 32 33 34 C3 BE C3 AF

sxbug

send:5A A5 0A 00 05 C2 00 D0 FE EF
recv:5A 3F 05 3F C3 90 C3 BE 3F

Why? Thanks

sxbug

mystr:pansichar;
mystr:=#$5A#$31#$80#$32#$33#$34#$FE#$EF;
  if nrComm1.Active then
    //nrComm1.SendString(mystr)
    nrComm1.SendData(mystr,8)

         5A 31 80 32 33 34 FE EF
recv:5A 31 C2 80 32 33 34 C3 BE C3 AF

There are still problems. And Why nrDataProcessor1 show Timeout?
Thanks

Roman Novgorodov

Hello

I modified CodesDemo for test your case.
All is OK.
Please see screenshot:
You cannot see attachments on this board.

Roman Novgorodov
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

sxbug

After I used array of byte as the parameter to senddata() function, it was OK(could send these BIN data).But I don't understand why the dataprocessor after received data packets , displayed 'Timeout' error msg too?

Thanks

sxbug

Hi Roman Novgorodov
I just saw your reply. This is a great work to achieve these functions, I hope to be able to achieve,  enter values($12,$A5,$00 etc),  also enter ASC characters('ABC123abc' etc), to send information by nrcomm . It can also display hexadecimal number and character information in the memo.
Has solve the problem : the dataprocessor display timeout after received datas?

Could you pleased send me your program to learn?
Thanks

   sxbug@163.com

sxbug


Roman Novgorodov

Hi

I added the TnrDataProcessor component into CodesDemo and set packet params.
All works fine
You cannot see attachments on this board.

You can see the source and EXE in the ZIP attachment.

Possible you modified DataProcDemo and forget lear other packets. They can generate timeouts.

Roman Novgorodov
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

sxbug