Keresés

Aktív témák

  • Freddy TNT

    őstag

    válasz shtml #1 üzenetére

    :Y én s*gg hülye vagyok ahhoz amit írtál,de megkérdezem. Mi az a mikrokontroller és mire jó amit csinálni akarsz ?:D

  • OddMan

    őstag

    válasz shtml #5 üzenetére

    Itt egy régi progim, amivel xp alatt a párhuzamos portra lehetett írni, hogy a párhuzamos porton lévő ledjeim villogjanak.
    Az egésznek a lényege a giveio.sys, ami teljes hozzáférést enged a protokhoz.
    Ha kell, mailben el tudom neked küldeni ezt a drivert, én is úgy találtam a neten. A program persze csak akkor használható, ha a giveio.sys telepítve van.


    // parallelport.cpp : Defines the entry point for the console application.
    //

    #include ''stdafx.h''
    #include <windows.h>
    #include <conio.h>
    #include <stdio.h>


    #define LPT1 0x378


    void DataSendPort(short int num);
    void OpenGiveIO(void);
    void CloseGiveIO(void);
    void wrtport(unsigned char buffer);


    //Global variable
    HANDLE LPTDevice;


    int main(int argc, char* argv[])
    {
    unsigned char i=0;
    bool kilep=TRUE;


    OpenGiveIO();

    while(1)
    {
    wrtport(i);
    printf(''%d\n'', i);
    if(i>=255) break;
    else i++;
    Sleep(25);
    }

    CloseGiveIO();

    printf(''\nProgram finished!\n'');
    printf(''\tCode by OddMan (c)2003\n\n'');

    return 0;
    }

    void OpenGiveIO(void)
    {
    LPTDevice=CreateFile(''\\\\.\\GIVEIO'', // giveio.sys driver
    GENERIC_READ|GENERIC_WRITE, // access (read-write) mode
    0, // share mode
    NULL, // pointer to security attributes
    OPEN_EXISTING, // In case of a device file
    FILE_ATTRIBUTE_NORMAL, // file attributes
    NULL // handle to file with attributes to
    ); // copy It must be NULL in case of I/O device

    if(LPTDevice==INVALID_HANDLE_VALUE)
    {
    printf('''GiveIO driver is not installed!!'\n'');
    exit(1);
    }
    else printf(''Open LPT1!\n'');
    }


    void CloseGiveIO(void)
    {
    if(!CloseHandle(LPTDevice))
    {
    printf(''Close failed!\n'');
    exit(1);
    }
    else printf(''Close LPT1!\n'');
    }


    void wrtport(unsigned char buffer)
    {
    __asm
    {
    mov dx,LPT1 //A dx az LPT1-re mutat
    mov al,buffer //Buffer értéket al-be tesszük
    out dx,al //Buffer tartalmának kiírása az adott portra
    }
    }




    [Szerkesztve]

    [Szerkesztve]

    ''A szíved szabad! Légy bátor és kövesd!''

  • OddMan

    őstag

    válasz shtml #9 üzenetére

    Mail ment! :DDD

    ''A szíved szabad! Légy bátor és kövesd!''

Aktív témák