www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/04/11:46:04

From: "A. Sinan Unur" <asu1 AT cornell DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Parallel Port Program?
Date: Fri, 04 Apr 1997 06:38:05 -0500
Organization: Cornell University http://www.cornell.edu
Lines: 47
Sender: asu1 AT cornell DOT edu (Verified)
Message-ID: <3344E81C.4837@cornell.edu>
References: <01bc40df$f8f93ea0$6e221cce AT ppro>
Reply-To: asu1 AT cornell DOT edu
NNTP-Posting-Host: cu-dialup-0054.cit.cornell.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Jono Greene wrote:
> 
> I am trying to write a simple program that will turn on a designated 
> pin of the parallel port, at a designated time.  I have found the 
> following code, but I can't get it to compile under DJGPP:
> 
> #include <stdio.h>
> #include <conio.h>
> #include <time.h>
> 
> void main(void)

ok, let me be a smart ass for a second: according to the ansi standard,
main has to return an int. no matter what you see in some well known
books, you should use either 
    int main(void), or 
    int main(int argc, char **argv)
depending on whether you need command line arguments.

>     if(t.ti_hour==10 && t.ti_min==05) _outp8(port,1);
>     else _outp8(port,0);

your problem is with _outp8 ... you need the corresponding function from
the djgpp c library which is, outportb (b stands for byte) anyway, here
is the info form dj's on-line c library reference:
-----------
outportb

#include <pc.h>
void outportb(unsigned short _port, unsigned char  _data);

Description: Write a single byte to an 8-bit port. 
This function is provided as an inline assembler macro, and will be
optimized down to a single opcode when you optimize your program. 
---------
by the way, this type of information is extremely easy to find. you
could either go through the info docs on your hard disk, or dj's online
reference and search for a function name resembling _outp8.

   -- Sinan
 
*******************************************************************
 A. Sinan Unur                                WWWWWW
                                              |--O+O
 mailto:sinan DOT unur AT cornell DOT edu                C   ^ 
 http://www.people.cornell.edu/pages/asu1/     \  ~/ 
*******************************************************************

- Raw text -


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