Author Topic: How enable "Send line ends with line feeds"  (Read 4142 times)

_Dejan_

  • Newbie
  • *
  • Posts: 8
    • View Profile
How enable "Send line ends with line feeds"
« on: March 27, 2008, 07:07:47 am »
Hi Roman,
I have little problem with my new program(For programming GPS device).
If I would like receive any data on Terminal(Included in Windows XP) I must in settings on ASCII setup check next two boxes:
-send line ends with line feeds
-Echo typed characters locally

For "Echo typed characters locally" Im set TerminalEcho to True. How can I enable "send line ends with line feeds"? Because when I connect to serial port I don't receive any response from device... Do you have any solution?
I have nrComm Lib v.7.27 VCL
Thanks for your help.

Bye, _Dejan_

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: How enable "Send line ends with line feeds"
« Reply #1 on: March 27, 2008, 09:24:33 am »
Hi Dejan

Possible I don't understand you correctly. Please see my comments after yours:

Quote
How can I enable "send line ends with line feeds"?

When you press <Enter> in terminal control the #13 char is sent to serial port. If you want to send any additional chars you can handle the OnKeyPress (or OnKeyDown etc.) event of terminal control and call TnrComm.SendChar(..) method from this event directly.

Quote
Because when I connect to serial port I don't receive any response from device...

I see that you don't have any reply from device. The reason of this problem can be various:

1) The serial port settings are wrong. Please verify baud rate, parity, byte size and etc.
2) Verify TnrComm.StreamProtocol proeprty. Usual it should have the spHardware value.
3) Remote device needs a some initialization action. Maybe it waits specific command or specific changes of control lines.
4) Possible device sends data in unreadable format (invisible ASCII chars). You can use "\demos\Codes" demo project for monitor incoming bytes. It shows decimal/hex codes of all incoming bytes.

Please read manual or specification description for your GSM device.

By the way. TnrComm.TermianlUsage property should have tuBoth value.

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

_Dejan_

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: How enable "Send line ends with line feeds"
« Reply #2 on: March 27, 2008, 12:47:43 pm »
Hi first thanks for quick answer.
I will try explain with pictures what I need.
In Hyper terminal I can connect to GPS device but only with this settings:




With red color Im mark what I must have checked if I want receive any response from device. So if I don't have marked this I don't receive any response...
Im try few demos(serialportinfo, codes_demo, signals_demo) and connect to device but I don't receive any response...
My application have MainForm and DataModule1
-----------------------------------------------------
In Mainform I have:

Terminal: TMemo;
GeneralButtonConnect: TButton;
GeneralButtonSend: TButton;



On GeneralButtonConnectClick event I connect to Serial port.

On GeneralButtonSendClick event I send string to Serial port
DataModule1.COM.SendString('&GPS');
---------------------------------------------------
In DataModule1 I have:
COM: TnrComm;

Setings for COM:
Terminal:=MainForm.Terminal
ComPort:=cpCOM3
ComPortNo:=3
EventChar:=#0
Parity:=pNone
RS485Mode:=False
StopBits:=sbOne
StreamProtocol:=spNone (Im try spHardware too)
TerminalEcho:=True
TerminalUsage:=tuBoth
Both Buffer:=4096

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: How enable "Send line ends with line feeds"
« Reply #3 on: March 27, 2008, 06:03:40 pm »
Hi Dejan

Please create OnKeyPress event for TMemo terminal control and add the following code:

procedure TForm1.Memo1KeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then nrComm1.SendChar(#10);
end;

Also there is another way. You can use TnrTerminal control from nrComm Lib. Set its TnrTerminal.EnterKey property to ekCRLF.

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

_Dejan_

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: How enable "Send line ends with line feeds"
« Reply #4 on: March 28, 2008, 06:11:20 am »
Roman thanks for quick solution, now work  ;D