Amiga.org

Amiga computer related discussion => Amiga Hardware Issues and discussion => Topic started by: steve30 on September 11, 2008, 06:24:32 PM

Title: Programming the Amiga parallel port
Post by: steve30 on September 11, 2008, 06:24:32 PM
I have been fiddling about with the parallel port on my PC recently as I will be making use of it for my college project this year. I've only managed to get it to switch LEDs on and off using Microsoft's QuickBasic.

Does anyone know where to start using the Amiga to switch LEDs on and off with the parallel port?

Cheers
Steve
Title: Re: Programming the Amiga parallel port
Post by: motorollin on September 11, 2008, 06:26:44 PM
I had a parallel port relay board and managed to switch relays on and off with Blitz Basic. It only took a few lines of code but I can't remember how I did it now. You could have a look in the Blitz documentation and see if that covers parallel port access.

--
moto
Title: Re: Programming the Amiga parallel port
Post by: meega on September 11, 2008, 06:33:44 PM
It can control a printer, so you can send form feeds, line feeds, all the other mechanical control signals, using a printer driver - or even directly, I should think, "Copy >PAR:" etc. Also there are 8 data lines, so you should be able to place 0-255 on the pins somehow. And it's bi-directional, data and control signals can go in too.
Title: Re: Programming the Amiga parallel port
Post by: Heinz on September 11, 2008, 06:44:50 PM
Quote

steve30 wrote:
I have been fiddling about with the parallel port on my PC recently as I will be making use of it for my college project this year. I've only managed to get it to switch LEDs on and off using Microsoft's QuickBasic.

Does anyone know where to start using the Amiga to switch LEDs on and off with the parallel port?

Cheers
Steve


Parallel Port ?
Quickbasic ?

In a college Project ?!
One should expect modern HArd and Software on a college ...
;)

Here is some Info about parrellel programming on the Amiga (http://gega.homelinux.net/AmigaDevDocs/parallel.html)

here is an example program:

Quote

#include
#include
#include
#include

int main(int argc, char *argv[])
{
 
  struct IOExtPar * Parallelport;
  struct MsgPort * ParallelMsgPort;
  BYTE Returnvalue;
 
  if(ParallelMsgPort = CreateMsgPort())
  {
    if(Parallelport = (struct IOExtPar *) CreateIORequest(ParallelMsgPort, sizeof(struct IOExtPar)))
         {
            Parallelport->io_ParFlags = PARF_SHARED;
         }
    else
    {printf("CreateIORequest failed\n");}
  }
  else
  {printf("CreateMsgPort failed\n");}
 
  printf("Open Parallelport...\n");
 
 
  Returnvalue = OpenDevice("parallel.device",0L,(struct IORequest *)Parallelport,0);
   
  if(Returnvalue == 0)
  {
          printf("Opening Parallel Port successful\n");
  }
  else
  {
           printf("An Error accured.\n");
  }
   printf("Press any key to send Data...\n");
   
   Parallelport->IOPar.io_Length   = -1;
   Parallelport->IOPar.io_Data     = (APTR)"Parallel lines cross 7 times...";
   Parallelport->IOPar.io_Command  = CMD_WRITE;
   DoIO((struct IORequest *)Parallelport);        
   
    printf("Any key to quit...\n");
    getchar();
 
  CloseDevice((struct IORequest *)Parallelport);
 
  DeleteMsgPort(ParallelMsgPort);
  DeleteIORequest((struct IORequest *)Parallelport);
 
  printf("Any key to quit...\n");
  getchar();
  return Returnvalue;
}
Title: Re: Programming the Amiga parallel port
Post by: steve30 on September 11, 2008, 08:49:15 PM
I have never done any programming on the Amiga, I want to start though. I will have a look at Blitz Basic.

Heinz: Is that programme in C? What does it do? I can see it has something to do with the parallel port but exactly what I'm not sure.

So far on the PC I have been making various combinations of LEDs light up by typing 'OUT 888,255' in Quick basic, where 888 is the address of the data register and 255 is the value to send to make the LEDs light up.