lpt-signal-generator: magická konstanta
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sun, 11 Jun 2017 01:25:56 +0200
changeset 48254d5d1bc659
parent 47 9e2addbb9674
child 49 e1e5db678ce8
lpt-signal-generator: magická konstanta
c++/lpt-signal-generator/lpt.cpp
     1.1 --- a/c++/lpt-signal-generator/lpt.cpp	Fri Jun 09 23:23:25 2017 +0200
     1.2 +++ b/c++/lpt-signal-generator/lpt.cpp	Sun Jun 11 01:25:56 2017 +0200
     1.3 @@ -56,7 +56,7 @@
     1.4  
     1.5    int addr = 0xe400; // parallel port address; first number of given port in: cat /proc/ioports | grep parport
     1.6    int baseFreq = 10000; // base frequency in Hz, should be between 5 000 between 10 000 Hz; lower frequency leads to dashed/dotted lines instead of greyscale
     1.7 -  int outputPower = 10; // duty cycle; 100 = 100 %
     1.8 +  int outputPower = 20; // duty cycle; 100 = 100 %
     1.9    int duration = 1; // in seconds; total sleep time, see note above
    1.10  
    1.11    int valueWidth =  10; // just for padding of printed values
    1.12 @@ -74,6 +74,9 @@
    1.13    int timeOn =  oneSecond *        outputPower  / 100 / baseFreq;
    1.14    int timeOff = oneSecond * (100 - outputPower) / 100 / baseFreq;
    1.15  
    1.16 +  timeOn  -= 13;
    1.17 +  timeOff -= 13;
    1.18 +
    1.19    int cycleCount = duration * baseFreq;
    1.20    wprintf(L"%*ls %'*d ×\n", labelWidth, L"Cycle count:", valueWidth, cycleCount);
    1.21    wprintf(L"%*ls %'*d μs 1× in each cycle\n", labelWidth, L"Time on:",  valueWidth, timeOn);