Serial Port programming with OpenNetCF Question

  • Thread starter Thread starter Jason Jacob
  • Start date Start date
J

Jason Jacob

To all,

I've used the OpenNetCF classes to build a demo program to test serial
port communication, but somehow I don't really know how to send data
since the example I've got is only how to receive data.

Questions:
1) can I really write such a demo program using the VS.Net Emulator ??
Since I've read quite a no. of forums complaining Serial Port is not
working on Emulators
2) if I want to send data, I should use "Port.Output = new byte[]{11,
12.....}" and it will invoke the delegate /event for data receiving
???
3) as from the example program, I should use "Port.Input" to receive
the byte[] sent by the Tx side ???
4) How can I know the communication is in half or full duplex ??
(actually can I set 1/2 or full duplex ??)

Thanks!

From Jason (Kusanagihk)
 
1) can I really write such a demo program using the VS.Net Emulator ??
Since I've read quite a no. of forums complaining Serial Port is not
working on Emulators

In theory it's supposed to work. I've never had luck with it, but never
tried hard because I prefer using a device.
2) if I want to send data, I should use "Port.Output = new byte[]{11,
12.....}" and it will invoke the delegate /event for data receiving
???

Yes, set the Output property to send. You don't get a receive event when
sending.
3) as from the example program, I should use "Port.Input" to receive
the byte[] sent by the Tx side ???
yes.

4) How can I know the communication is in half or full duplex ??
(actually can I set 1/2 or full duplex ??)

full or half simply means if data is going both directions at the same time
or not - the driver may or may not support it, but to the app it's largely
irrelevent.
 
Hi,

What Chris said... Except, half-duplex has meaning (AFAIK), only for RS-485
adapters. With these you "may" have to use RTS true to set transmit mode on
the adapter, and RTS false to enable receive mode. Also, you would observe
CTS to see if some other device was attempting to transmit (so you can wait
until it is finished). Also, there may be some timing issues that have to
be handled. I have a much more detailed description of these things in my
book. See below.

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 3rd
Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
 
To all,

Thanks for your help.

I've got another related question, I tried to deploy the program to
the Device through VS.Net Ide, but it keeps on saying deployment error
(In the ActiveSync 3.7.1, it displays that "Your device is not found")
But I've connected a com port of my PC to another com port on the
WinCE device already, and still ActiveSync can't find my device....

So is it necessary to install ActiveSync on the WinCE Device also ???
Or actually, how can I check if the WinCE has AutoSync functionality
???

From Jason (Kusanagihk)
 
To Paul

There is an error message when I try to start repllog (error no. is 608)
Looks like ActiveSync is not available.....

From Jason (Kusanagihk)
 
Hmmm. Well, I don't see documentation for that error code anywhere, which
leads me to believe that it *is* there, but is not configured correctly.
I've previously posted a step-by-step list of things to do to get AS over
serial working on Windows CE devices. You should probably find that message
and make sure that you've done everything. Here's a link for searching the
Windows CE programming newsgroups (other than this one):

http://groups.google.com/groups?hl=en&group=microsoft.public.windowsce

If you search on something like "Paul t. repllog step" or something like
that, you'll probably find it.

Paul T.
 
To Paul,

Thanks for your advice first, but actually I can't find your
"step-by-step" post.

And from some other posts, I found that the device must have tapi, and
I've asked my colleaque -- seems like tapi is not included in the
platform.......

Actually, I've troubles in deciding which components should be packed
into the platform (never thought of excluding tapi may remove
ActiveSync functionality as well...!?)

Thanks

From Jason (Kusanagihk)
 
Excluding Tapi doesn't exclude ActiveSync - it excludes Unimodem, which
effectively excludes serial ports. ActiveSync is still usable through USB
and Ethernet at that point.

-Chris
 
Back
Top