M
Marco
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
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