how to input data from Data port of LPT ?

I am trying to interface ADC0808 through parallel port . the port 0 (data port) is configured as input port to read 8bit ADC data, while port 1 (status port ) and port 2 (Control port) are used for facilitating handshake signals.
During booting of my on HP machine under Windows XP, I have set port as 'Bidirectional' in BIOS. I wrote following code:
close all;
clear all
clc;
dio = digitalio('parallel','LPT1');
P0=addline(dio,0:7,0,'in') %DATA PORT, port no. 0 Input port
P1=addline(dio,0:4,1,'in')% STATUS PORT, port no. 1, Input port
P2=addline(dio,0:3,2,'out')% CONTROL PORT, port no. 2 Output port
hwinfo = daqhwinfo(dio);
hwinfo displayed the desired port setting with line port 0 as input, port 1 as input and port 2 as output ports.
testing the input port with >> putvalue(P0,0) gives
??? Error using ==> dioline.putvalue
correctly indicating Line(1) is configured for input.
However, when a high signal (abt +4.5 V) or low level signal (0 V) is applied to any input of port 0, the line status remains unchanged. The port 0 configured as input port is not reading the data. Why the port 0 is not accepting the input?
Ashutosh

1 Comment

You do not mention also using the strobe signal? Parallel ports only read when the strobe is detected.

Sign in to comment.

Answers (0)

Categories

Asked:

on 1 Jun 2012

Community Treasure Hunt

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

Start Hunting!