c++parallel-processingportstatuslpt

inpou32.dll doesn't work on my computer


I've tried to run the following code on my PC. With PORT 0x378 (LPT1 data) it works fine. But with PORT 0x379 (LPT1 status) it always returns 126 no matter what I output in the previous line. 0x37A works too. I have Windows XP

#define PORT 0x379
#define DATA 255
int main(int argc, char *argv[])
{
    Input input;
    Output output;
    HINSTANCE hInstLib = LoadLibrary(TEXT("inpout32.dll"));
    if (!hInstLib)
    {
        printf("No dll.\n");
        system("PAUSE");
        return 1;
    }
    input = (Input)GetProcAddress(hInstLib, "Inp32");
    output = (Output)GetProcAddress(hInstLib, "Out32");
    if (!input || !output)
    {
        printf("No funcion.\n");
        FreeLibrary(hInstLib);
        system("PAUSE");
        return 1;
    }
    output(PORT, DATA);
    printf("status: %i\n", input(PORT));
    FreeLibrary(hInstLib);
    system("PAUSE");
    return EXIT_SUCCESS;
}

Solution

  • Port 0x379 is an input port. You cannot change the value it reports in software, you actually have to put a voltage on pin 10, 11, 12, 13 or 15. Respectively the Ack, *Busy, PaperOut, Select and Error signals.