Author Topic: Receive String From RS232  (Read 3128 times)

adyble

  • Newbie
  • *
  • Posts: 10
    • View Profile
Receive String From RS232
« on: May 26, 2009, 12:29:08 pm »
Hi

I am testing then codes_demo in dephi 7. I am reading from a com port that is sending continuous data, I am trying to get the data as text , line by line , similar to how hyperterminal does it.

is there a demo for this or can you advise me please.

Thanks

Andy Dyble

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Receive String From RS232
« Reply #1 on: May 26, 2009, 01:01:28 pm »
Hello

It seems like you want to handle an incoming data separated by lines.

You can take a look the sources of following demo project:
demos\vcl\SimplePacket\SimplePacket.dpr

It monitors #13#10 char separator and raises routine after line detection.

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

adyble

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Receive String From RS232
« Reply #2 on: May 26, 2009, 07:37:10 pm »
I can't get any data using this demo, however Terminal demo works perfectly.
I just can;t work out how to extract each line of data so I can parse it

Thanks
Andy

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Receive String From RS232
« Reply #3 on: May 26, 2009, 10:35:33 pm »
Hello

Do you know end of line sequence?

Is it two chars #13#10 or single char #13 ?

In last case you need to modify sources of demo.

Please find line:

Code: [Select]
EndOfPacket:string=#13#10;and replace it with:
Code: [Select]
EndOfPacket:string=#13;
Please note that you are wrong:
The Hypertemrinal does not detect lines.
It shows every char.
And when it receives #13, it moves the caret on new line.

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

KarpovSergei

  • Guest
Receive String From RS232
« Reply #4 on: September 04, 2009, 04:20:43 pm »
I bound as tranceiver and I can receive message from the SMSC like QuerySm but the problem is that I cannot receive on the short code like "1234" provision for me on the smsc.

How can I achieve that. Just to receive from short code, since I can received delivery message from my smsc already.

Any help will be appreciated.

Thank you

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Receive String From RS232
« Reply #5 on: September 09, 2009, 04:09:44 am »
Hello

I don't understand your problem.
Please show more samples of string from remote clinet.

You can detect packet (string) if you are sure that:
1) String has a fixed length
OR
2) String has a fixed char sequence at the end (or at the begining)

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