comp.lang.ada
 help / color / mirror / Atom feed
* Parallel port
@ 2000-03-05  0:00 Philippe Bourzeix
  2000-03-05  0:00 ` Tarjei Tj�stheim Jensen
  2000-03-05  0:00 ` Jerry van Dijk
  0 siblings, 2 replies; 24+ messages in thread
From: Philippe Bourzeix @ 2000-03-05  0:00 UTC (permalink / raw)


I would like to access to my parallel port.
To read and write in the register 16#378, 16#379, 16#37A

But i have no idea how to do it.

I have started something like that but it doesn't work :

type reg is new integer;
for reg'size use 8; --register is 8 bits
type regptr is access all reg
for reg'address use 16#378#;

I need help ...








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

* Re: Parallel port
  2000-03-05  0:00 Parallel port Philippe Bourzeix
@ 2000-03-05  0:00 ` Tarjei Tj�stheim Jensen
  2000-03-05  0:00 ` Jerry van Dijk
  1 sibling, 0 replies; 24+ messages in thread
From: Tarjei Tj�stheim Jensen @ 2000-03-05  0:00 UTC (permalink / raw)




Philippe Bourzeix wrote:

> I would like to access to my parallel port.
> To read and write in the register 16#378, 16#379, 16#37A

> But i have no idea how to do it.
>

Neither do I, but try reading the GNAT manual. There is bound to be
something about reading I/O ports or using assembly language inserts to
do the same

> I have started something like that but it doesn't work :
>
> type reg is new integer;
> for reg'size use 8; --register is 8 bits
> type regptr is access all reg
> for reg'address use 16#378#;

This is a memory adresses. These are in the BIOS area somewhere if I
remember correctly.

Greetings,






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

* Re: Parallel port
  2000-03-05  0:00 Parallel port Philippe Bourzeix
  2000-03-05  0:00 ` Tarjei Tj�stheim Jensen
@ 2000-03-05  0:00 ` Jerry van Dijk
  2000-03-06  0:00   ` Philippe BOURZEIX
  1 sibling, 1 reply; 24+ messages in thread
From: Jerry van Dijk @ 2000-03-05  0:00 UTC (permalink / raw)


> I would like to access to my parallel port.
> To read and write in the register 16#378, 16#379, 16#37A

That would depend on which OS you are using...







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

* Re: Parallel port
  2000-03-06  0:00       ` Gisle S�lensminde
  2000-03-06  0:00         ` Philippe Bourzeix
@ 2000-03-06  0:00         ` Ted Dennison
  1 sibling, 0 replies; 24+ messages in thread
From: Ted Dennison @ 2000-03-06  0:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 821 bytes --]

In article <slrn8c7omc.kji.gisle@apal.ii.uib.no>,
  gisle@apal.ii.uib.no (Gisle S�lensminde) wrote:
> In article <8a0gkf$pv8$1@nnrp1.deja.com>, Ted Dennison wrote:
> >If you are talking 9x or NT, you can't do that. Those OS's don't
allow
> >direct access to the hardware. You have to do it using Win32 calls.
>
> NT and Win2000 otherwise, but I think you are wrong when saying that
> direct hardware is disallowed on Win9x.

Hmm. I thought you had to open up an 8-bit DOS shell under Win9x to do
that, which technically isn't really running under Windows. But I no
longer have such a system.

I suppose this is the kind of inacuracy one can expect when aksing an OS
question in a language 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] 24+ messages in thread

* Re: Parallel port
  2000-03-06  0:00   ` Philippe BOURZEIX
  2000-03-06  0:00     ` Philippe Bourzeix
@ 2000-03-06  0:00     ` Ted Dennison
  2000-03-06  0:00       ` tmoran
  2000-03-06  0:00       ` Gisle S�lensminde
  1 sibling, 2 replies; 24+ messages in thread
From: Ted Dennison @ 2000-03-06  0:00 UTC (permalink / raw)


In article <38C37F6D.A52CB4B7@shom.fr>,
  Philippe BOURZEIX <bourzeix@shom.fr> wrote:
> Jerry van Dijk wrote:
>
> > > I would like to access to my parallel port.
> > > To read and write in the register 16#378, 16#379, 16#37A
> >
> > That would depend on which OS you are using...
>
> My program run on Windows.

Windows what?

If you are talking 9x or NT, you can't do that. Those OS's don't allow
direct access to the hardware. You have to do it using Win32 calls.

If you are talking 3.11, it should probably work. But even there I
suspect there are systems calls you should be using instead. There might
be a way to do it using the DOS subsystem in Win9x, but that's probably
not what you want to do.

This is really an OS question, not an Ada question.

--
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] 24+ messages in thread

* Re: Parallel port
  2000-03-06  0:00     ` Ted Dennison
  2000-03-06  0:00       ` tmoran
@ 2000-03-06  0:00       ` Gisle S�lensminde
  2000-03-06  0:00         ` Philippe Bourzeix
  2000-03-06  0:00         ` Ted Dennison
  1 sibling, 2 replies; 24+ messages in thread
From: Gisle S�lensminde @ 2000-03-06  0:00 UTC (permalink / raw)


In article <8a0gkf$pv8$1@nnrp1.deja.com>, Ted Dennison wrote:

>>
>> My program run on Windows.
>
>Windows what?
>
>If you are talking 9x or NT, you can't do that. Those OS's don't allow
>direct access to the hardware. You have to do it using Win32 calls.

I would recommend using system calls too, since it won't work on 
NT and Win2000 otherwise, but I think you are wrong when saying that
direct hardware is disallowed on Win9x.

--
Gisle S�lensminde ( gisle@ii.uib.no )   

ln -s /dev/null ~/.netscape/cookies




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

* Re: Parallel port
  2000-03-06  0:00     ` Ted Dennison
@ 2000-03-06  0:00       ` tmoran
  2000-03-06  0:00         ` Philippe Bourzeix
  2000-03-06  0:00       ` Gisle S�lensminde
  1 sibling, 1 reply; 24+ messages in thread
From: tmoran @ 2000-03-06  0:00 UTC (permalink / raw)


>This is really an OS question, not an Ada question.
  Agreed that Microsoft's latest computers don't allow such access
by user programs directly to the underlying Intel computers.  But
even if the program does have such access, the relevant IO ports
would be in the IO address space, not the memory address space.  So
  for Reg_1'address use To_Address(16#378#);
will do the wrong thing.  Something like
  Vendor_Specific_IO_Library.Output(port=>16#378#, data=>data_value);
would be necessary instead.




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

* Re: Parallel port
  2000-03-06  0:00       ` Gisle S�lensminde
@ 2000-03-06  0:00         ` Philippe Bourzeix
  2000-03-08  0:00           ` Gisle S�lensminde
  2000-03-06  0:00         ` Ted Dennison
  1 sibling, 1 reply; 24+ messages in thread
From: Philippe Bourzeix @ 2000-03-06  0:00 UTC (permalink / raw)


Well it seems that it's not possible on Windows Nt -95-98...
So is it possible on linux ?
Someone got an idea ?






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

* Re: Parallel port
  2000-03-06  0:00       ` tmoran
@ 2000-03-06  0:00         ` Philippe Bourzeix
  2000-03-07  0:00           ` tmoran
  0 siblings, 1 reply; 24+ messages in thread
From: Philippe Bourzeix @ 2000-03-06  0:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 784 bytes --]

I'm a new in the ada world ... Can you give me more details.

What type for the data_value ?
Is the library Vendor_Specific_IO_Library is avaible on all ada compilers ?


<tmoran@bix.com> a �crit dans le message :
FITw4.4090$w9.85382@news.pacbell.net...
> >This is really an OS question, not an Ada question.
>   Agreed that Microsoft's latest computers don't allow such access
> by user programs directly to the underlying Intel computers.  But
> even if the program does have such access, the relevant IO ports
> would be in the IO address space, not the memory address space.  So
>   for Reg_1'address use To_Address(16#378#);
> will do the wrong thing.  Something like
>   Vendor_Specific_IO_Library.Output(port=>16#378#, data=>data_value);
> would be necessary instead.
>






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

* Re: Parallel port
  2000-03-06  0:00   ` Philippe BOURZEIX
@ 2000-03-06  0:00     ` Philippe Bourzeix
  2000-03-06  0:00     ` Ted Dennison
  1 sibling, 0 replies; 24+ messages in thread
From: Philippe Bourzeix @ 2000-03-06  0:00 UTC (permalink / raw)


As you can see I am new in the ada world. If you have any idea could you
give me a full example.
To improve I need first some help.

I'm a student who needs solutions to do this job for June ... It's a bit
short, but I'm sure I will find a solution. Because of my poor knowledge in
Ada, I need full example, to be able to understand quickly...

I know I ask you a lot, big thanks...






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

* Re: Parallel port
  2000-03-05  0:00 ` Jerry van Dijk
@ 2000-03-06  0:00   ` Philippe BOURZEIX
  2000-03-06  0:00     ` Philippe Bourzeix
  2000-03-06  0:00     ` Ted Dennison
  0 siblings, 2 replies; 24+ messages in thread
From: Philippe BOURZEIX @ 2000-03-06  0:00 UTC (permalink / raw)
  To: Jerry van Dijk

Jerry van Dijk wrote:

> > I would like to access to my parallel port.
> > To read and write in the register 16#378, 16#379, 16#37A
>
> That would depend on which OS you are using...

My program run on Windows.

For the data is someone have an idea ?

Something like this is correct :

type byte is new short_short_integer;
for byte'size use 8:        --8 bits
Reg_1 ,Reg_2,Reg_3 : byte;
for Reg_1'address use To_Address(16#378#);
for Reg_1'address use To_Address(16#379#);
for Reg_1'address use To_Address(16#37A#);


The purpose of  all my question is to be able to use a lcd screen (2
lines, 40 caracters) connected on the lpt port.

The connection is like this :

        LPT                LCD
STROBE           1        ->        6
D0                       2        ->        7
D1                       3        ->        8
D2                       4        ->        9
D3                       5        ->        10
D4                       6        ->        11
D5                       7        ->        12
D6                       8        ->        13
D7                        9        ->        14
                            10
                            11
                            12
                            13
                            14
                            15
INIT                  16        ->        5
SELECT IN    17        ->        4
                             18
                             19
                             20
                             21
                             22
                             23
                             24
                             25





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

* Re: Parallel port
  2000-03-06  0:00         ` Philippe Bourzeix
@ 2000-03-07  0:00           ` tmoran
  0 siblings, 0 replies; 24+ messages in thread
From: tmoran @ 2000-03-07  0:00 UTC (permalink / raw)


>Is the library Vendor_Specific_IO_Library is avaible on all ada compilers ?
>>   Vendor_Specific_IO_Library.Output(port=>16#378#, data=>data_value);
  I'm sure nothing of that exact name is offered by *anyone*.

When run under Windows 95, the following program displays a status of
87 when my old Epson printer is plugged into LPT1 and powered on,
and a status of 127 when it's powered off.

with claw.message_box,   -- nonstandard
     system,
     bit;                -- nonstandard
procedure test is
  use claw.message_box;
  status : system.byte;  -- nonstandard
begin
  message_box(text=>"ready?",
              caption=>"lpt1 status",
              flags=>make_flags);
  -- initialize
  bit.outport(16#37A#, 12);
  delay 0.05;
  bit.outport(16#37A#, 8);
  delay 0.01;
  -- check status
  bit.inport(16#379#, status);
  message_box(text=>"status is" & system.byte'image(status),
              caption=>"lpt1 status",
              flags=>make_flags);
end test;

But the package "bit", as well as the type "system.byte", are
extras that come with the Janus Ada compiler.  Other compilers
probably have something similar - look at your compiler's
documentation.

  Failing that, in decreasing order of ease,
  Can you do a "pragma Import" on an existing (C?) function to do
the byte level IO?
  You can always write the needed IO routines in assembly language,
then use "pragma Import" to make them accessible to your Ada program.
  Look at your compiler's documentation on package System.Machine_Code,
and use that to make the necessary IO instructions.
  As has been pointed out, some versions of Windows will only allow
"device drivers" that kind of hardware access, and will kill your
program if you try it from a "user program".




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

* Re: Parallel port
  2000-03-06  0:00         ` Philippe Bourzeix
@ 2000-03-08  0:00           ` Gisle S�lensminde
  0 siblings, 0 replies; 24+ messages in thread
From: Gisle S�lensminde @ 2000-03-08  0:00 UTC (permalink / raw)


In article <QMTw4.1177$xx6.8182878@nnrp3.proxad.net>, Philippe Bourzeix wrote:
>Well it seems that it's not possible on Windows Nt -95-98...
>So is it possible on linux ?
>Someone got an idea ?

On Linux you got access to the parallel port through the device
drivers. This is /dev/lpx or /dev/parportx, where x is the numbers
0-3. You open the device as a file, and read and writes 

If you of some strange reason want to access the hardware direcly,
you can use the ioperm() call as root, or write your own kernel
module, but that is not necesary.

--
Gisle S�lensminde ( gisle@ii.uib.no )   

ln -s /dev/null ~/.netscape/cookies




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

* Parallel Port
@ 2000-03-19  0:00 Philippe Bourzeix
  2000-03-19  0:00 ` Ed Falis
                   ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: Philippe Bourzeix @ 2000-03-19  0:00 UTC (permalink / raw)


I have already asked some questions, but i would like to know why this
program works on Alsys and not on objectada :

with Text_Io;
with System;
with Unchecked_Conversion;
use Text_Io, System;

procedure Lcd is
    -------------------------------------
    -- Definition du type bit et octet --
    -------------------------------------
    type Bit is new Boolean;
    for Bit'Size use 1;
    type Octet is array (1..8) of Bit;
    pragma Pack (Octet);
    -----------------------------
    -- fonction de convertion  --
    -----------------------------
    subtype Entier_8_bits is Short_Short_Integer;
    package Es_Entier_8_bits is new Text_Io.Integer_Io(Entier_8_bits);
    use Es_Entier_8_bits;
    function Octet_Entier is new Unchecked_Conversion (Octet,Entier_8_bits);
    function Entier_Octet is new Unchecked_Conversion (Entier_8_bits,Octet);
    function Integer_Address is new Unchecked_Conversion (Integer,Address);
    ------------------------------
    -- Clause sur les addresses --
    ------------------------------
    Registre_1, Registre_2, Registre_3 : Octet ;
    for Registre_1 use at Integer_Address(16#378#); -- Parallel port address
    for Registre_2 use at Integer_Address(16#379#);
    for Registre_3 use at Integer_Address(16#37A#);
        -------------------
        -- Fonctions LCD --
        -------------------
    function Dico (Caractere : in Character) return Octet is
    begin
        return Entier_Octet(Character'Pos(Caractere));
    end Dico;
    procedure Ecrire (Caractere : in Character) is
    begin
        Registre_1:=Dico(Caractere);
        Registre_2:=Entier_Octet(2#0000_0000#);
        Registre_3:=Entier_Octet(2#0000_0000#);
    end Ecrire;
    procedure Ligne_Suivante is
    begin
        null;
    end Ligne_Suivante;
    procedure Verif is
    begin
        Put_Line("registre 1 =" &
Entier_8_bits'Image(Octet_Entier(Registre_1)));
        Put_Line("registre 2 =" &
Entier_8_bits'Image(Octet_Entier(Registre_2)));
        Put_Line("registre 3 =" &
Entier_8_bits'Image(Octet_Entier(Registre_3)));
    end Verif;


    begin
        Verif;
        Ecrire('A');
        Put_Line("Ordre d'ecriture : A");
        Verif;
        Ecrire('a');
        Put_Line("Ordre d'ecriture : a");
        Verif;
end Lcd;






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

* Re: Parallel Port
  2000-03-19  0:00 Parallel Port Philippe Bourzeix
  2000-03-19  0:00 ` Ed Falis
@ 2000-03-19  0:00 ` Dale Stanbrough
  2000-03-20  0:00   ` Philippe BOURZEIX
  2000-03-21  0:00 ` Philippe BOURZEIX
  2 siblings, 1 reply; 24+ messages in thread
From: Dale Stanbrough @ 2000-03-19  0:00 UTC (permalink / raw)


Philippe Bourzeix wrote:

> I have already asked some questions, but i would like to know why this
> program works on Alsys and not on objectada :


um, in what way doesn't it work?


Dale




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

* Re: Parallel Port
  2000-03-19  0:00 Parallel Port Philippe Bourzeix
@ 2000-03-19  0:00 ` Ed Falis
  2000-03-20  0:00   ` Philippe BOURZEIX
  2000-03-19  0:00 ` Dale Stanbrough
  2000-03-21  0:00 ` Philippe BOURZEIX
  2 siblings, 1 reply; 24+ messages in thread
From: Ed Falis @ 2000-03-19  0:00 UTC (permalink / raw)



"Philippe Bourzeix" <philippe.bourzeix@free.fr> wrote in message
news:172B4.2690$wl2.12638330@nnrp4.proxad.net...
> I have already asked some questions, but i would like to know why this
> program works on Alsys and not on objectada :
<snip>
>     function Entier_Octet is new Unchecked_Conversion
(Entier_8_bits,Octet);

<snip>

>     Registre_1, Registre_2, Registre_3 : Octet ;
>     for Registre_1 use at Integer_Address(16#378#); -- Parallel port
address
>     for Registre_2 use at Integer_Address(16#379#);
>     for Registre_3 use at Integer_Address(16#37A#);

<snip>

>     procedure Ecrire (Caractere : in Character) is
>     begin
>         Registre_1:=Dico(Caractere);
>         Registre_2:=Entier_Octet(2#0000_0000#);
>         Registre_3:=Entier_Octet(2#0000_0000#);
>     end Ecrire;

I don't see how this could have worked for either compiler, assuming x86
architecture without memory-mapped I/O (which can be inferred from the
standard PC I/O space address used for the port base).

You need to use port I/O instructions to read and write these addresses.
Take a look at Machine_Instructions_386.  If you're running on NT or Win2K,
it won't work in either case, because of OS hardware protection.

- Ed







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

* Re: Parallel Port
  2000-03-20  0:00   ` Philippe BOURZEIX
@ 2000-03-20  0:00     ` Gautier
  2000-03-20  0:00       ` Jerry van Dijk
  0 siblings, 1 reply; 24+ messages in thread
From: Gautier @ 2000-03-20  0:00 UTC (permalink / raw)


> Ed Falis wrote:
> > I don't see how this could have worked for either compiler, assuming x86
> > architecture without memory-mapped I/O (which can be inferred from the
> > standard PC I/O space address used for the port base).

Maybe one compiler does automatically translate these accesses to hardware addresses
into in/out instructions and the other one doesn't...

> > You need to use port I/O instructions to read and write these addresses.
> > Take a look at Machine_Instructions_386.  If you're running on NT or Win2K,
> > it won't work in either case, because of OS hardware protection.

> > - Ed

Philippe BOURZEIX wrote:

> So I can't do it on NT neither on Win98. A chance on dos ???

Yes but even on DOS you should use the inport/outport instructions ihmo.
(ASM specialist there ?...)
E.g. for VGA/SVGA palette:
   procedure Set_Color (Color : in Color_Type; Value : in RGB_Color) is
   begin
      Outport_Byte (16#3C8#, Unsigned_8 (Color));
      Outport_Byte (16#3C9#, Unsigned_8 (Value.Red));
      Outport_Byte (16#3C9#, Unsigned_8 (Value.Green));
      Outport_Byte (16#3C9#, Unsigned_8 (Value.Blue));
   end Set_Color;

NB: DOS programs using such instructions are said (not tested myself) to run on NT,
e.g. for a multi-key interrupt. NT maybe "firewalls" all these hardware accesses
knowing they come from a DOS program.
______________________________________________________
Gautier  --  http://members.xoom.com/gdemont/gsoft.htm




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

* Re: Parallel Port
  2000-03-20  0:00     ` Gautier
@ 2000-03-20  0:00       ` Jerry van Dijk
  2000-03-20  0:00         ` Gautier
  0 siblings, 1 reply; 24+ messages in thread
From: Jerry van Dijk @ 2000-03-20  0:00 UTC (permalink / raw)


> Yes but even on DOS you should use the inport/outport instructions ihmo.
> (ASM specialist there ?...)

If a specialist is lacking, one could try my GNAT inline (x86) ASM tutorial,
to be
found on adapower...







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

* Re: Parallel Port
  2000-03-20  0:00       ` Jerry van Dijk
@ 2000-03-20  0:00         ` Gautier
  0 siblings, 0 replies; 24+ messages in thread
From: Gautier @ 2000-03-20  0:00 UTC (permalink / raw)


Jerry van Dijk wrote:

> > Yes but even on DOS you should use the inport/outport instructions ihmo.
> > (ASM specialist there ?...)

> If a specialist is lacking, one could try my GNAT inline (x86) ASM tutorial,
> to be found on adapower...

And whose contents have spread at many places - oh! below too...
But the ASM question is: "to move or to outb ?"...

G.

   ---------------------------
   -- Access hardware ports --
   ---------------------------

   --------------------------------------------------------------------
   function Inport_Byte (Port : Unsigned_16) return Unsigned_8 is
      Value : Unsigned_8;
   begin
      ASM ("inb %%dx",
        Unsigned_8'Asm_Output ("=a", Value),
        Unsigned_16'Asm_Input ("d", Port),
        Volatile => True);
      return Value;
   end Inport_Byte;
   pragma Inline (Inport_Byte);

   --------------------------------------------------------------------
   procedure Outport_Byte (Port : in Unsigned_16; Value : in Unsigned_8) is
   begin
      ASM ("outb %%dx",
        No_Output_Operands,
        (Unsigned_8'Asm_Input  ("a", Value),
         Unsigned_16'Asm_Input ("d", Port)));
   end Outport_Byte;
   pragma Inline (Outport_Byte);




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

* Re: Parallel Port
  2000-03-19  0:00 ` Dale Stanbrough
@ 2000-03-20  0:00   ` Philippe BOURZEIX
  0 siblings, 0 replies; 24+ messages in thread
From: Philippe BOURZEIX @ 2000-03-20  0:00 UTC (permalink / raw)


Dale Stanbrough wrote:

> Philippe Bourzeix wrote:
>
> > I have already asked some questions, but i would like to know why this
> > program works on Alsys and not on objectada :
>
> um, in what way doesn't it work?
>
> Dale

On objectada, I have a memory access error. I have not this problem with
Alsys.
But anyway I'm not sure to access the rigth register  378 (parallel port).






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

* Re: Parallel Port
  2000-03-19  0:00 ` Ed Falis
@ 2000-03-20  0:00   ` Philippe BOURZEIX
  2000-03-20  0:00     ` Gautier
  0 siblings, 1 reply; 24+ messages in thread
From: Philippe BOURZEIX @ 2000-03-20  0:00 UTC (permalink / raw)


Ed Falis wrote:

> I don't see how this could have worked for either compiler, assuming x86
> architecture without memory-mapped I/O (which can be inferred from the
> standard PC I/O space address used for the port base).
>
> You need to use port I/O instructions to read and write these addresses.
> Take a look at Machine_Instructions_386.  If you're running on NT or Win2K,
> it won't work in either case, because of OS hardware protection.
>
> - Ed

So I can't do it on NT neither on Win98. A chance on dos ???






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

* Re: Parallel Port
  2000-03-21  0:00 ` Philippe BOURZEIX
@ 2000-03-21  0:00   ` tmoran
  0 siblings, 0 replies; 24+ messages in thread
From: tmoran @ 2000-03-21  0:00 UTC (permalink / raw)


>Is there any library with such outportb function in the ada world ...
  Lots.  No single one is standard for the simple reason that many
systems do their IO in different ways than Intel.
  In MS VC++ there are routines _inp and _outp that you should be
able to use with the declarations:
  function inp(port:integer) return integer;
  pragma import(C, inp, "_inp");
  procedure outp(port:integer; value:integer);
  pragma import(C, outp, "_outp");
and you should link with the appropriate MSVC++ library.
From the Help:
LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version

As has been noted, Microsoft's NT and 2000 probably will not allow
this but it does appear to work in W95.




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

* Re: Parallel Port
  2000-03-19  0:00 Parallel Port Philippe Bourzeix
  2000-03-19  0:00 ` Ed Falis
  2000-03-19  0:00 ` Dale Stanbrough
@ 2000-03-21  0:00 ` Philippe BOURZEIX
  2000-03-21  0:00   ` tmoran
  2 siblings, 1 reply; 24+ messages in thread
From: Philippe BOURZEIX @ 2000-03-21  0:00 UTC (permalink / raw)


The purpose of all my question, is to access to a lcd screen (on the parallel
port).
I have found a C program who can do what i want. Is it possible to do the same
in ADA?

#include <string.h>

#define portaddress 0X378

#define data portaddress + 0
#define status portaddress + 1
#define control portaddress + 2

void main (void)

{
    char string [] = {"testing 1,2,3          "
                                    "It works                "};
    char init [10];
    int count;
    int len;
    init[0] = 0X0F; /* init display */
    init[1] = 0X01; /* clear display */
    init[2] = 0X38; /* dual line / 8 bits */

    outportb(control, inportb(control) & OXDF); /* reset control port */
    outportb(control, inportb(control) | 0X08); /* set select printer */

    for (count = 0; count <= 2; count ++)
    {
        outportb(data, init[count]);
        outportb(contol,inportb(control) | 0X01); /*set strobe enable*/
        delay(20);
        outport(control,inportb(control) & OXFE); /* reset strobe enable)*/
        delay(20);
    }

    outportb(control, inportb(control) & OXF7); /* reset select printer */

    len = strlen(string);

    for (count=0; count < len,; count ++)
    {
        outportb(data,string[count]);
        outportb(control, inportb(control) | 0X01); /*set strobe*/
        delay(2);
        outportb(control, inportb(control) & 0XFE); /* reset strobe */
        delay(2);
    }
}



Is there any library with such outportb function in the ada world ...





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

* PARALLEL PORT
@ 2001-01-17  9:18 Szymar
  0 siblings, 0 replies; 24+ messages in thread
From: Szymar @ 2001-01-17  9:18 UTC (permalink / raw)


Hallo,

Where is a package for using the parallel port on a PC with Windows?
I'm using the GNAT 3.13p compilers.

I am student from Poland.
(AGH in Cracow)
dormar@poczta.fm






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

end of thread, other threads:[~2001-01-17  9:18 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-05  0:00 Parallel port Philippe Bourzeix
2000-03-05  0:00 ` Tarjei Tj�stheim Jensen
2000-03-05  0:00 ` Jerry van Dijk
2000-03-06  0:00   ` Philippe BOURZEIX
2000-03-06  0:00     ` Philippe Bourzeix
2000-03-06  0:00     ` Ted Dennison
2000-03-06  0:00       ` tmoran
2000-03-06  0:00         ` Philippe Bourzeix
2000-03-07  0:00           ` tmoran
2000-03-06  0:00       ` Gisle S�lensminde
2000-03-06  0:00         ` Philippe Bourzeix
2000-03-08  0:00           ` Gisle S�lensminde
2000-03-06  0:00         ` Ted Dennison
  -- strict thread matches above, loose matches on Subject: below --
2000-03-19  0:00 Parallel Port Philippe Bourzeix
2000-03-19  0:00 ` Ed Falis
2000-03-20  0:00   ` Philippe BOURZEIX
2000-03-20  0:00     ` Gautier
2000-03-20  0:00       ` Jerry van Dijk
2000-03-20  0:00         ` Gautier
2000-03-19  0:00 ` Dale Stanbrough
2000-03-20  0:00   ` Philippe BOURZEIX
2000-03-21  0:00 ` Philippe BOURZEIX
2000-03-21  0:00   ` tmoran
2001-01-17  9:18 PARALLEL PORT Szymar

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