Author Topic: OnDataSend not workin  (Read 1563 times)

moelski

  • Full Member
  • ***
  • Posts: 122
    • View Profile
OnDataSend not workin
« on: April 21, 2011, 05:04:56 am »
Hi Roman,

I´m just trying to get my RS485 stuff working but I think there is another problem.
I placed some code in the eventhandler for OnDataSend:
Code: [Select]
        private void nrComm1_OnDataSent(object sender, EventArgs e)
        {
         //   Thread.Sleep(100);
            nrComm1.SetStateDTR(true);
        }

I set a breakpoint on SetSta..... in VS2010. If I send some data the compiler don´t stop there ...

And my Device monitor Studio tells me nothing about setting DTR:
Quote
091010: Write Request (DOWN), 21.04.2011 07:01:07.541 +0.003
Buffer size: 0x7 bytes
 30 31 3E 3F 40 41 30                              01>?@A0
091012: I/O Request (DOWN), 21.04.2011 07:01:09.145 +1.603
IOCTL_SERIAL_CLR_DTR: Clear DTR

091013: I/O Request (UP), 21.04.2011 07:01:09.145 +0.0
IOCTL_SERIAL_CLR_DTR: Clear DTR

091014: Write Request (DOWN), 21.04.2011 07:01:09.145 +0.0
Buffer size: 0x7 bytes
 30 31 3E 3F 40 41                                 01>?@A

So I think the eventhandler is never used after data send  :(
« Last Edit: April 21, 2011, 05:54:03 am by moelski »

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: OnDataSend not workin
« Reply #1 on: April 21, 2011, 12:42:22 pm »
Hello

Please download newest release 3.3.0.12
Now OnDataSend works more correctly.

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.

moelski

  • Full Member
  • ***
  • Posts: 122
    • View Profile
Re: OnDataSend not workin
« Reply #2 on: April 22, 2011, 04:31:27 am »
Hi !

I´m sorry to say that but it´s not working.

The eventhandler is set:
this.nrComm1.OnDataSent += new System.EventHandler(this.nrComm1_OnDataSent);

Port is configured:
Code: [Select]
            nrComm1.Protocol = StreamProtocol.None;
            nrComm1.RS485Mode = RS485Modes.DTRLow;
            nrComm1.Active = !nrComm1.Active;
            nrComm1.Parity = Parity.Even;

Eventhandler is present:
Quote
        private void nrComm1_OnDataSent(object sender, EventArgs e)
        {
         //   Thread.Sleep(100);
            MessageBox.Show("OnDataSend");
            nrComm1.SetStateDTR(true);
        }

And nothing happens after sending Data.

 :o

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: OnDataSend not workin
« Reply #3 on: April 24, 2011, 03:52:48 am »
Hello

It's strange.
OnDataSend event works correctly on our machines.

We tested following code:

        private void nrComm1_OnDataSent(object sender, EventArgs e)
        {
            Debug.WriteLine("Buffer is empty ... ");
        }

Please check that you installed newest version of nrComm Lib.

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.

moelski

  • Full Member
  • ***
  • Posts: 122
    • View Profile
Re: OnDataSend not workin
« Reply #4 on: April 24, 2011, 06:15:46 am »
Hi Roman,

Quote
It's strange.
Indeed...

How can I check the version? I´ve downloaded the latest installer and it was 3.3.0.12.
I uninstalled the previous release and installed the new one.


Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: OnDataSend not workin
« Reply #5 on: April 24, 2011, 06:21:29 am »
Hello

Yes, this version is correct.

Please check that MonitorThreadMode has Enable value.

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.

moelski

  • Full Member
  • ***
  • Posts: 122
    • View Profile
Re: OnDataSend not workin
« Reply #6 on: April 24, 2011, 12:11:09 pm »
Hi Roman,

Quote
MonitorThreadMode has Enable value
Ok that works. But it´s hard to understand why this option has to be set.
The help file is actually only describing the function but don´t give any additional hints like this one.

When do you think the helpfile is as useful as the Delphi one?

Greetz
   Dominik

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: OnDataSend not workin
« Reply #7 on: April 24, 2011, 12:26:43 pm »
Hello

Yes, you are right. Included context help is poor.


My English is bad but I try to explain more details about this property.

MonitorThreadMode controls internal nrComm component thread.
This thread monitors state of serial port (data receiving, signal changes, buffer empty etc.)
If something happens, thread calls needed event (delegate) and calls internal methods for change states of assigned terminals or data processor components.
Thread can be enabled or disabled.
In auto mode, thread will be enabled only if terminal or data processor is assigned to nrComm.

We will try to add more description into library documentation.

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.

moelski

  • Full Member
  • ***
  • Posts: 122
    • View Profile
Re: OnDataSend not workin
« Reply #8 on: April 24, 2011, 12:31:58 pm »
Hi !

Quote
My English is bad
Even if your english is bad ... That exlanation would be ok for most users  ;)
btw. My english is not better  ;D

Quote
We will try to add more description into library documentation.
That would be really great. Just some basic examples with a little bit of information.
It´s enough for the most things.