Z filmem to musze jakis inny serwer poszukac :mur:
Tu schemat:
w mojej drabince rezystory nie sa idealne, generalnie zasada jest taka: patrzac od gory kazdy R powinien miec o polowe mniejszy opor - sprobujcie takie w sklepie dostac :lol:
lpt.cpp
include <windows.h>#include <stdio.h>#include "01.h"#include <winbase.h>int main(){ hKernel = LoadLibrary("Kernel32.dll"); if(hKernel)GetSystemTimes = (GetSystemTimesType) GetProcAddress(hKernel, "GetSystemTimes"); else printf("Błąd przy ładowaniu pliku 'Kernel32.dll'."); hIO = LoadLibrary("inpout32.dll"); if(hIO)OutPort = (OutPortType) GetProcAddress(hIO, "Out32"); else printf("Błąd przy ładowaniu pliku 'inpout32.dll'."); SYSTEMTIME stKernel, LstKernel; FILETIME idleTime, kernelTime, userTime; FILETIME LidleTime, LkernelTime, LuserTime; DWORD i,j; DWORD idl, ker, usr, sys; USHORT cpu; USHORT PortAddress; for(j=0;j<500;j++){ GetSystemTimes( &LidleTime, &LkernelTime, &LuserTime ); FileTimeToSystemTime(&LkernelTime, &LstKernel); printf(" \a"); for(i=0;i<500;i++)printf("%d \r",i);// printf("\n \a"); GetSystemTimes( &idleTime, &kernelTime, &userTime ); FileTimeToSystemTime(&kernelTime, &stKernel); usr = userTime.dwLowDateTime - LuserTime.dwLowDateTime; ker = kernelTime.dwLowDateTime - LkernelTime.dwLowDateTime; idl = idleTime.dwLowDateTime - LidleTime.dwLowDateTime; sys = ker + usr;// cpu = int( (sys - idl) *100 / sys ); cpu = int( (sys - idl) *255 / sys ); printf("%d \r\a",int( (sys - idl) *100 / sys )); PortAddress = 0x378; OutPort(PortAddress, cpu); }; OutPort(PortAddress, 0); }
i 01.h
INSTANCE hIO;//typedef USHORT _stdcall (*InPortType) (USHORT BasePort);typedef void _stdcall (*OutPortType)(USHORT BasePort, USHORT value);//InPortType InPort;OutPortType OutPort;HINSTANCE hKernel;typedef void _stdcall (*GetSystemTimesType) (LPFILETIME, LPFILETIME, LPFILETIME);GetSystemTimesType GetSystemTimes;
Ale zaznaczam ze to jest totalna prowizorka.
Kompilowane w dev-cpp. do tego potrzebna jest jeszcze ta biblioteka ta biblioteka, ktora nalezy umiescic razem z plikiem programu.
[edit]
serwer do filmu zmieniony. (film)