By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,236 Members | 1,833 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,236 IT Pros & Developers. It's quick & easy.

parallel port programming simple problem

P: n/a
Could anyone please tell me why the program has the following error? I
copy the program from http://www.beyondlogic.org/parlcd/parlcd.htm
/////////////////////////////////////////////////////////////////////
#include <dos.h>
#include <string.h>
#include <stdio.h>

#define PORTADDRESS 0x378 /* Enter Your Port Address Here */

#define DATA PORTADDRESS+0
#define STATUS PORTADDRESS+1
#define CONTROL PORTADDRESS+2

void main(void)
{
char string[] = {"Testing 1,2,3 "
"It' Works ! "};
char init[10];
int count;
int len;
init[0] = 0x0F; /* Init Display */
init[1] = 0x01; /* Clear Display */
init[2] = 0x38; /* Dual Line / 8 Bits */

outportb(CONTROL, inportb(CONTROL) & 0xDF); /* Reset Control Port -
Make sure Forward Direction */

outportb(CONTROL, inportb(CONTROL) | 0x08); /* Set Select Printer
(Register Select) */

for (count = 0; count <= 2; count++)
{
outportb(DATA, init[count]);
outportb(CONTROL,inportb(CONTROL) | 0x01); /* Set Strobe (Enable)*/
delay(20); /* Larger Delay for INIT
*/
outportb(CONTROL,inportb(CONTROL) & 0xFE); /* Reset Strobe
(Enable)*/
delay(20); /* Larger Delay for INIT
*/
}

outportb(CONTROL, inportb(CONTROL) & 0xF7); /* Reset Select Printer
(Register Select) */

len = strlen(string);

for (count = 0; count < len; count++)
{
outportb(DATA, string[count]);
outportb(CONTROL,inportb(CONTROL) | 0x01); /* Set Strobe */
delay(2);
outportb(CONTROL,inportb(CONTROL) & 0xFE); /* Reset Strobe */
delay(2);
}
}
////////////////////////////////////////////////////////////////////////////////
--------------------Configuration: Text1 - Win32
Debug--------------------
Compiling...
Text1.c
C:\Program Files\Microsoft Visual Studio\Text1.c(22) : error C2065:
'outportb' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\Text1.c(22) : error C2065:
'inportb' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\Text1.c(30) : error C2065:
'delay' : undeclared identifier

Jul 10 '06 #1
Share this Question
Share on Google+
23 Replies


P: n/a
On 2006-07-10, Marco <mo******@gmail.comwrote:
Could anyone please tell me why the program has the following error? I
copy the program from http://www.beyondlogic.org/parlcd/parlcd.htm
/////////////////////////////////////////////////////////////////////
#include <dos.h>
#include <string.h>
#include <stdio.h>

#define PORTADDRESS 0x378 /* Enter Your Port Address Here */

#define DATA PORTADDRESS+0
#define STATUS PORTADDRESS+1
#define CONTROL PORTADDRESS+2

void main(void)
{
char string[] = {"Testing 1,2,3 "
"It' Works ! "};
char init[10];
int count;
int len;
init[0] = 0x0F; /* Init Display */
init[1] = 0x01; /* Clear Display */
init[2] = 0x38; /* Dual Line / 8 Bits */

outportb(CONTROL, inportb(CONTROL) & 0xDF); /* Reset Control Port -
Make sure Forward Direction */

outportb(CONTROL, inportb(CONTROL) | 0x08); /* Set Select Printer
(Register Select) */

for (count = 0; count <= 2; count++)
{
outportb(DATA, init[count]);
outportb(CONTROL,inportb(CONTROL) | 0x01); /* Set Strobe (Enable)*/
delay(20); /* Larger Delay for INIT
*/
outportb(CONTROL,inportb(CONTROL) & 0xFE); /* Reset Strobe
(Enable)*/
delay(20); /* Larger Delay for INIT
*/
}

outportb(CONTROL, inportb(CONTROL) & 0xF7); /* Reset Select Printer
(Register Select) */

len = strlen(string);

for (count = 0; count < len; count++)
{
outportb(DATA, string[count]);
outportb(CONTROL,inportb(CONTROL) | 0x01); /* Set Strobe */
delay(2);
outportb(CONTROL,inportb(CONTROL) & 0xFE); /* Reset Strobe */
delay(2);
}
}
////////////////////////////////////////////////////////////////////////////////
--------------------Configuration: Text1 - Win32
Debug--------------------
Compiling...
Text1.c
C:\Program Files\Microsoft Visual Studio\Text1.c(22) : error C2065:
'outportb' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\Text1.c(22) : error C2065:
'inportb' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\Text1.c(30) : error C2065:
'delay' : undeclared identifier
It looks suspiciously like you tried to use functions that you haven't
declared or defined.

--
Andrew Poelstra <http://www.wpsoftware.net/projects/>
To email me, use "apoelstra" at the above domain.
"You people hate mathematics." -- James Harris
Jul 10 '06 #2

P: n/a
--------------------Configuration: Text1 - Win32
Debug--------------------
Compiling...
Text1.c
C:\Program Files\Microsoft Visual Studio\Text1.c(22) : error C2065:
'outportb' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\Text1.c(22) : error C2065:
'inportb' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\Text1.c(30) : error C2065:
'delay' : undeclared identifier

It looks suspiciously like you tried to use functions that you haven't
declared or defined.

--
Andrew Poelstra <http://www.wpsoftware.net/projects/>
To email me, use "apoelstra" at the above domain.
"You people hate mathematics." -- James Harris

I want to know whether outportb, delay and inportb are function in
general function in C? (I have no experience in C at all.) If they are
general function in C, how I can define them?
Thanks

Jul 10 '06 #3

P: n/a
In article <11*********************@h48g2000cwc.googlegroups. com>,
Marco <mo******@gmail.comwrote:
>Could anyone please tell me why the program has the following error? I
copy the program from http://www.beyondlogic.org/parlcd/parlcd.htm
....
>
--------------------Configuration: Text1 - Win32
Debug--------------------
Compiling...
Text1.c
C:\Program Files\Microsoft Visual Studio\Text1.c(22) : error C2065:
'outportb' : undeclared identifier
Read the sentence just after the program listing in the website
you have cited.

--
Rouben Rostamian
Jul 10 '06 #4

P: n/a
Read the sentence just after the program listing in the website
you have cited.

--
Rouben Rostamian
I change the program to the following, but still have error
Could you please tell me (A new C programmer) why that happen?
thanks
//////////////////////////////////////////////////
#include <stdio.h>
#include <dos.h>
#include <string.h>

#define PORTADDRESS 0x378 /* Enter Your Port Address Here */

#define DATA PORTADDRESS+0
#define STATUS PORTADDRESS+1
#define CONTROL PORTADDRESS+2

void main(void)
{
char string[] = {"Testing 1,2,3 "
"It' Works ! "};
char init[10];
int count;
int len;
init[0] = 0x0F; /* Init Display */
init[1] = 0x01; /* Clear Display */
init[2] = 0x38; /* Dual Line / 8 Bits */

outp(CONTROL, inp(CONTROL) & 0xDF); /* Reset Control Port - Make sure
Forward Direction */

outp(CONTROL, inp(CONTROL) | 0x08); /* Set Select Printer (Register
Select) */

for (count = 0; count <= 2; count++)
{
outp(DATA, init[count]);
outp(CONTROL,inp(CONTROL) | 0x01); /* Set Strobe (Enable)*/
delay(20); /* Larger Delay for INIT
*/
outp(CONTROL,inp(CONTROL) & 0xFE); /* Reset Strobe (Enable)*/
delay(20); /* Larger Delay for INIT
*/
}

outp(CONTROL, inp(CONTROL) & 0xF7); /* Reset Select Printer (Register
Select) */

len = strlen(string);

for (count = 0; count < len; count++)
{
outp(DATA, string[count]);
outp(CONTROL,inp(CONTROL) | 0x01); /* Set Strobe */
delay(2);
outp(CONTROL,inp(CONTROL) & 0xFE); /* Reset Strobe */
delay(2);
}
}
/////////////////////////////////////////////////

--------------------Configuration: Text1 - Win32
Debug--------------------
Compiling...
Text1.c
c:\program files\microsoft visual studio\text1.c(22) : warning C4013:
'outp' undefined; assuming extern returning int
c:\program files\microsoft visual studio\text1.c(22) : warning C4013:
'inp' undefined; assuming extern returning int
c:\program files\microsoft visual studio\text1.c(30) : warning C4013:
'delay' undefined; assuming extern returning int

Text1.obj - 0 error(s), 3 warning(s)

Jul 10 '06 #5

P: n/a
On 2006-07-10, Marco <mo******@gmail.comwrote:
--------------------Configuration: Text1 - Win32
Debug--------------------
Compiling...
Text1.c
C:\Program Files\Microsoft Visual Studio\Text1.c(22) : error C2065:
'outportb' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\Text1.c(22) : error C2065:
'inportb' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\Text1.c(30) : error C2065:
'delay' : undeclared identifier

It looks suspiciously like you tried to use functions that you haven't
declared or defined.

I want to know whether outportb, delay and inportb are function in
general function in C? (I have no experience in C at all.) If they are
general function in C, how I can define them?
Thanks
They are not Standard functions. If they are library functions (which
they appear to be), you must #include the appropriate header. Otherwise,
you would declare and define them just as any other function.

--
Andrew Poelstra <http://www.wpsoftware.net/projects/>
To email me, use "apoelstra" at the above domain.
"You people hate mathematics." -- James Harris
Jul 10 '06 #6

P: n/a
On 2006-07-10, Marco <mo******@gmail.comwrote:
>Read the sentence just after the program listing in the website
you have cited.

--
Rouben Rostamian

I change the program to the following, but still have error
Could you please tell me (A new C programmer) why that happen?
thanks

...
void main(void)
main returns int. Get that right before asking other questions.

--
Andrew Poelstra <http://www.wpsoftware.net/projects/>
To email me, use "apoelstra" at the above domain.
"You people hate mathematics." -- James Harris
Jul 10 '06 #7

P: n/a
In article <11**********************@b28g2000cwb.googlegroups .com>,
Marco <mo******@gmail.comwrote:
>--------------------Configuration: Text1 - Win32
Debug--------------------
Compiling...
Text1.c
c:\program files\microsoft visual studio\text1.c(22) : warning C4013:
'outp' undefined; assuming extern returning int
c:\program files\microsoft visual studio\text1.c(22) : warning C4013:
'inp' undefined; assuming extern returning int
c:\program files\microsoft visual studio\text1.c(30) : warning C4013:
'delay' undefined; assuming extern returning int
The functions outp and inp are not Standard C functions.
You won't get further useful information in this newsgroup.
Try asking in:

comp.os.ms-windows.programmer.win32

--
Rouben Rostamian

Jul 10 '06 #8

P: n/a
"Marco" <mo******@gmail.comwrote in message
news:11*********************@h48g2000cwc.googlegro ups.com...
Could anyone please tell me why the program has the following error? I
copy the program from http://www.beyondlogic.org/parlcd/parlcd.htm
I'd suggest comp.os.msdos.programmer for this question.

- Bill
Jul 10 '06 #9

P: n/a
Hi,Macro.
How are you...
Please mention on which operating system your compiling this programme.

Marco wrote:
Could anyone please tell me why the program has the following error? I
copy the program from http://www.beyondlogic.org/parlcd/parlcd.htm
/////////////////////////////////////////////////////////////////////
#include <dos.h>
#include <string.h>
#include <stdio.h>

#define PORTADDRESS 0x378 /* Enter Your Port Address Here */

#define DATA PORTADDRESS+0
#define STATUS PORTADDRESS+1
#define CONTROL PORTADDRESS+2

void main(void)
{
char string[] = {"Testing 1,2,3 "
"It' Works ! "};
char init[10];
int count;
int len;
init[0] = 0x0F; /* Init Display */
init[1] = 0x01; /* Clear Display */
init[2] = 0x38; /* Dual Line / 8 Bits */

outportb(CONTROL, inportb(CONTROL) & 0xDF); /* Reset Control Port -
Make sure Forward Direction */

outportb(CONTROL, inportb(CONTROL) | 0x08); /* Set Select Printer
(Register Select) */

for (count = 0; count <= 2; count++)
{
outportb(DATA, init[count]);
outportb(CONTROL,inportb(CONTROL) | 0x01); /* Set Strobe (Enable)*/
delay(20); /* Larger Delay for INIT
*/
outportb(CONTROL,inportb(CONTROL) & 0xFE); /* Reset Strobe
(Enable)*/
delay(20); /* Larger Delay for INIT
*/
}

outportb(CONTROL, inportb(CONTROL) & 0xF7); /* Reset Select Printer
(Register Select) */

len = strlen(string);

for (count = 0; count < len; count++)
{
outportb(DATA, string[count]);
outportb(CONTROL,inportb(CONTROL) | 0x01); /* Set Strobe */
delay(2);
outportb(CONTROL,inportb(CONTROL) & 0xFE); /* Reset Strobe */
delay(2);
}
}
////////////////////////////////////////////////////////////////////////////////
--------------------Configuration: Text1 - Win32
Debug--------------------
Compiling...
Text1.c
C:\Program Files\Microsoft Visual Studio\Text1.c(22) : error C2065:
'outportb' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\Text1.c(22) : error C2065:
'inportb' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\Text1.c(30) : error C2065:
'delay' : undeclared identifier
Jul 10 '06 #10

P: n/a
MS VC++

pnreddy1...@gmail.com 寫道:
Hi,Macro.
How are you...
Please mention on which operating system your compiling this programme.

Marco wrote:
Could anyone please tell me why the program has the following error? I
copy the program from http://www.beyondlogic.org/parlcd/parlcd.htm
/////////////////////////////////////////////////////////////////////
#include <dos.h>
#include <string.h>
#include <stdio.h>

#define PORTADDRESS 0x378 /* Enter Your Port Address Here */

#define DATA PORTADDRESS+0
#define STATUS PORTADDRESS+1
#define CONTROL PORTADDRESS+2

void main(void)
{
char string[] = {"Testing 1,2,3 "
"It' Works ! "};
char init[10];
int count;
int len;
init[0] = 0x0F; /* Init Display */
init[1] = 0x01; /* Clear Display */
init[2] = 0x38; /* Dual Line / 8 Bits */

outportb(CONTROL, inportb(CONTROL) & 0xDF); /* Reset Control Port -
Make sure Forward Direction */

outportb(CONTROL, inportb(CONTROL) | 0x08); /* Set Select Printer
(Register Select) */

for (count = 0; count <= 2; count++)
{
outportb(DATA, init[count]);
outportb(CONTROL,inportb(CONTROL) | 0x01); /* Set Strobe (Enable)*/
delay(20); /* Larger Delay for INIT
*/
outportb(CONTROL,inportb(CONTROL) & 0xFE); /* Reset Strobe
(Enable)*/
delay(20); /* Larger Delay for INIT
*/
}

outportb(CONTROL, inportb(CONTROL) & 0xF7); /* Reset Select Printer
(Register Select) */

len = strlen(string);

for (count = 0; count < len; count++)
{
outportb(DATA, string[count]);
outportb(CONTROL,inportb(CONTROL) | 0x01); /* Set Strobe */
delay(2);
outportb(CONTROL,inportb(CONTROL) & 0xFE); /* Reset Strobe */
delay(2);
}
}
////////////////////////////////////////////////////////////////////////////////
--------------------Configuration: Text1 - Win32
Debug--------------------
Compiling...
Text1.c
C:\Program Files\Microsoft Visual Studio\Text1.c(22) : error C2065:
'outportb' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\Text1.c(22) : error C2065:
'inportb' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\Text1.c(30) : error C2065:
'delay' : undeclared identifier
Jul 10 '06 #11

P: n/a
Marco wrote:
Could anyone please tell me why the program has the following error? I
copy the program from http://www.beyondlogic.org/parlcd/parlcd.htm
There are many things that could cause your problems. The program uses
many things which are not part of C and must be provided from some
outside source. Some of these seem not to be provided by your (or many
other implementations). This makes the program implementation-specific,
and there are no doubt MS-specific newsgroups to address those problems.

In addition, there are constructs which are not C at all.

#include <dos.h>
This header does not exist as a standard C header. Think about it: for
how many systems does the whole concept of "dos" make no sense at all,
or for which "dod" doesn't mean some variant of MS-DOS (some of my old
PDP-8s ran "DOS", for example).

#define PORTADDRESS 0x378 /* Enter Your Port Address Here */
This and the three defines based on it suggest that you are trying to
directly access hardware. Nothing in C guarantees you can do this, and
many operating systems forbid you to do this.
void main(void)
main does *not* have a return type of void. main returns an int.
Defining it otherwise makes your program beyond the pale, and the
compiler need not produce anything useful.
outportb(CONTROL, inportb(CONTROL) & 0xDF); /* Reset Control Port -
Make sure Forward Direction */
There are no standard functions outportb() or inportb(). If they exist
on your implementation, they may well need to be linked. Whether they
exist or not or your implementation, a program using them is not
portable, possibly not even to another version of the same compiler on
the same platform. Your error messages suggest that your implementation
does not have them, at least not without linking some
implementation-specific code, which linking you have not done.
delay(20); /* Larger Delay for INIT
There is no standard function delay(). The comments above apply.

Finally, you should (and must in pre-C99 C) return a value from main.
Since you do not include <stdlib.h>, the only return value with portably
defined meaning is 0. With <stdlib.hincluded, the return values
portably defined include in addition EXIT_SUCCESS and EXIT_FAILURE.

}
Jul 10 '06 #12

P: n/a
Marco wrote:

I want to know whether outportb, delay and inportb are function in
general function in C? (I have no experience in C at all.) If they are
general function in C, how I can define them?
Thanks

These are old DOS functions that some compilers used to provide. They
are standard, and aren't usually available for Windows (you mention
VC++ elsewhere).


Brian
Jul 10 '06 #13

P: n/a
In article <11*********************@h48g2000cwc.googlegroups. com>,
Marco <mo******@gmail.comwrote:
>Could anyone please tell me why the program has the following error? I
copy the program from http://www.beyondlogic.org/parlcd/parlcd.htm
....
>C:\Program Files\Microsoft Visual Studio\Text1.c(22) : error C2065:
'outportb' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\Text1.c(22) : error C2065:
'inportb' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\Text1.c(30) : error C2065:
'delay' : undeclared identifier
outportb(), inportb(), and delay() are not standard C functions.

Further, assuming that outportb() and inportb() do not have anything
to do with ship navigation and refer to Intel *86 I/O ports, these
functions require privileges no reasonable OS will allow an ordinary
user to have - so even if you get it to compile, it won't run for
an unprivileged user. Reasonable OS: UNIX, Linux, recent versions
of Windows. Unreasonable OS: Windows 3.1 (I think), MS-DOS, CP/M
86.

Gordon L. Burditt
Jul 10 '06 #14

P: n/a
Marco wrote:
Could anyone please tell me why the program has the following error? I
copy the program from http://www.beyondlogic.org/parlcd/parlcd.htm
/////////////////////////////////////////////////////////////////////
#include <dos.h>
#include <string.h>
#include <stdio.h>

#define PORTADDRESS 0x378 /* Enter Your Port Address Here */

#define DATA PORTADDRESS+0
#define STATUS PORTADDRESS+1
#define CONTROL PORTADDRESS+2

void main(void)
{
char string[] = {"Testing 1,2,3 "
"It' Works ! "};
char init[10];
int count;
int len;
init[0] = 0x0F; /* Init Display */
init[1] = 0x01; /* Clear Display */
init[2] = 0x38; /* Dual Line / 8 Bits */

outportb(CONTROL, inportb(CONTROL) & 0xDF); /* Reset Control Port -
Make sure Forward Direction */

outportb(CONTROL, inportb(CONTROL) | 0x08); /* Set Select Printer
(Register Select) */

for (count = 0; count <= 2; count++)
{
outportb(DATA, init[count]);
outportb(CONTROL,inportb(CONTROL) | 0x01); /* Set Strobe (Enable)*/
delay(20); /* Larger Delay for INIT
*/
outportb(CONTROL,inportb(CONTROL) & 0xFE); /* Reset Strobe
(Enable)*/
delay(20); /* Larger Delay for INIT
*/
}

outportb(CONTROL, inportb(CONTROL) & 0xF7); /* Reset Select Printer
(Register Select) */

len = strlen(string);

for (count = 0; count < len; count++)
{
outportb(DATA, string[count]);
outportb(CONTROL,inportb(CONTROL) | 0x01); /* Set Strobe */
delay(2);
outportb(CONTROL,inportb(CONTROL) & 0xFE); /* Reset Strobe */
delay(2);
}
}
////////////////////////////////////////////////////////////////////////////////
--------------------Configuration: Text1 - Win32
Debug--------------------
Compiling...
Text1.c
C:\Program Files\Microsoft Visual Studio\Text1.c(22) : error C2065:
'outportb' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\Text1.c(22) : error C2065:
'inportb' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\Text1.c(30) : error C2065:
'delay' : undeclared identifier

Beside the programming issues posted, you have a worse problem.
You have MS-DOS code. Windows, NT, 2000, & XP will not let a user app
write to hardware. The code can not be fixed to do what you want.
You need to find one of the Parallel port drivers available on the net.
Jul 10 '06 #15

P: n/a
Neil wrote:
Marco wrote:
>Could anyone please tell me why the program has the following error? I
copy the program from http://www.beyondlogic.org/parlcd/parlcd.htm
/////////////////////////////////////////////////////////////////////
#include <dos.h>
#include <string.h>
#include <stdio.h>

#define PORTADDRESS 0x378 /* Enter Your Port Address Here */

#define DATA PORTADDRESS+0
#define STATUS PORTADDRESS+1
#define CONTROL PORTADDRESS+2

void main(void)
{
char string[] = {"Testing 1,2,3 "
"It' Works ! "};
char init[10];
int count;
int len;
init[0] = 0x0F; /* Init Display */
init[1] = 0x01; /* Clear Display */
init[2] = 0x38; /* Dual Line / 8 Bits */

outportb(CONTROL, inportb(CONTROL) & 0xDF); /* Reset Control Port -
Make sure Forward Direction */

outportb(CONTROL, inportb(CONTROL) | 0x08); /* Set Select Printer
(Register Select) */

for (count = 0; count <= 2; count++)
{
outportb(DATA, init[count]);
outportb(CONTROL,inportb(CONTROL) | 0x01); /* Set Strobe (Enable)*/
delay(20); /* Larger Delay for INIT
*/
outportb(CONTROL,inportb(CONTROL) & 0xFE); /* Reset Strobe
(Enable)*/
delay(20); /* Larger Delay for INIT
*/
}

outportb(CONTROL, inportb(CONTROL) & 0xF7); /* Reset Select Printer
(Register Select) */

len = strlen(string);

for (count = 0; count < len; count++)
{
outportb(DATA, string[count]);
outportb(CONTROL,inportb(CONTROL) | 0x01); /* Set Strobe */
delay(2);
outportb(CONTROL,inportb(CONTROL) & 0xFE); /* Reset Strobe */
delay(2);
}
}
////////////////////////////////////////////////////////////////////////////////

--------------------Configuration: Text1 - Win32
Debug--------------------
Compiling...
Text1.c
C:\Program Files\Microsoft Visual Studio\Text1.c(22) : error C2065:
'outportb' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\Text1.c(22) : error C2065:
'inportb' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\Text1.c(30) : error C2065:
'delay' : undeclared identifier


Beside the programming issues posted, you have a worse problem.
You have MS-DOS code. Windows, NT, 2000, & XP will not let a user app
write to hardware. The code can not be fixed to do what you want.
You need to find one of the Parallel port drivers available on the net.
Yes it can,google for userport.zip
Sometimes computers are used to control
hardware :)
Outportb and inportb might be outp and inp.
Jul 10 '06 #16

P: n/a
Hi macro,
while ur using these functions don't use directly.
u replace like
Ex :
inp as _inp;
outp as _outp
may be thse will work for u
Reddy
Could anyone please tell me why the program has the following error? I
copy the program from http://www.beyondlogic.org/parlcd/parlcd.htm
/////////////////////////////////////////////////////////////////////
#include <dos.h>
#include <string.h>
#include <stdio.h>

#define PORTADDRESS 0x378 /* Enter Your Port Address Here */

#define DATA PORTADDRESS+0
#define STATUS PORTADDRESS+1
#define CONTROL PORTADDRESS+2

void main(void)
{
char string[] = {"Testing 1,2,3 "
"It' Works ! "};
char init[10];
int count;
int len;
init[0] = 0x0F; /* Init Display */
init[1] = 0x01; /* Clear Display */
init[2] = 0x38; /* Dual Line / 8 Bits */

outportb(CONTROL, inportb(CONTROL) & 0xDF); /* Reset Control Port -
Make sure Forward Direction */

outportb(CONTROL, inportb(CONTROL) | 0x08); /* Set Select Printer
(Register Select) */

for (count = 0; count <= 2; count++)
{
outportb(DATA, init[count]);
outportb(CONTROL,inportb(CONTROL) | 0x01); /* Set Strobe (Enable)*/
delay(20); /* Larger Delay for INIT
*/
outportb(CONTROL,inportb(CONTROL) & 0xFE); /* Reset Strobe
(Enable)*/
delay(20); /* Larger Delay for INIT
*/
}

outportb(CONTROL, inportb(CONTROL) & 0xF7); /* Reset Select Printer
(Register Select) */

len = strlen(string);

for (count = 0; count < len; count++)
{
outportb(DATA, string[count]);
outportb(CONTROL,inportb(CONTROL) | 0x01); /* Set Strobe */
delay(2);
outportb(CONTROL,inportb(CONTROL) & 0xFE); /* Reset Strobe */
delay(2);
}
}
////////////////////////////////////////////////////////////////////////////////
--------------------Configuration: Text1 - Win32
Debug--------------------
Compiling...
Text1.c
C:\Program Files\Microsoft Visual Studio\Text1.c(22) : error C2065:
'outportb' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\Text1.c(22) : error C2065:
'inportb' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\Text1.c(30) : error C2065:
'delay' : undeclared identifier
Jul 10 '06 #17

P: n/a
"Marco" <mo******@gmail.comwrites:
--------------------Configuration: Text1 - Win32
Debug--------------------
Compiling...
Text1.c
C:\Program Files\Microsoft Visual Studio\Text1.c(22) : error C2065:
'outportb' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\Text1.c(22) : error C2065:
'inportb' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\Text1.c(30) : error C2065:
'delay' : undeclared identifier

It looks suspiciously like you tried to use functions that you haven't
declared or defined.

I want to know whether outportb, delay and inportb are function in
general function in C? (I have no experience in C at all.) If they are
general function in C, how I can define them?
No, outportb, delay, and inportb are not standard C functions.
They're system-specific. If you need more information about them,
you'll need to ask in a system-specific newsgroup, possibly
comp.os.msdos.programmer. (That's assuming that Rouben Rostamian to
read the information on the web site doesn't solve your problem.)

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Jul 10 '06 #18

P: n/a
Default User wrote:
>
Marco wrote:
I want to know whether outportb, delay and inportb are function in
general function in C?
These are old DOS functions that some compilers used to provide. They
are standard, and aren't usually available for Windows (you mention
VC++ elsewhere).
I don't know what you think you mean by "They are standard",
but those functions are not described in the C standard.

--
pete
Jul 10 '06 #19

P: n/a
pete wrote:
Default User wrote:
>>
Marco wrote:
I want to know whether outportb, delay and inportb are function in
general function in C?
>These are old DOS functions that some compilers used to provide. They
are standard, and aren't usually available for Windows (you mention
VC++ elsewhere).

I don't know what you think you mean by "They are standard",
but those functions are not described in the C standard.
I think "are" is a negatypo for "aren't".

--
Chris "beware the dreaded negasphere" Dollin
"Who do you serve, and who do you trust?" /Crusade/

Jul 10 '06 #20

P: n/a
Chris Dollin wrote:
pete wrote:
>Default User wrote:
>>Marco wrote:

I want to know whether outportb, delay and inportb are function in
general function in C?
These are old DOS functions that some compilers used to provide. They
are standard, and aren't usually available for Windows (you mention
VC++ elsewhere).
I don't know what you think you mean by "They are standard",
but those functions are not described in the C standard.

I think "are" is a negatypo for "aren't".
I think not because it was followed by the word not, so pete just didn't
use the contraction of "are not".
--
Flash Gordon, living in interesting times.
Web site - http://home.flash-gordon.me.uk/
comp.lang.c posting guidelines and intro:
http://clc-wiki.net/wiki/Intro_to_clc
Jul 10 '06 #21

P: n/a
Flash Gordon wrote:
Chris Dollin wrote:
>pete wrote:
>>Default User wrote:
Marco wrote:

I want to know whether outportb, delay and inportb are function in
general function in C?
These are old DOS functions that some compilers used to provide. They
are standard, and aren't usually available for Windows (you mention
VC++ elsewhere).
I don't know what you think you mean by "They are standard",
but those functions are not described in the C standard.

I think "are" is a negatypo for "aren't".

I think not because it was followed by the word not, so pete just didn't
use the contraction of "are not".
Not in /pete's/ posting, in /Default User's/.

But I should have been less ambiguous.

--
Chris "story of my life" Dollin
"Life is full of mysteries. Consider this one of them." Sinclair, /Babylon 5/

Jul 10 '06 #22

P: n/a
Chris Dollin wrote:
pete wrote:
Default User wrote:
>>They are standard,
I don't know what you think you mean by "They are standard",
but those functions are not described in the C standard.

I think "are" is a negatypo for "aren't".
Ow. Yes, of course, as the rest of the text should have made plain.

I hate when that happens.

Brian

Jul 10 '06 #23

P: n/a
Sjouke Burry wrote:
Neil wrote:
>Marco wrote:
>>Could anyone please tell me why the program has the following error? I
copy the program from http://www.beyondlogic.org/parlcd/parlcd.htm
/////////////////////////////////////////////////////////////////////
#include <dos.h>
#include <string.h>
#include <stdio.h>

#define PORTADDRESS 0x378 /* Enter Your Port Address Here */

#define DATA PORTADDRESS+0
#define STATUS PORTADDRESS+1
#define CONTROL PORTADDRESS+2

void main(void)
{
char string[] = {"Testing 1,2,3 "
"It' Works ! "};
char init[10];
int count;
int len;
init[0] = 0x0F; /* Init Display */
init[1] = 0x01; /* Clear Display */
init[2] = 0x38; /* Dual Line / 8 Bits */

outportb(CONTROL, inportb(CONTROL) & 0xDF); /* Reset Control Port -
Make sure Forward Direction */

outportb(CONTROL, inportb(CONTROL) | 0x08); /* Set Select Printer
(Register Select) */

for (count = 0; count <= 2; count++)
{
outportb(DATA, init[count]);
outportb(CONTROL,inportb(CONTROL) | 0x01); /* Set Strobe (Enable)*/
delay(20); /* Larger Delay for INIT
*/
outportb(CONTROL,inportb(CONTROL) & 0xFE); /* Reset Strobe
(Enable)*/
delay(20); /* Larger Delay for INIT
*/
}

outportb(CONTROL, inportb(CONTROL) & 0xF7); /* Reset Select Printer
(Register Select) */

len = strlen(string);

for (count = 0; count < len; count++)
{
outportb(DATA, string[count]);
outportb(CONTROL,inportb(CONTROL) | 0x01); /* Set Strobe */
delay(2);
outportb(CONTROL,inportb(CONTROL) & 0xFE); /* Reset Strobe */
delay(2);
}
}
////////////////////////////////////////////////////////////////////////////////

--------------------Configuration: Text1 - Win32
Debug--------------------
Compiling...
Text1.c
C:\Program Files\Microsoft Visual Studio\Text1.c(22) : error C2065:
'outportb' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\Text1.c(22) : error C2065:
'inportb' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\Text1.c(30) : error C2065:
'delay' : undeclared identifier


Beside the programming issues posted, you have a worse problem.
You have MS-DOS code. Windows, NT, 2000, & XP will not let a user app
write to hardware. The code can not be fixed to do what you want.
You need to find one of the Parallel port drivers available on the net.
Yes it can,google for userport.zip
Sometimes computers are used to control
hardware :)
Outportb and inportb might be outp and inp.
Like I said userport.zip is a "a simple kernel mode driver for Windows
NT/2000/XP"
Jul 11 '06 #24

This discussion thread is closed

Replies have been disabled for this discussion.