Parallel port is the most simplest port of computer to use. It is too simple to use in Turbo C++ .
there are two types of parallel ports of computer
1. SPP (standard parallel port) = 0x3bc
2. ECP (Enhanced communication port) or EPP(Enhanced parallel port) = 0x378
parallel port is divided into three ports
1. DATA port = 0x3bc OR 0x378
2. control port = 0x3bd OR 0x379
3. status port = 0x3be OR 0x37a
data port is consists of 8 pins and use 8 bit binary code for controlling..
D7 D6 D5 D4 D3 D2 D1 D0
128 64 32 16 8 4 2 1
1 1 1 1 1 1 1 1 = 255..................send 255 int as data for binary all 1s
D7 D6 D5 D4 D3 D2 D1 D0
128 64 32 16 8 4 2 1
0 0 0 0 0 0 0 0 = 0..............send 0 int as data for binary all 0s
D7 D6 D5 D4 D3 D2 D1 D0
128 64 32 16 8 4 2 1
0 0 0 1 0 0 0 0 = 16............send 16 int as data for binary 1 in pin (D0)
D0= pin 2
D1= pin 3
D2= pin 4
D3= pin 5
D4= pin 6
D5= pin 7
D6= pin 8
D7= pin 9
outp(port,data); is the function use send data to the ports.
where ,
port is the integer value of port..... 0x378 or 0x3bc or 0x379 or 0x3bd or 0x37a or 0x3be.
data is an integer value to send ..ranges from 0 to 255
data=inp(port); is the function to receive input from port.
data is integer data .....0-255
port is the integer value of port..... 0x378 or 0x3bc or 0x379 or 0x3bd or 0x37a or 0x3be.
Example:
#include<stdio.h>
#include<conio.h>
#include<dos.h>
void main (void)
{
int data=0, portin=0x37a, portout=0x378;
//send 255 to port....using data pins.
data=255;
outp(portout,data);
//input from port using status pins...
data=inp(portin);
printf("\n%d",data);
getch();
}
In this way we control parallel port in turbo C++
You cannot directly access the parallel port because the operating system is managing that device. Use the file system. The name of the parallel port is "lpt1:". Open that as an ordinary file for write, write to it, and you will be writing on the parallel port.
you can test it by using software& hardware.After connecting the parallel port in your cpu's back side and connect a small wire between 2 & 3 pin on another end of the cable ,then run a c program(in dos) fro transmiter and receiver.If ur parallel port is working then u can see both transmitted data & received data on ur PC.
Turbo C compiles c source. turbo c++ compiles c++ source code.
The command, parallelput sends binary information to the parallel port on a PC. The command appears in a number of different computer programming languages such as C/C++ and Delphi but may have equivalents in other languages. It's worth noting that most modern PC clone computers don't have a parallel port anymore. On older machines it was used to drive the printer and was noticable by its large 25 way D connector and flat ribbon cable. The data lines of a parallel port are 8 bit (0-255) and labelled DB0 through DB7. In C the command is parallelput (value) where the value is the 8 bit binary value to be sent to the parallel (print) connector. Therefore the command in parallelput (3) would send the binary 00000011 to the parallel port which would in turn switch on DB0 and DB1 on the port. The parallel port is bidirectional and thus can receive information too using the parallelget command. Chris Neary Bsc hons FdSc
turbo c cannot execute c++ as well..since c++ is the superset of c .the cprograms can be compiled in turbo c++.
Turbo C is a compiler for a general purpose computer programming language called C. It transforms code written in C into the computer language needed for executable programming.
+ += - -= * *= / /= % %= = == != <= >= & && | ^ ~ << <<= >> >>= , [] () are the basic operator in TURBO C
+ += - -= * *= / /= % %= = == != <= >= & && | ^ ~ << <<= >> >>= , [] () are the basic operator in TURBO C
parport.sys - usually located in C:\Windows\system32\DRIVERS\
turbo is word to do the programming language in c & c++ and i do no about borland
turbo c is a compiler and c++ is a programming language.
1. Turbo C is an example of Integrated Developing Environment. 2. Turbo C has example programs, the most important is bgidemo.c