📜 ⬆️ ⬇️

Once again about dial gauges (and completely without MK)

Hello!
I immediately liked the article about the switch indication of CPU and memory usage. Sometimes you need to see how much free memory is left, launching the third or fourth instance of a heavy program / game (I don’t want to bring it to the situation, the code of the previous instances will be swapped). Or with processor loading - I used to think that modern Crysis, Call of Duty, Mass Effect, etc. ship and video card, and percent. Now I know that even when the picture slows down - the percent is loaded no more than 30-40%. Well, or on the move to assess whether all the kernel uses rendering. And what a pleasure the eye gives jerky arrows.
The second realization, though just as obvious, is not sunk into the soul — there is no such spectacle.
So I decided - someday I will certainly repeat with the arrows.
The only problem, because of which I did not do it right away, is laziness, the absence of indicators, of course. And so, sorting out the old-old stuff in the old-old cupboard, I found THEM.



Just two dial gauges from an old reel tape recorder. Oh, how many times he rewound the reels with Cinema and Modern Talking.

So, in order for the idea to work, we needed:

When the tasks are clear - and easier to work.
')
Beautiful indicators

Heads turned out to be filled with glue from the heart, but he could not stand under the usual stationery knife. He divided it in half, took out the old scale, drew in size and printed out a new one. Assembled in reverse order.



After writing the article I looked at the photos and disassembled them again. He took from the wife a red nail polish and painted arrows. It turned out more noticeable - it can be seen on the video.

Hardware

Here I didn’t subtilize with the controllers. There is a LPT on mamma, he is hardly useful for me for some other purposes, so there is nothing for him to stand idle.
LPT is 8 bits, 4 bits per channel, 16 positions of the arrow - I was completely satisfied. The simplest DAC - resistors and diodes, we draw for two channels (aesthetes, sorry for ISIS):



I neglected the accuracy of resistors, gash what happens in nature (10, 20, 39, 82 kOhm). As usual, we solder the layout:



and check in work. Calibration consists in setting the arrows by trimmers to the maximum scale division when transmitting the value of 255 to the port. With iron everything is.

Program

It turned out to be the most difficult to find a driver for working with LPT (Win 8 x64). After several hours of searching, I finally found 32-bit DLPortIO (driver + library), but with installation instructions for 64-bit systems. The link, unfortunately, has already been lost, just kept it on Yandex.Disk .
Further - easier. Half an hour later, the Delphi program (the only thing that I somehow remember from my studies) was written:
Spoiler
procedure TForm1.Timer1Timer(Sender: TObject); begin MemStatus.dwLength := sizeof( TMemoryStatus ); GlobalMemoryStatus( MemStatus ); MemVal := round(15*MemStatus.dwMemoryLoad/100) shl 4; // 4  - ,  - CPU CPUUsage3:= CPUUsage2; // CPUUsage2:= CPUUsage1; // CPUUsage1:= CPUUsage; // CPUUsage := 0; CollectCPUData; for i:= 0 to GetCPUCount - 1 do begin CPUUsage:= CPUUsage + GetCPUUsage(i); end; CPUUsage:= CPUUsage / GetCPUCount; CPUUsage:= (CPUUsage + CPUUsage1 + CPUUsage2 + CPUUsage3)/4; //  CPUVal := Round(15 * CPUUsage); CPUVal := CPUVal or MemVal; DlPortWritePortUchar (888, CPUVal); end; 


The RAM and CPU load values ​​are read twice a second and sent to the & H378 port. In the comments to the original article there was a question about how many resources the program is showing, showing the loading of resources. The answer is: according to the task manager, the CPU load did not exceed 0%, but there was 956k of memory (I would have to tear my hands off: I went the simplest way, I create a form, and then it disappears. Nothing, I’ll get to the optimization and fix it).
Accuracy in the first half of the scale is lame, the closer to 100% - the more accurate.



The case is not and is not planned, let them lie on the monitor. There is no backlight, but it is planned. I think where to power. The design is more of an aesthetic character, plus the pleasure of being made / assembled / welded personally, and this is priceless.
Finally a small video:


Thank you for your attention, and I wish you to find an arrow indicator in the cabinet.

Source: https://habr.com/ru/post/215911/


All Articles