Discussion:
How to monitor parallel port data of win 3.1 system
(too old to reply)
Aro
2008-02-04 15:40:08 UTC
Permalink
We have an old PC running Windows 3.1 and a measurement software which communicates with an external device through the parallel port. How can we monitor the parallel port data send and received between the PC and the device. The device is a vision system not a printer!!
Most software based monitors will not work on the Win 3.1 system. Do any one here have any idea as how to go about doing this?
 
Regards,
Aro
2008-03-24 17:10:06 UTC
Permalink
Hi nqn827,
 
Before testing with the win 3.1 system, we tried to do some test on two win xp system
We used a cable with following connection:
Data Port 1 - Data Port 2
Status Port 1 - Control Port 2
Control Port 1- Status Port 2
 
to connect the parallel ports (1 & 2) of two windows xp system. One is a PC and the other is a laptop.
Ran an application on both sides. On the PC side we monitor all the registers and on the laptop side, we try to write some data to the data port.
The problem is both the PC and laptop try to control the data port. So we couldn't monitor the data written at the laptop side from the PC side. For e.g. laptop side writes 0x22 to data port, the laptop side data register will show 00100010, the PC side is not able to see this. It always reads its data register as 11111111 which is the value at power up.
 
Am I missing on some basics? Do you have any suggestion?
Aro
2008-04-23 16:10:08 UTC
Permalink
Hi KC, nqn827
I followed you guys' advice to monitor the data transferred between the host PC (win 3.1) and the peripheral (vision system).
The setup is like this. My monitor PC (win xp) has two parallel ports - port1, port2. Both are PS/2. Port1 is connected to host PC's i/o port using a cross over cable whose connection is in the code attached. Port2 is connected to the peripheral's i/o port using straight through 25 pin cable. Wrote a monitor program to read port1 and port2 and send the status byte from peripheral to host PC and the control byte from host PC to the peripheral. The data byte is copied from port 1 to port 2 or the other way based on the host PC's strobe bit. If the strobe bit is 1 (signal is low), data byte of port1(c5=1, data is input) is copied to port2(c5=0, data is output) and vice versa.
The mechanism works partially. When the software on host PC starts, it send the contents of a known file to the peripheral using proper handshake "compatibility mode" as confirmed from my monitor's log. After the file is downloaded, it expect to receive something back from the peripheral. For some reason, this is not happening. So the software on host PC reports, "download complete but device failed to start" and quit running. The communication is definitely slowed down by this mechanism, but I don't understand why the peripheral fails to send data back to the host PC. Do anyone know what I am doing wrong here?
The program use publicly available "inpout32.dll" to read and write to parallel ports and is attached.
Thanks...


monitor_code1.txt:
http://forums.ni.com/attachments/ni/70/8724/1/monitor_code1.txt
O_Proulx
2008-04-24 21:10:08 UTC
Permalink
Hello again Aro, I think the first thing we need to do is narrow down the problem:&nbsp; Are you sure the peripheral is receiving the entire file?&nbsp; Then, are you sure that it is replying properly when the file is done?&nbsp; Then, are you sure the monitor PC is receiving this signal?&nbsp; Is it passing it properly to the other port?&nbsp; If we go down this chain, I think we can find where the trouble is.On a seperate track, it seems like you could implement this system very easily with a digital IO card.&nbsp; I know it may be a little late now, and I know you have mentionned it before, but here are a few links for NI digital IO boards you can use in <a href="http://sine.ni.com/nips/cds/view/p/lang/en/nid/14540" target="_blank">PCI</a> or <a href="http://sine.ni.com/nips/cds/view/p/lang/en/nid/205180" target="_blank">USB </a>format.&nbsp; You can also look at the <a href="http://www.ni.com/dataacquisition/" target="_blank">data acquisition page</a> for many more options.&nbsp; These are very easy to use from LabVIEW and LabWindows/CVI. Please let me know if you need more help with any of this.&nbsp; Have a great day.
K C
2008-04-25 06:40:11 UTC
Permalink
Hi Aro,
Can you provide more info ?
Like the program (LV I hope) you use. A despription of the protocol. etc.
O_Proulx
2008-04-28 21:10:11 UTC
Permalink
Hello Aro,You wrote:The
peripheral is receiving the file from the log below which shows the
handshake between host PC (CONTROL1) and peripheral (STATUS2). When
host set strobe bit c0=1 (CONTROL1) at port1, my monitor set c5=1 at
port1 and c5=0 at port2 and copy DATA1 to DATA2 so that the character
'S' set by host appear at the peripheral. The peripheral whose busy bit
s7=1 (STATUS2) till now change to s7=0. Seing that s7=0, host set
strobe bit c0=0 (CONTROL1). The peripheral by now have read 'S' from
DATA2 sets s7=1 (STATUS2) again ready for the next byte of data. The
host continues to send the next byte.Should it be:When
host set strobe bit c0=1 (CONTROL1) at port1, my monitor set c5=1 at
port1 and c5=0 at port2 and copy DATA1 to DATA2 so that the character
set by host appear at the peripheral. The peripheral keeps the bit
s7=0 (STATUS2) until it is done reading the data.&nbsp; When it is done reading the data, it change to s7=1. Seing that s7=0, the monitor sets bit c0=0 (CONTROL1). The host sees that c0=0, knows that the monitor (and peripheral) are ready for more data.Am I understanding this process right?
Aro
2008-04-28 22:10:07 UTC
Permalink
Hi O_Proulx,
For&nbsp;the parallel port, the control lines c0..c3 are physical TTL lines controlled by the PC&nbsp;which can be seen at the printer side. Rest of the lines c4..c7 are internal register entries set by PC/printer for their respective ports. Similarly the status lines s3..s7 are physical TTL lines controlled by the printer&nbsp;which can be seen at the&nbsp;PC side and&nbsp;rest of the lines are internal register entries&nbsp;set by printer/PC&nbsp;for their ports. All data lines d0..d7 are physical TTL lines. For PS-2 type bi-directional parallel ports, the data lines can be set as input or output with respect to the PC by setting PC's control register bit c5.&nbsp;At PC side if we set c5=1, then the data lines become input to PC port. Any software on the PC if it reads the data lines will see the value set by printer and vice versa if host PC set c5=0.
In connection 1 from host PC to port1 of monitor PC, strobe bit c0 can&nbsp;only be&nbsp;set by host PC. It cannot be set by monitor PC because this c0 (pin1) voltage from host PC's port will appear at s6 (pin10) of the monitor PC's port 1 as we are using a cross over cable. From monitor PC port1's point of view the host PC is a printer and vice versa.
&nbsp;
O_Proulx
2008-04-29 16:40:10 UTC
Permalink
Hello again Aro, I apologize for the constant back and forth here, but I am trying to fully understand the details of your application and trying to narrow down where the problem is exactly occurring.How is the monitor PC signaling to the device that there is no more data available?
Aro
2008-04-29 16:40:11 UTC
Permalink
Hi O_Proulx,
From my monitor log, it looks like the first 700 lines of communication exactly matches the contents of a file in the host PC which the software is reading and sending to the peripheral. At the end of transmission it send "G1000". The last character '0' is shown in&nbsp;the log snippet&nbsp;I posted before. At 11:08:41, host PC send the last '0', after which there seems to be no more activity neither from host nor from the peripheral. My monitor ran till the host software came up with the error "file downloaded but device wouldn't start" and quits.
regards
Aro
2008-04-29 19:40:16 UTC
Permalink
Hi O_Proulx,
In another thread few weeks back, Nick F. had suggested me to try using hardware timed capture DAQ device. We had earlier bought the NI USB 6501 which&nbsp;use software timed capture, so could not log all information because windows limits the speed of capture to&nbsp;every 1 or 1.5 ms whereas the parallel port events are usually in microseconds range.
I want to know if the NI PCI-6250 can be used to monitor parallel port events with sufficient speed. The&nbsp;parallel port event like strobe will last for minimum 0.75 us. We need to monitor 8 data, 4 control and&nbsp;5 status lines (17 lines in total). The&nbsp; PCI-6250 spec says it has 24 DIO channels, hardware timing, max clock rate of 10 MHz. So if we use this device with the NI labview express software, can it&nbsp;record all parallel port events(&gt;=0.75 us) for a duration of 5 minutes or more and generate a log file?
regards,
O_Proulx
2008-05-01 15:40:12 UTC
Permalink
Hello Aro, The 6250 will not work because there are only 8 hardware (correlated) DIO line on it.&nbsp; I suggest an <a href="http://sine.ni.com/nips/cds/view/p/lang/en/nid/13505" target="_blank">NI-6534</a>, which is a Digital IO board (in comparison to a multifunction DAQ).&nbsp; It has 32 hardware timed DIO lines clocked at 20Mhz.&nbsp; I think this is will help you do what you want. Let me know if you have any questions.&nbsp; Have a great day.
Aro
2008-04-25 14:10:12 UTC
Permalink
Hi O_Proulx, KC
The program is attached to my last post. The peripheral is receiving the file from the log below which shows the handshake between host PC (CONTROL1) and peripheral (STATUS2). When host set strobe bit c0=1 (CONTROL1) at port1, my monitor set c5=1 at port1 and c5=0 at port2 and copy DATA1 to DATA2 so that the character 'S' set by host appear at the peripheral. The peripheral whose busy bit s7=1 (STATUS2) till now change to s7=0. Seing that s7=0, host set strobe bit c0=0 (CONTROL1). The peripheral by now have read 'S' from DATA2 sets s7=1 (STATUS2) again ready for the next byte of data. The host continues to send the next byte.
10:48:16, CONTROL1 = (00001101); STATUS1 = (11011000); DATA1 = 255 {ÿ} (11111111) CONTROL2 = 36 (00100100); STATUS2 = 216 (11011000); DATA2 = 255 {ÿ} (11111111)10:48:16, CONTROL1 = (00101101); STATUS1 = (11011000); DATA1 = 83 {S} (01010011) CONTROL2 = 13 (00001101); STATUS2 = 88 (01011000); DATA2 = 255 {ÿ} (11111111)10:48:16, CONTROL1 = (00101100); STATUS1 = (01011100); DATA1 = 83 {S} (01010011) CONTROL2 = 13 (00001101); STATUS2 = 88 (01011000); DATA2 = 83 {S} (01010011)10:48:16, CONTROL1 = (00001100); STATUS1 = (01011000); DATA1 = 83 {S} (01010011) CONTROL2 = 44 (00101100); STATUS2 = 216 (11011000); DATA2 = 255 {ÿ} (11111111)10:48:16, CONTROL1 = (00001101); STATUS1 = (11011000); DATA1 = 255 {ÿ} (11111111) CONTROL2 = 44 (00101100); STATUS2 = 216 (11011000); DATA2 = 255 {ÿ} (11111111)10:48:16, CONTROL1 = (00101101); STATUS1 = (11011000); DATA1 = 48 {0} (00110000) CONTROL2 = 13 (00001101); STATUS2 = 88 (01011000); DATA2 = 255 {ÿ} (11111111)10:48:16, CONTROL1 = (00101100); STATUS1 = (01011100); DATA1 = 48 {0} (00110000) CONTROL2 = 13 (00001101); STATUS2 = 88 (01011000); DATA2 = 48 {0} (00110000)10:48:16, CONTROL1 = (00001100); STATUS1 = (01011000); DATA1 = 48 {0} (00110000) CONTROL2 = 44 (00101100); STATUS2 = 216 (11011000); DATA2 = 255 {ÿ} (11111111)10:48:16, CONTROL1 = (00001101); STATUS1 = (11011000); DATA1 = 255 {ÿ} (11111111) CONTROL2 = 44 (00101100); STATUS2 = 216 (11011000); DATA2 = 255 {ÿ} (11111111)
At the end of transmission
11:08:41, CONTROL1 = (00001101); STATUS1 = (11011000); DATA1 = 255 {ÿ} (11111111) CONTROL2 = 44 (00101100); STATUS2 = 216 (11011000); DATA2 = 255 {ÿ} (11111111)11:08:41, CONTROL1 = (00101101); STATUS1 = (11011000); DATA1 = 48 {0} (00110000) CONTROL2 = 13 (00001101); STATUS2 = 88 (01011000); DATA2 = 255 {ÿ} (11111111)11:08:41, CONTROL1 = (00101100); STATUS1 = (01011100); DATA1 = 48 {0} (00110000) CONTROL2 = 13 (00001101); STATUS2 = 88 (01011000); DATA2 = 48 {0} (00110000)11:08:41, CONTROL1 = (00001100); STATUS1 = (01011000); DATA1 = 48 {0} (00110000) CONTROL2 = 44 (00101100); STATUS2 = 216 (11011000); DATA2 = 255 {ÿ} (11111111)11:08:41, CONTROL1 = (00001100); STATUS1 = (11011000); DATA1 = 255 {ÿ} (11111111) CONTROL2 = 44 (00101100); STATUS2 = 216 (11011000); DATA2 = 255 {ÿ} (11111111)11:08:41, CONTROL1 = (00001100); STATUS1 = (11011000); DATA1 = 255 {ÿ} (11111111) CONTROL2 = 44 (00101100); STATUS2 = 216 (11011000); DATA2 = 255 {ÿ} (11111111)11:08:41, CONTROL1 = (00001100); STATUS1 = (11011000); DATA1 = 255 {ÿ} (11111111) CONTROL2 = 44 (00101100); STATUS2 = 216 (11011000); DATA2 = 255 {ÿ} (11111111)11:08:41, CONTROL1 = (00001100); STATUS1 = (11011000); DATA1 = 255 {ÿ} (11111111) CONTROL2 = 44 (00101100); STATUS2 = 216 (11011000); DATA2 = 255 {ÿ} (11111111)
After host send last character '0', nothing happens on CONTROL1 or STATUS2. It stays the same. Notice that c5=0 (CONTROL1) meaning port 1 data is now output and c5=1 (CONTROL2) meaning port2 data is input. Also host's strobe c0=0(CONTROL1), so it is ready to receive. All bits at all register stays the same for ever and host software displays error that file downloaded but peripheral wouldn't start. Message Edited by Aro on 04-25-2008 09:07 AMMessage Edited by Aro on 04-25-2008 09:09 AM
Loading...