delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/28/09:49:46

From: "Jono" <pistils AT hotmail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Parallel port program help
Date: 23 May 1997 04:16:17 GMT
Organization: Mikrotec Internet Services, Inc.
Lines: 23
Message-ID: <01bc672f$b73bba80$b40000c8@Ppro>
NNTP-Posting-Host: footh305.mis.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I'm trying to write a program that will use the parallel port pins to turn
appliances on and off.  I have found the following code, but can't get it
to compile under djgpp.  It's supposed to turn pin 2 on at 10:05 for one
minute.  If anyone can help, how do I tell it which pins to turn on?

#include <stdio.h>
#include <time.h>
#include <pc.h>

int main(void)   
{                 
struct time t;
unsigned port = 0x378;
while()
    {
    gettime(&t);
    if(t.ti_hour==10 && t.ti_min==05) outportb (port,1);
    else outportb (port,0);
    }
}

Thanks,
Jono

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019