Welcome, Guest. Please login or register.

Author Topic: Programming the Amiga parallel port  (Read 1709 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline steve30Topic starter

  • Sr. Member
  • ****
  • Join Date: Nov 2005
  • Posts: 322
    • Show only replies by steve30
    • http://www.stevecoates.net
Programming the Amiga parallel port
« 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
 

Offline motorollin

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show only replies by motorollin
Re: Programming the Amiga parallel port
« Reply #1 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
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline meega

  • Hero Member
  • *****
  • Join Date: Jul 2006
  • Posts: 952
    • Show only replies by meega
Re: Programming the Amiga parallel port
« Reply #2 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.
:)
 

Offline Heinz

  • Full Member
  • ***
  • Join Date: Nov 2005
  • Posts: 154
    • Show only replies by Heinz
    • http://amidevcpp.amiga-world.de
Re: Programming the Amiga parallel port
« Reply #3 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

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;
}
 

Offline steve30Topic starter

  • Sr. Member
  • ****
  • Join Date: Nov 2005
  • Posts: 322
    • Show only replies by steve30
    • http://www.stevecoates.net
Re: Programming the Amiga parallel port
« Reply #4 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.