parallel port programming using C

Discussion in 'C Programming' started by nik, May 7, 2006.

  1. nik

    nik Guest

    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
     
    nik, May 7, 2006
    #1
    1. Advertising

  2. In article <>,
    nik <> wrote:
    > 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>


    Sorry, that is DOS/Windows specific: you will need to ask in
    a DOS/Windows newsgroup.
    --
    "law -- it's a commodity"
    -- Andrew Ryan (The Globe and Mail, 2005/11/26)
     
    Walter Roberson, May 7, 2006
    #2
    1. Advertising

  3. "nik" <> wrote in message
    news:...
    > 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<stdlib.h> /* missing */

    > 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
     
    Rod Pemberton, May 7, 2006
    #3
  4. nik wrote:
    > 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).

    --
    Julian V. Noble
    Professor Emeritus of Physics
    University of Virginia
     
    Julian V. Noble, May 7, 2006
    #4
    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. karthik
    Replies:
    5
    Views:
    11,068
    Dale King
    Jul 25, 2003
  2. Paul Perrone
    Replies:
    0
    Views:
    14,505
    Paul Perrone
    Aug 21, 2003
  3. b3ny
    Replies:
    11
    Views:
    957
    Babu Kalakrishnan
    Nov 20, 2004
  4. Novice Experl
    Replies:
    6
    Views:
    6,736
    c d saunter
    Aug 3, 2005
  5. Soren
    Replies:
    4
    Views:
    1,343
    c d saunter
    Feb 14, 2008
Loading...

Share This Page