Reading data from the parallel port in MATLAB

3 Ansichten (letzte 30 Tage)
Rupert
Rupert am 11 Jun. 2013
I'm trying to read data from the parallel port using the data acquisition toolbox. However, the data that is being read does not update with each read. If I physically unplug and replug the parallel port cable, the value does update - once - and then stays at that value until I unplug and plug again. I checked this answer on the MATLAB forums http://www.mathworks.com/matlabcentral/answers/40042 which mentions a strobe signal, but I'm not sure how to use this. Any clarification and/or code would be greatly appreciated. Regards, Rupert

Antworten (1)

Walter Roberson
Walter Roberson am 11 Jun. 2013
And (in the simplest mode) look under "Centronics"
Data is first applied on the Parallel Port pins 2 to 7. The host then checks to see if the printer is busy. i.e. the busy line should be low. The program then asserts the strobe, waits a minimum of 1uS, and then de-asserts the strobe. Data is normally read by the printer/peripheral on the rising edge of the strobe. The printer will indicate that it is busy processing data via the Busy line. Once the printer has accepted data, it will acknowledge the byte by a negative pulse about 5uS on the nAck line.
Note though, that "asserts the strobe" corresponds to taking the bus low, not high. Look at the phase diagram labeled "Centronics Handshake"
When inexperienced people decide to use parallel ports, it is not uncommon for them to start by connecting their signal to one or more of the data lines, and to assume that is all that is needed, that the host computer will be able to sense the levels of the data pins. However, there needs to be the signal from the transmitting side to indicate that the data lines are settled and the data is safe to read; that signal is the "strobe" signal.
  2 Kommentare
Rupert
Rupert am 12 Jun. 2013
Hi Walter, Thanks for the prompt reply. The thing is, I have an a/d converter that I've hooked up to the computer via the parallel port. I'm not sure whether it is sending a strobe signal (Pin 1 is always 0) or if it is, how I'm supposed to use it. I should point out that commercial software that came with the system reads the signals without any problems.
Walter Roberson
Walter Roberson am 12 Jun. 2013
Ah... in block #5 of the a/d convertor, pin #3 needs to be shorted to the Q(z) trace, and then you have to send the {Snark} command to control register C.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Audio I/O and Waveform Generation finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by