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 23 4093
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
--------------------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
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
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)
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
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
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
"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
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
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
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.
}
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
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
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.
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.
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
"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.
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
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/
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
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/
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
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" This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Yuancai \(Charlie\) Ye |
last post by:
Hi, All:
I am happy to annouce that we have formally released our latest SocketPro
version 4 at www.udaparts.com, an advanced remoting framework written from
batching/queue, asynchrony and...
|
by: Novice Experl |
last post by:
I'd like to write a simple application that interfaces with the parallel port, and changes the data on it according to keyboard input. I hope I can get it to run under windows xp and / or windows...
|
by: bpontius |
last post by:
The GES Algorithm
A Surprisingly Simple Algorithm for Parallel Pattern Matching
"Partially because the best algorithms presented in the literature
are difficult to understand and to implement,...
|
by: MNQ |
last post by:
Hi All
I want to use my parallel port of my PC to control some external devices. I
am writing a program in ANSI C using the PacificC compiler. What I need to
know is how to access the parallel...
|
by: Isaac T Alston |
last post by:
Basically, I'm thinking about building a robot which can be controlled by
programs which I write, I'm going to interface to the robot through the
parallel port (like in this tutorial here:...
|
by: david.brown.0 |
last post by:
I'm trying to make a Java program access a parallel port. Java's comm
API does not provide me with the control I need. I need to be able to
write to the data and control pins and read the status...
|
by: rajat varshney |
last post by:
I am doing a project on controlling a stepper motor through computer parallel port over a network. I have also done parallel port programming in C but I need some help on how to send output on...
|
by: Soren |
last post by:
Hi,
I want to control some motors using the parallel port.. however, my
laptop does not have any parallel ports (very few do). What I do have
is a USB->Parallel converter... I thought about...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: Aftab Ahmad |
last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below.
Dim IE As Object
Set IE =...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
| |