Top-Aktivitäten
Sehen Sie hier, wer zu den aktivsten Mitgliedern der letzten Woche zählt:
Top-Mitglieder
Sponsored Links
| Diskussionsverlauf (3 Kommentare) | Thread-Ansicht |


/** windows **/ /* lade inpout32.dll fuer LPT port zugriff unter win xp */ /* prototype (function typedef) for DLL function Inp32: */ typedef short _stdcall (*inpfuncPtr)(short portaddr); typedef void _stdcall (*oupfuncPtr)(short portaddr, short datum); HINSTANCE hLib; inpfuncPtr inp32; oupfuncPtr oup32; // lade inpout.dll hLib = LoadLibrary("inpout32.dll"); if(hLib==NULL) { cout<<"Load inpout32.dll failed !\n"; } /* get the address of the function Inp32 */ inp32 = (inpfuncPtr)GetProcAddress(hLib,"Inp32"); if(inp32==NULL) { cout<<"GetProcAddress for Inp32 Failed !\n"; } /* get the address of the function Outp32 */ oup32 = (oupfuncPtr)GetProcAddress(hLib,"Out32"); if(oup32==NULL) { cout<<"GetProcAddress for Oup32 Failed !\n"; }/** windows **/ /* lasse die LED am LPT mehrfach blinken */ void lptFlash() { // aktuellen status auslesen um ihn am ende wiederherstellen zu koennen int status = (inp32)(LPT_PORT); // blinken for(int x=1; x<=10; x++) { (oup32)(LPT_PORT,LPT_ON); Sleep(LED_FLASH_ON); (oup32)(LPT_PORT,LPT_OFF); Sleep(LED_FLASH_OFF); } // alten status wiederherstellen (oup32)(LPT_PORT,status); }#define LPT_PORT 0x378 // adresse des LPT #define LPT_ON 0xFF // wert der auf LPT beim "einschalten" geschrieben wird #define LPT_OFF 0x00 // wert der auf LPT beim "ausschalten" geschrieben wird #define LED_FLASH_ON 50 // zeit in ms die die LED brennen soll bevor sie wieder erlischt #define LED_FLASH_OFF 70 // zeit in ms zwischen zwei brennden bevor sie wieder brennt