So I'm using port talk (http://retired.beyondlogic.org/porttalk/porttalk.htm) on windows 7 to really simply set/unset pins on a parallel port via some c code.

I've plugged in an oscilloscope to ground and one of the data pins, and setting it high, waiting a second, setting it low, waiting a second, etc...

On the oscilloscope, I'm seeing a like, millisecond pulse up when I set the pin high (then it sets at 0 for the rest of the second), and then seeing a millisecond pulse down when I set the pin low (after which it again sets at 0 for the rest of the second).

So, I first assumed I was using the API to set/unset the pins wrong or something, so I tried just constantly setting the pin high as often as possible (probably hundreds of times per second) for a second, then setting it low as often as possible for a second, etc... and the output on the oscilloscope was exactly the same (that is, really quick high blip when it first gets set high, then really quick low blip when it first gets set back to low).

Still not sure what was going on, I tried just setting it high, waiting a second, then setting it high again, etc..., and the behavior I was getting was, the first time I set it high, I saw a blip on the oscilloscope, but then each subsequent "set high" was totally invisible to the oscilloscope.

So, I'm assuming from the computer's perspective, it thinks the pin is just constantly high from the point I "set high" forward (and ditto for low). I'm admittedly pretty ignorant when it comes to electrical engineering and the like- is this indicative of anything particularly obvious? Like, I'm reading the oscilloscope wrong, or I have it wired in such a way that the pulse is or isn't getting correctly routed from one place to another? Is there some protocol to dealing with a parallel port where I can't just treat it as high and low pins?

Another odd point- for debugging, I just set all 8 data pins to high and low at a time. But depending where I plugged the oscilloscope, the higher # pin seemed to generate a bigger pulse... is that just a quirk of "the spec just says it has to be above some threshhold", or is that also indicative of me wiring it up wrong?

Any direction or help would be greatly appreciated!

  • 2
    \$\begingroup\$ Are you using AC or DC coupling on your oscilloscope? \$\endgroup\$ – Dave Tweed Nov 3 '16 at 21:35
  • 1
    \$\begingroup\$ First, double check your scope if it can correctly sense any DC voltage. Take a AA battery cell, and see if you can read a constant DC at about 1.5V on scope screen. \$\endgroup\$ – Ale..chenski Nov 3 '16 at 22:05

That very definitely sounds as if you have your scope input set to AC coupling.

When you set the pin High, the scope will show a brief high, which will decay to a low as the scope's input capacitor charges. With a suitable sweep rate, you should see a fast rise, followed by a slow return to zero.

When you then set the pin Low, the scope is already showing zero due to the charged input capacitor. The charged input capacitor will rapidly push the scope trace below zero to follow the changing input voltage, then the capacitor will slowly discharge, allowing the trace to go back to zero.

Set the scope input coupling to DC to bypass the input capacitor, and you should see the expected square wave.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.