Author Topic: More Strangeness from Serial Ports.....  (Read 3848 times)

GlennP

  • Frequent Contributor
  • ****
  • Posts: 141
More Strangeness from Serial Ports.....
« on: December 18, 2012, 07:03:33 am »
Hi All,

In my current quest to emmulate a PSION Workabout I have discovered several oddity's the first is that using my standard method

  if (InputData != String.Empty)
                        {
                            this.BeginInvoke(new SetTextCallback(SetText), new object[] { InputData });
                            ProcessInput();
                        }
 

I have been advised that the following:
"The BeginInvoke() method is executed when a connection occurs.  In a serial port there isn't yo udon't get a start of a connection unless some control lines are beig used.  I would eliminate the BeginInvoke() method."   I have used this method many times with out trouble or problems so I retreated to Serial Port Complete  and tried to use the Marshalling method to see if that would produce any better results  (pages 195 to 197) this gives an error. I have had a look at the example code but can't see where the Access Marshalling is taking place,  beside, the example will not get a responce from the board. This is being tricky, really tricky.

Any ideas, any one?

Glenn

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2803
    • Lakeview Research
Re: More Strangeness from Serial Ports.....
« Reply #1 on: December 18, 2012, 09:40:52 am »
Serial Ports don't have connections like TCP/IP. You don't need to use flow control with BeginInvoke.

GlennP

  • Frequent Contributor
  • ****
  • Posts: 141
Re: More Strangeness from Serial Ports.....
« Reply #2 on: December 18, 2012, 10:41:37 am »
Thats what I thought !  Once the port is open you are good to go!  I am still having this issue where I can see data coming back on a spy window but can't get it to my Form.  I have experimented with trying to use a marshal to get the data to the form. Could I be having a thread race (as was suggested else-where MSDN) as Using a spy the data comes back but is not processed by the program
would using a Martial to Access the form be an idea?   In the C# Serial Port class programs I have written I have not had to use one. ???