outportb problem

Discussion in 'C++' started by rick, Feb 10, 2006.

  1. rick

    rick Guest

    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");
    }
    };
     
    rick, Feb 10, 2006
    #1
    1. Advertising

  2. 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
     
    Victor Bazarov, Feb 10, 2006
    #2
    1. Advertising

  3. rick

    Jim Langston Guest

    "rick" <> wrote in message
    news:...
    > 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.
     
    Jim Langston, Feb 11, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andreas Suurkuusk
    Replies:
    0
    Views:
    3,982
    Andreas Suurkuusk
    Jul 27, 2003
  2. Ted Miller
    Replies:
    0
    Views:
    5,156
    Ted Miller
    Sep 13, 2003
  3. Merek
    Replies:
    0
    Views:
    1,964
    Merek
    Dec 3, 2003
  4. Pegboy

    outportb() / inportb() and Win32

    Pegboy, Dec 4, 2003, in forum: C Programming
    Replies:
    5
    Views:
    14,858
    michelnacouzi
    Jun 28, 2010
  5. Mike

    Problem problem problem :( Need Help

    Mike, May 7, 2004, in forum: ASP General
    Replies:
    2
    Views:
    550
    Bullschmidt
    May 11, 2004
Loading...

Share This Page