Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Reading from the parallel port

0 views
Skip to first unread message

Dr. James Kay

unread,
Feb 19, 1998, 3:00:00 AM2/19/98
to

I am trying to write a program that will read data off the parallel port in
Wimp Basic (using a Strong Arm Risc PC) but, whatever I do, I cannot get it
to work.
Firstly, I set the direction of the parallel port:
Sys "Parallel_Op",2,&20,&1F
which appears to work.
I then try to read the data off the port, and the only two ways that I have
got it to read data (other than 0) are:
Sys "Parallel_Op",0 to ,data%,status%
and
Sys "Parallel_Op",0,a%,b% to ,data%,status%
where I am using the value of data%. My problem is that the value of data%
never changes even if I change what is on the port. I have also discovered
that what it displays is the last value read by the PC card (PC Pro v. 2.03
+ QBasic) and that if I reread the port through the PC card while running my
program, then the value of data% does change, to the value that the PC card
read.
Could anyone suggest where I am going wrong?
Alastair Kay

--

________________jand...@argonet.co.uk

John Alldred

unread,
Feb 19, 1998, 3:00:00 AM2/19/98
to

In article <na.2ed1ce481a....@argonet.co.uk>, Dr. James Kay

<jand...@argonet.co.uk> wrote:
>
> I am trying to write a program that will read data off the parallel port
> in Wimp Basic (using a Strong Arm Risc PC) but, whatever I do, I cannot
> get it to work.
> Firstly, I set the direction of the parallel port:
> Sys "Parallel_Op",2,&20,&1F
> which appears to work.

Strictly speaking, I think that last register should be &FFFFFFDF;
but your shortened version may work.

> I then try to read the data off the port, and the only two ways that I
> have got it to read data (other than 0) are:
> Sys "Parallel_Op",0 to ,data%,status%
> and
> Sys "Parallel_Op",0,a%,b% to ,data%,status%

I can't find any reference to R1 and R2 doing anything (your a%,b%).

As a matter of interest, I note you are reading the status register too;
what sort of bit pattern(s) does that contain?

> where I am using the value of data%. My problem is that the value of data%
> never changes even if I change what is on the port. I have also discovered
> that what it displays is the last value read by the PC card (PC Pro v.
> 2.03 + QBasic) and that if I reread the port through the PC card while
> running my program, then the value of data% does change, to the value
> that the PC card read.

The introduction in the RO3 PRM p 2-477 mentions the use of parallel
ports to connect two computers "back-to-back" for data transfer;
in this instance, the sending device would pulse the "/STROBE" line for
each byte sent, and the receiving computer would presumably latch data
in at each "/STROBE" pulse: have you tried waggling that line up and
down to see if that makes the port take any notice of new logic levels
on the data pins?

John


--
Decaffeinated coffee; fat-free milk; it'll be dehydrated water next!
__ ZFC: B _ www.protovale.co.uk/john/
| _ |_ _ |_||| _| _ _ _| jo...@protovale.co.uk
(_j(_)| )| ) | |||(_|| (-`(_| in and around Oxford

0 new messages