Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Please tellme how to access PORT (LPT1) in Linux (GCC)?

i had project to build software for emulating AT89c2051 wich the software is for linux, i don't understain how to acces port LPT or PPI8255 in linux(using GCC or can other compiler)i beg please tell me!

Comments

  • sonu_indiasonu_india Member Posts: 5
    Hi,
    Every Device in Linux is a file in /dev directory.You can access LPT1 by using open system call giving file name "/dev/lp?" . After that you can read and write to the port as a simple file read/write.
    regards,
    Gaurav

  • kendiboykendiboy Member Posts: 2
    : Hi,
    : Every Device in Linux is a file in /dev directory.You can access LPT1 by using open system call giving file name "/dev/lp?" . After that you can read and write to the port as a simple file read/write.
    : regards,
    : Gaurav
    :
    :
    hi1
    thanks U so much for the answer?
    but i mean is how to direct access to the port!
    inthe C++(dos) we caan use OUTPORT() or INPORT() statement.
    how about C++ for linux(gcc)?
    can u tell me more?

    regrad,
    kendiboy
  • sonu_indiasonu_india Member Posts: 5
    : : Hi,
    : : Every Device in Linux is a file in /dev directory.You can access LPT1 by using open system call giving file name "/dev/lp?" . After that you can read and write to the port as a simple file read/write.
    : : regards,
    : : Gaurav
    : :
    : :
    : hi1
    : thanks U so much for the answer?
    : but i mean is how to direct access to the port!
    : inthe C++(dos) we caan use OUTPORT() or INPORT() statement.
    : how about C++ for linux(gcc)?
    : can u tell me more?
    :
    : regrad,
    : kendiboy
    :

    Hi,
    In Borland C++ INPORT and OUTPORT are the functions to access ports. But in Linux gcc all the device ports access is exactly same as files access .You have to open the serial port using open system call same as you open a file
    for ex fp1 = open("/dev/lp0","r");
    Now wherever u want to read(INPORT in BC++) the port use read system call
    for ex read( fp1,...,...);
    and for write(OUTPORT) use write system call...
    for ex write( fp1 ,...,...);
    regards,
    Gaurav


Sign In or Register to comment.