comp.lang.ada
 help / color / mirror / Atom feed
* Reading/writing LPT1
@ 2000-08-20  0:00 David Boman
  2000-08-21  0:42 ` tmoran
  0 siblings, 1 reply; 4+ messages in thread
From: David Boman @ 2000-08-20  0:00 UTC (permalink / raw)


Hi,

Does anyone know how to read /write from the parallellport in Ada? I have a
program written in Basic that modifys the some bit's on LPTx but I want to
re-write this program to Ada. Unfortunately my skills aren't big enough to
do this whitout help...:-)
Do I need any special packages, and if so, is it standard packages or do I
have to fetch them from the net?
I'm running GNAT 3.11 on Win2000.

Btw, Is there a www-based FAQ for comp.lang.ada somewhere?

Thanx
/Boman






^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Reading/writing LPT1
  2000-08-21  0:00   ` David Boman
@ 2000-08-21  0:00     ` Ted Dennison
  0 siblings, 0 replies; 4+ messages in thread
From: Ted Dennison @ 2000-08-21  0:00 UTC (permalink / raw)


In article <8nqkbn$dia$1@nyheter.chalmers.se>,
  "David Boman" <e8boman@etek.chalmers.se> wrote:
> I'm running Windows2000 on Intel.

Then you will have to do it the same way a C programmer would do it.
Either open up "LPT1:" as a file and use standard library IO routines
(In our case, probably Ada.Text_IO or Ada.Sequential_IO), or find and
make the corrent calls in Microsoft's Win32 facilities.

> I don't know if Windows2000 allows direct IO, I've heard that
> WinNT/Win2000 is quite strict with this but I'm not sure.

Yes it is. Either you use the Win32 API to change the settings, or you
write and install your own device driver.

Is this something that you are currently doing in Basic on this
platform, or are you trying to change languages and OS'es at the same
time?

If the former, then the easiest thing to do would be to figure out what
Win32 calls your Basic statements get mapped to. If the latter, then you
have really asked a Win2K question, not an Ada question (and thus should
probably take your question to a more appropriate newsgroup).

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Reading/writing LPT1
  2000-08-21  0:42 ` tmoran
@ 2000-08-21  0:00   ` David Boman
  2000-08-21  0:00     ` Ted Dennison
  0 siblings, 1 reply; 4+ messages in thread
From: David Boman @ 2000-08-21  0:00 UTC (permalink / raw)


>    I presume you are running under DOS or perhaps Windows xx or OS/2 or
> Linux on an Intel box?  So we will assume your hardware is the standard

I'm running Windows2000 on Intel.

> sort of LPT port for such a box, and your OS allows you direct IO
> operations to the port, as opposed to, say, a machine running the flight
> controls on a jet.  Since IO is so widely varied across different

I don't know if Windows2000 allows direct IO, I've heard that WinNT/Win2000
is quite strict with this but I'm not sure.

> systems, it's not included in the Ada standard.  Your compiler vendor,
> however, almost surely supplies a library that will do hardware level IO
> on your target platform.  If that's not the case, then you can a) link
> in appropriate subroutines written in asm or C or perhaps even Basic and
> call them from your Ada program, or b) use your compiler's
> implementation of standard package System.Machine_Code.  For handling
> the bits in, eg, the status result, either use a record representation
> clause to give names to individual bits or bit fields, or (more error
> prone) use type "mod 256" and do "and"s and "or"s.

This seems resonable, but will I not have the same problem here? Does
Windows2000 allow me to write Assemblercode thats messes around with the
hardware?

/Boman






^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Reading/writing LPT1
  2000-08-20  0:00 Reading/writing LPT1 David Boman
@ 2000-08-21  0:42 ` tmoran
  2000-08-21  0:00   ` David Boman
  0 siblings, 1 reply; 4+ messages in thread
From: tmoran @ 2000-08-21  0:42 UTC (permalink / raw)


>Does anyone know how to read /write from the parallellport in Ada?  I
>have a program written in Basic that modifys the some bit's on LPTx but
>I want to re-write this program to Ada.
   I presume you are running under DOS or perhaps Windows xx or OS/2 or
Linux on an Intel box?  So we will assume your hardware is the standard
sort of LPT port for such a box, and your OS allows you direct IO
operations to the port, as opposed to, say, a machine running the flight
controls on a jet.  Since IO is so widely varied across different
systems, it's not included in the Ada standard.  Your compiler vendor,
however, almost surely supplies a library that will do hardware level IO
on your target platform.  If that's not the case, then you can a) link
in appropriate subroutines written in asm or C or perhaps even Basic and
call them from your Ada program, or b) use your compiler's
implementation of standard package System.Machine_Code.  For handling
the bits in, eg, the status result, either use a record representation
clause to give names to individual bits or bit fields, or (more error
prone) use type "mod 256" and do "and"s and "or"s.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2000-08-21  0:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-08-20  0:00 Reading/writing LPT1 David Boman
2000-08-21  0:42 ` tmoran
2000-08-21  0:00   ` David Boman
2000-08-21  0:00     ` Ted Dennison

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox