472,095 Members | 2,490 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,095 software developers and data experts.

outportb problem

Greetings to all,

i am not sure this is the write group to post my question to. If it is
not i apologize. In the mean time if you have the answer to my
question please help. THANKS!!

i am trying to write a program using parallel port. I wrote this
program to change the port number to one or zero. I am not able to
change the port number from one to zero. It takes it sever run time to
change from one to zero. WHY? ANY SUGGESTIONS?

#include <conio.h>
#include <stdio.h>
#include <dos.h>

int main()
{
char ch, ch2;

while (getch() != 'E')
{
printf ("please enter z to write zero to the parallel port \n");
printf ("please enter o to write one to the parallel port \n");

ch = getch();
if (ch = = 'z')
{
outportb (0x3BC, 0x00);
printf ("writing 0 to the parallel port \n");
}

if (ch == 'o')

outportb (0x3BC, 0x0F);
printf ("writing one to the parallel port \n");
}
};

Feb 10 '06 #1
2 2793
rick wrote:
i am not sure this is the write group to post my question to. If it is
not i apologize. In the mean time if you have the answer to my
question please help. THANKS!!

i am trying to write a program using parallel port. I wrote this
program to change the port number to one or zero. I am not able to
change the port number from one to zero. It takes it sever run time to
change from one to zero. WHY? ANY SUGGESTIONS?

#include <conio.h>
#include <stdio.h>
#include <dos.h>

[...]


The newsgroup to post your question is 'comp.os.msdos.programmer'.

V
--
Please remove capital As from my address when replying by mail
Feb 10 '06 #2

"rick" <ri******@yahoo.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
Greetings to all,

i am not sure this is the write group to post my question to. If it is
not i apologize. In the mean time if you have the answer to my
question please help. THANKS!!

i am trying to write a program using parallel port. I wrote this
program to change the port number to one or zero. I am not able to
change the port number from one to zero. It takes it sever run time to
change from one to zero. WHY? ANY SUGGESTIONS?

#include <conio.h>
#include <stdio.h>
#include <dos.h>

int main()
{
char ch, ch2;

while (getch() != 'E')
{
printf ("please enter z to write zero to the parallel port \n");
printf ("please enter o to write one to the parallel port \n");

ch = getch();
if (ch = = 'z')
{
outportb (0x3BC, 0x00);
printf ("writing 0 to the parallel port \n");
}

if (ch == 'o')

outportb (0x3BC, 0x0F);
printf ("writing one to the parallel port \n");
}
};


If this is your real code, you are missing breackets after if ( ch=='o' ) to
include the next two lines. Meaning that it would print "writing one to the
parallel port \n" every time. Although it would only set the port if 'o'
was pressed.

Other than that try in a newsgroup appropriate to your OS. I'm guessing
it's windows so try microsoft.public.vc.language.
Feb 11 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Bruce Davis | last post: by
117 posts views Thread by Peter Olcott | last post: by
4 posts views Thread by Pegboy | last post: by
28 posts views Thread by Jon Davis | last post: by
6 posts views Thread by Ammar | last post: by
2 posts views Thread by Mike Collins | last post: by
3 posts views Thread by maheshchintu | last post: by

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.