并口编程简单问题 [英] parallel port programming simple problem
问题描述
有谁能告诉我为什么该程序有以下错误?我
从 http:// www复制该程序.beyondlogic.org / parlcd / parlcd.htm
//////////////////////////// /////////////////////////////////////////
#包括< dos.h>
#include< string.h>
#include< stdio.h>
#define PORTADDRESS 0x378 / *在此处输入您的港口地址* /
#define DATA PORTADDRESS + 0
#define状态PORTADDRESS + 1
#define CONTROL PORTADDRESS + 2
void main(无效)
{
char string [] = { 测试1,2,3
它'有效! "};
char init [10];
int count;
int len;
init [ 0] = 0x0F; / *初始化显示* /
init [1] = 0x01; / *清除显示* /
init [2] = 0x38; / *双线/ 8位* /
outportb(CONTROL,inportb(CONTROL)& 0xDF); / *重置控制端口 -
确保正向* /
outportb(CONTROL,inportb(CONTROL)| 0x08); / *设置选择打印机
(注册选择)* /
for(count = 0; count< = 2; count ++)
{
outportb(DATA,init [count]);
outportb(CONTROL,inportb(CONTROL)| 0x01); / *设置选通(启用)* /
延迟(20); / * INIT的延迟较大
* /
outportb(CONTROL,inportb(CONTROL)& 0xFE); / *重置频闪
(启用)* /
延迟(20); / * INIT更大延迟
* /
}
outportb(CONTROL,inportb(CONTROL)& 0xF7); / *重置选择打印机
(注册选择)* /
len = strlen(字符串);
for(count = 0; count< len; count ++)
{
outportb(DATA,string [count]);
outportb( CONTROL,inportb(CONTROL)| 0x01); / *设置Strobe * /
延迟(2);
outportb(CONTROL,inportb(CONTROL)& 0xFE); / *重置频闪* /
延迟(2);
}
}
///// ////////////////////////////////////////////////// /////////////////////////
----------------- ---配置:Text1 - Win32
调试--------------------
编译......
Text1.c
C:\Program Files\Microsoft Visual Studio \Text1.c(22):错误C2065:
' 'outportb'':未声明的标识符
C:\Program Files \ Microsoft Visual Studio\Text1.c(22):错误C2065:
''inportb' ':未声明的标识符
C:\Program Files\Microsoft Visual Studio \Text1.c(30):错误C2065:
''延迟'':未声明标识符
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
推荐答案
2006-07-10,Marco< mo ****** @ gmail.comwrote:
On 2006-07-10, Marco <mo******@gmail.comwrote:
有谁能告诉我为什么程序有以下错误?我
从 http:// www复制该程序.beyondlogic.org / parlcd / parlcd.htm
//////////////////////// /////////////////////////////////////////////
#include< dos.h>
#include< string.h>
#include< stdio.h>
>
#define PORTADDRESS 0x378 / *在此输入您的港口地址* /
#define DATA PORTADDRESS + 0
#define STATUS PORTADDRESS + 1
#define CONTROL PORTADDRESS + 2
void main(无效)
{
char string [] = {"测试1,2,3"
"它'有效! "};
char init [10];
int count;
int len;
init [ 0] = 0x0F; / *初始化显示* /
init [1] = 0x01; / *清除显示* /
init [2] = 0x38; / *双线/ 8位* /
outportb(CONTROL,inportb(CONTROL)& 0xDF); / *重置控制端口 -
确保正向* /
outportb(CONTROL,inportb(CONTROL)| 0x08); / *设置选择打印机
(注册选择)* /
for(count = 0; count< = 2; count ++)
{
outportb(DATA,init [count]);
outportb(CONTROL,inportb(CONTROL)| 0x01); / *设置选通(启用)* /
延迟(20); / * INIT的延迟较大
* /
outportb(CONTROL,inportb(CONTROL)& 0xFE); / *重置频闪
(启用)* /
延迟(20); / * INIT更大延迟
* /
}
outportb(CONTROL,inportb(CONTROL)& 0xF7); / *重置选择打印机
(注册选择)* /
len = strlen(字符串);
for(count = 0; count< len; count ++)
{
outportb(DATA,string [count]);
outportb( CONTROL,inportb(CONTROL)| 0x01); / *设置Strobe * /
延迟(2);
outportb(CONTROL,inportb(CONTROL)& 0xFE); / *重置频闪* /
延迟(2);
}
}
///// ////////////////////////////////////////////////// /////////////////////////
------------- -------配置:Text1 - Win32
调试--------------------
编译...
Text1.c
C:\Program Files\Microsoft Visual Studio \Text1.c(22):错误C2065:
''outportb'':未声明的标识符
C:\Program Files \ Microsoft Visual Studio\Text1.c(22):错误C2065:
''inportb'':未声明的标识符
C:\Program Files\Microsoft Visual Studio \Text1.c(30):错误C2065:
''延迟'':未声明的标识符
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
看起来很可疑,就像你试图使用你没有声明或定义的
的函数一样。 />
-
Andrew Poelstra< http://www.wpsoftware.net/projects/>
To给我发电子邮件,使用apoelstra在上述领域。
你们人讨厌数学。 - James Harris
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
--------------------配置:Text1 - Win32
--------------------Configuration: Text1 - Win32
Debug --------------------
编译.. 。
Text1.c
C:\Program Files\Microsoft Visual Studio \Text1.c(22):错误C2065:
''outportb'':未声明的标识符
C:\Program Files \ Microsoft Visual Studio\Text1.c(22):错误C2065:
'' inportb'':未声明的标识符
C:\Program Files \ Microsoft Visual Studio\Text1.c(30):错误C2065:
''延迟'' :未声明的标识符
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
看起来很可疑,就像你试图使用你没有声明或定义的
的函数一样。
-
Andrew Poelstra< http://www.wpsoftware.net/projects/>
给我发电子邮件,请使用& ; apoelstra"在上述领域。
你们人讨厌数学。 - James Harris
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
我想知道outportb,delay和inportb是否在C中的一般函数中起作用? (我根本没有C语言的经验。)如果他们是C的一般函数,那我怎么定义它们?
谢谢
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
在文章< 11 ********************* @ h48g2000cwc.googlegroups中。 com>,
Marco< mo ****** @ gmail.comwrote:
In article <11*********************@h48g2000cwc.googlegroups. com>,
Marco <mo******@gmail.comwrote:
>有谁能告诉我为什么该程序有以下错误?我从 http://www.beyondlogic.org复制该程序/parlcd/parlcd.htm
....
....
>
- ------------------配置:Text1 - Win32
调试--------------------
Text1.c
C:\Program Files\Microsoft Visual Studio \Text1.c(22):错误C2065:
''outportb'':未声明的标识符
>
--------------------Configuration: Text1 - Win32
Debug--------------------
Compiling...
Text1.c
C:\Program Files\Microsoft Visual Studio\Text1.c(22) : error C2065:
''outportb'' : undeclared identifier
阅读网站上的节目列表之后的句子
你引用的
。
-
Rouben Rostamian
Read the sentence just after the program listing in the website
you have cited.
--
Rouben Rostamian
这篇关于并口编程简单问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!