From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e48cd5d4d1976e1c X-Google-Attributes: gid103376,public From: aklee@spam.this.interport.net (Albert K. Lee) Subject: Re: Parallel port in Ada Date: 1998/06/09 Message-ID: #1/1 X-Deja-AN: 360906488 References: Organization: Interport Communications Corp. Newsgroups: comp.lang.ada Date: 1998-06-09T00:00:00+00:00 List-Id: On Mon, 8 Jun 1998 18:16:13 +0100, Fco. Luis Guillen wrote: > > Yes, I've Gnat 3.08 and i want to control 8 leds conected in the >parallel port. > > Yes I think to make it with the 'LPT1', open a file and print in >it, but i think that it isn't very smart. I want to make it with code >machine or with interruptions. So you're using GNAT 3.08 on a 386 class PC running an unspecified operating system. Firstly, I'm not sure if the parallel port sinks enough current to drive 8 LED's. Be careful to not damage anything. One way to access the data lines of a parallel port is through in/out calls to the parallel port's base port. That is, for LPT1, accessing the usual base port of 16#378 (0x378) will allow you to converse with data lines D0 through D7 (DB25 pins 2 through 9). Accessing ports 16#379 and 16#37A will give you access to the other 9 pins. That's only half the answer -- I'm not exactly sure how to access these ports using GNAT. A while ago, I needed to do this through Linux, and to get access to the hardware through the OS, I found it most comfortable to interface to the OS using C and link the resulting object file with the rest of my Ada program. In DOS, however, where there is no protection of hardware at all, it might be simpler to take an all-Ada approach (I've never really used the DOS distribution). Are you using Windows or DOS? (or Linux?) -Albert