Reading data from the parallel port in MATLAB

조회 수: 3 (최근 30일)
Rupert
Rupert 2013년 6월 11일
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

답변 (1개)

Walter Roberson
Walter Roberson 2013년 6월 11일
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
Rupert
Rupert 2013년 6월 12일
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 2013년 6월 12일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by