Parallel Port to fire pins

J

Jose

Hello:
I've been trying to use a serial port to fire pins connected to a electronic
device using RTS and DTR lines but it's too slow in Windows CE.
So I would like to test using a parallel port, but I can't find information
about that.
How can I fire a specific data line of parallel port in Compact Framework?
Where I can find information about that?

Thanks in advance
Best regards
 
P

Paul G. Tobey [eMVP]

Does your device even have a parallel port? What device are we talking
about? If serial changes to the RTS and DTR lines are too slow, there's no
reason to suspect that parallel would be any different.

Have you tried this in unmanaged code? That has more potential to work
better than switching port types...

Paul T.
 
A

Alex Feinman [MVP]

I agree. Your basic parallel port is no faster than serial. It's just wider.
The OP is probably running into code latency.
 
J

Jose

Thanks for your answer, Paul:
This is not a device with a parallel port. It's a leds panel that has a
three input lines controlled by electric pulses. We would like to control
the leds panel using a micropc with windows ce, using a serial or parallel
port.
I decided to play this way: one to send the data (RTS), another one to use
it as a data clock (DTR) and another one when the data frame has finished
(Tx with bit stop). It works fine, but it is not quick enough
Using RTS and DTR lines I got about 50.000 pulses per second using a PC and
unmanaged code, worse in a Windows CE. I need to achieve about 100.000
pulses per second.

Any suggestion would be very apreciated

Best regards
 
J

Jose

Hello:

Maybe the code for serial port can help. This is the method I'm using to
send the information to the panel. It spends about 62ms to send 2560 pulses.
It's to slow. How can accelerate it?

Best regards

Public Function ExecuteMatrix(ByVal matrix As Boolean()())
If mhRS.ToInt32 > 0 Then
Dim i As Integer
For i = matrix.Length - 1 To 0 Step -1
Dim j As Integer
For j = 15 To 0 Step -1
//activate clock
EscapeCommFunction(mhRS, Lines.SetRts)
If matrix(i)(j) Then
EscapeCommFunction(mhRS, Lines.SetDtr)
Else
EscapeCommFunction(mhRS, Lines.ClearDtr)
End If
//deactivate clock
EscapeCommFunction(mhRS, Lines.ClearRts)
Next
Next
EscapeCommFunction(mhRS, Lines.SetRts)
End If
End Function
 
C

Chris Tacke, eMVP

See if your device has a processor GPIO available to the outside and then
write native code around that. You can get very good speed around that (I
wrote a JTAG programmer off a couple SA1110 GPIOs a while back and was
surprised at the throughput).

-Chris
 
D

Dick Grier

That's probably about at fast as you can get in managed code. (20-30
microseconds per loop isn't that unreasonable).

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004.
 
P

Paul G. Tobey [eMVP]

I understand that the external device doesn't have a parallel port, but does
the *Windows CE device* have one? You still have not told us what device it
is...

Whoa! You got 1/2 of the target throughput using a PC and unmanaged code
(which is 100 times faster than your Windows CE device), and you're
expecting managed code and Windows CE to *outperform* that? You have zero
chance of getting that to work.

As Chris suggests, if you can write a Windows CE driver to talk directly to
the general-purpose I/O on your device, you may be able to do this
throughput.

Paul T.
 
J

Jose

Hello:
The device I want to use is
http://www.microcomputersystems.com/msi_1042.htm, and it has a parallel
port.
But as you say, if I'm not doing something wrong, I don't have any
possibility to achive my target in Windows CE using a serial or parallel
port.
Maybe I will look for another micropc with general-purpose I/O. Any
suggestion?

Thank you very much to everybody for your help.
 
P

Paul G. Tobey [eMVP]

Sorry. It's a 386. It's more than 100 times slower than your PC. You will
not be able to achieve those speeds using the serial port outputs via a
standard driver from managed code under Windows CE on that device. Parallel
port or serial port is irrelevant. The time it takes to get from your
managed code running in the CLR through the device manager, into the driver
and to the point where it performs the handshake signal change is longer
than you have. You need other hardware and a well-written driver for it.
Maybe a digital I/O card on the PC/104 bus and a driver that was written to
take the total pattern that you want to write in a single WriteFile() call
would be able to do that. You could test whether that's possible or not by
bit-banging the hardware directly from DOS running on your target platform.
If that can't do it, don't expect Windows CE to succeed.

Paul T.

Jose said:
Hello:
The device I want to use is
http://www.microcomputersystems.com/msi_1042.htm, and it has a parallel
port.
But as you say, if I'm not doing something wrong, I don't have any
possibility to achive my target in Windows CE using a serial or parallel
port.
Maybe I will look for another micropc with general-purpose I/O. Any
suggestion?

Thank you very much to everybody for your help.


Paul G. Tobey said:
I understand that the external device doesn't have a parallel port, but
does the *Windows CE device* have one? You still have not told us what
device it is...

Whoa! You got 1/2 of the target throughput using a PC and unmanaged code
(which is 100 times faster than your Windows CE device), and you're
expecting managed code and Windows CE to *outperform* that? You have
zero chance of getting that to work.

As Chris suggests, if you can write a Windows CE driver to talk directly
to the general-purpose I/O on your device, you may be able to do this
throughput.

Paul T.

Jose said:
Thanks for your answer, Paul:
This is not a device with a parallel port. It's a leds panel that has a
three input lines controlled by electric pulses. We would like to
control the leds panel using a micropc with windows ce, using a serial
or parallel port.
I decided to play this way: one to send the data (RTS), another one to
use it as a data clock (DTR) and another one when the data frame has
finished (Tx with bit stop). It works fine, but it is not quick enough
Using RTS and DTR lines I got about 50.000 pulses per second using a PC
and unmanaged code, worse in a Windows CE. I need to achieve about
100.000 pulses per second.

Any suggestion would be very apreciated

Best regards


"Paul G. Tobey [eMVP]" <ptobey no spam AT no instrument no spam DOT com>
escribió en el mensaje Does your device even have a parallel port? What device are we talking
about? If serial changes to the RTS and DTR lines are too slow,
there's no reason to suspect that parallel would be any different.

Have you tried this in unmanaged code? That has more potential to work
better than switching port types...

Paul T.

Hello:
I've been trying to use a serial port to fire pins connected to a
electronic device using RTS and DTR lines but it's too slow in Windows
CE.
So I would like to test using a parallel port, but I can't find
information about that.
How can I fire a specific data line of parallel port in Compact
Framework?
Where I can find information about that?

Thanks in advance
Best regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top