Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > outportb problem

Reply
Thread Tools

outportb problem

 
 
rick
Guest
Posts: n/a
 
      02-10-2006
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");
}
};

 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      02-10-2006
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
 
Reply With Quote
 
 
 
 
Jim Langston
Guest
Posts: n/a
 
      02-11-2006

"rick" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
outportb() / inportb() and Win32 Pegboy C Programming 5 06-28-2010 01:41 PM
Problem problem problem :( Need Help Mike ASP General 2 05-11-2004 08:36 AM



Advertisments