473,850 Members | 2,032 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

parallel port programming simple problem

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(CONTRO L, inportb(CONTROL ) & 0xDF); /* Reset Control Port -
Make sure Forward Direction */

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

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

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

len = strlen(string);

for (count = 0; count < len; count++)
{
outportb(DATA, string[count]);
outportb(CONTRO L,inportb(CONTR OL) | 0x01); /* Set Strobe */
delay(2);
outportb(CONTRO L,inportb(CONTR OL) & 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
23 4164
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(CONTRO L, inportb(CONTROL ) & 0xDF); /* Reset Control Port -
Make sure Forward Direction */

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

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

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

len = strlen(string);

for (count = 0; count < len; count++)
{
outportb(DATA, string[count]);
outportb(CONTRO L,inportb(CONTR OL) | 0x01); /* Set Strobe */
delay(2);
outportb(CONTRO L,inportb(CONTR OL) & 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
--------------------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
In article <11************ *********@h48g2 000cwc.googlegr oups.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
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,in p(CONTROL) | 0x01); /* Set Strobe (Enable)*/
delay(20); /* Larger Delay for INIT
*/
outp(CONTROL,in p(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,in p(CONTROL) | 0x01); /* Set Strobe */
delay(2);
outp(CONTROL,in p(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
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
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
In article <11************ **********@b28g 2000cwb.googleg roups.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.program mer.win32

--
Rouben Rostamian

Jul 10 '06 #8
"Marco" <mo******@gmail .comwrote in message
news:11******** *************@h 48g2000cwc.goog legroups.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.p rogrammer for this question.

- Bill
Jul 10 '06 #9
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(CONTRO L, inportb(CONTROL ) & 0xDF); /* Reset Control Port -
Make sure Forward Direction */

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

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

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

len = strlen(string);

for (count = 0; count < len; count++)
{
outportb(DATA, string[count]);
outportb(CONTRO L,inportb(CONTR OL) | 0x01); /* Set Strobe */
delay(2);
outportb(CONTRO L,inportb(CONTR OL) & 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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1896
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 parallel computation. Key Benefits of SocketPro: Super performance and scalability It is a guarantee that SocketPro based client-server applications
6
7249
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 2000. How can I do this? What do I need to know? It doesn't look like the standard library (the one under my pillow) has that feature. In addition, I've heard that with newer versions of windows don't let you communicate with the port directly,...
10
4989
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, knowledge of fast and practical algorithms is not commonplace." Hume and Sunday, "Fast String Searching", Software - Practice and Experience, Vol. 21 # 11, pp 1221-48
9
8446
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 port ie to send data and to read the state of the parallel port including the control lines. Can anyone help/point me in the correct direction? I have tried the help files and the internet but am unable to find anything relevant. Thanks in...
11
3868
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: linuxfocus.org/English/May2001/article205.shtml). However, I know that this will probably need to be done in low level C. Now, although I can code in C, I don't particularly want to :-) , instead I'd like to use Python. I'm wondering, is there any way I...
12
8640
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 pins. Any Java people know a good solution? I'm trying to use JNI and create my own library, but building the library gives me these errors: ld: warning: cannot find entry symbol _start; defaulting to 0000000008048094 ParallelPort.o: In...
1
5702
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 parallel port pins in java.
4
15374
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 using PyParallel, but the USB->Parallel converter doesn't actually map to the LPT port .. and PyParallel only looks for LPT ports? Has anyone tried doing this? What are my options for controlling parallel connections on a laptop with no parallel...
0
9895
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9741
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11011
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10724
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10351
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9503
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7899
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5735
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4546
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.