parallel port programming using C

N

nik

hello frinds,
last night i am using C prog to get output at my
parallel port the following source code is
#include<dos.h>
#include<conio.h>
#include<process.h>
void main()
{
outportb( 0x378,00ff);
delay(1000);
outportb(0x378,0000);
delay(1000);
}
i have conected a bulb between LED PIN 2 & PIN 25 .the LED is not
glowing. what r the reasons Plz tell me .Can we get output in serial
port using int17 if yes plz tell me the code for it.Can this code is
working properly for my pc (configuration r AMD 3200+ processor and
ASUS motherboard) .
waiting for ur response
 
R

Rod Pemberton

nik said:
hello frinds,
last night i am using C prog to get output at my
parallel port the following source code is

You have standard C coding errors:
#include<dos.h>
#include<conio.h>
#include<process.h>

#include said:
void main()

int main(void) /* corrected */
{
outportb( 0x378,00ff);

/* this could be a problem */
/* you're compiler may be using the 00 from 00ff */
/* as the byte which is being output to port 0x378 */

outportb(0x378,0xff); /* you want a byte in hex */
delay(1000);
outportb(0x378,0000);

outportb(0x378,0x00); /* not needed, but I like it in hex */
delay(1000);

return(EXIT_SUCCESS); /* missing */
i have conected a bulb between LED PIN 2 & PIN 25 .the LED is not
glowing. what r the reasons Plz tell me .Can we get output in serial
port using int17 if yes plz tell me the code for it.Can this code is
working properly for my pc (configuration r AMD 3200+ processor and
ASUS motherboard) .
waiting for ur response

I don't know anything about that stuff...


Rod Pemberton
 
J

Julian V. Noble

nik said:
hello frinds,
last night i am using C prog to get output at my
parallel port the following source code is
#include<dos.h>
#include<conio.h>
#include<process.h>
void main()
{
outportb( 0x378,00ff);
delay(1000);
outportb(0x378,0000);
delay(1000);
}
i have conected a bulb between LED PIN 2 & PIN 25 .the LED is not
glowing. what r the reasons Plz tell me .Can we get output in serial
port using int17 if yes plz tell me the code for it.Can this code is
working properly for my pc (configuration r AMD 3200+ processor and
ASUS motherboard) .
waiting for ur response

If your C runs under DOS and you are using DOS then it should work.

However, if you are using Windoze you can't because it prevents you
from getting access to any of the silicon. There are workarounds
(software interfaces) available that let you avail yourself of the
machine's resources, but I don't know current versions. I suggest
you Google for "Parallel port access under Windoze xxx" (your version
here).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,263
Messages
2,571,062
Members
48,769
Latest member
Clifft

Latest Threads

Top