This project is a USB based computer status display. Downloads at the bottom of the page.
PIC Firmware: The firmware uses microchips USB stack. The files included in the USB folder are from the "Microchip Libraries of Applications" I used version v2012-08-22 of this library. The main.c, usb_descriptors.c, and usb_config.h were modeled after the "Device - HID - Custom Demos" files. The firmware processes the commands in the ProcessIO function in main.c The PIC firmware supports the following commands sent via USB HID...
HID Commands:
0x10 - Clear display
0x11 - Go to line 1, print string
0x12 - Go to line 2, print string
0x13 - Go to line 3, print string
0x14 - Go to line 4, print string
0x20 - Turn back-light off
0x21 - Turn back-light on
0x22 - Toggle back-light
0x23 - Request back-light status
0x30 - Update custom character
PC Support Application: The support application was written in C#. Some things of note... the file HIDInterface.cs is an invisible form. I created this as a form so I can get a window handle used for RegisterDeviceNotification calls. This allows me to detect when USB devices are plugged in and unplugged. This file is generic; the display specific commands live in HIDInterface_LcdDisplay.cs. That file extends the generic HIDInterface.cs and allows me to easily send commands to the display. In LineOptionControl.cs you will find the following function...
public string graphText(int percent)
{
string returnStr = "";
for (int i = 0; i < percent; i += 5)
{
// Check to see if we need a fraction of a full block (0x10 -> 0x14)
if (i + 5 > percent)
{
returnStr += (char)(0x10 + (percent - i));
}
else
{
// Use a full block. (0x15)
returnStr += (char)0x15;
}
}
// Pad the graph out with empty blocks.
returnStr = returnStr.PadRight(20, (char)0x10);
return returnStr;
}
This function is how the application displays the graphs. It takes an integer input with a range of 0 -> 100 and will return a 20 character string representing the integer. Each character represents 5% of the graph. The PIC interprets characters 0x10 -> 0x15 as custom characters representing 0% -> 5%.
Settings: The support application allows changing of the refresh rate. This number is how often the PC is polled for status info and the display will be updated. You may also change the backlight idle timeout. After this number of minutes has passed with the computer idle (No mouse movement, no typing, etc), the backlight will turn off. If you set this to the same time as your monitor turns off it works out quite nicely. If you want to disable this feature, set the number to 0.
Command Line: If you pass either "min" or "minimize" to the program as an argument, it will start minimized to the tray. An easy way to do this is to modify the shortcut as follows...
"<PATH_HERE>\UCSD Application 1.0.exe" min
Example:
"C:\Users\andrew\Desktop\UCSD Application 1.0.exe" min
Parts List:
LCD Display:
1x NHD-0440WH-ATFH-JT [P1] - Display itself. Exact model isn't critical. It is a 4x40 character driven by 2x SPLC780D ICs.
PC Application: Added network usage performance counter.
PC Application: For HDDs split into multiple partitions, we will show the first drive letter and hide the others. Performance counters don't differentiate disk usage time per partition, so showing the additional letters would display redundant info.
PC Application: Switched from "% Idle Time" -> "% Disk Time" HDD activity counters for code clarity.
PIC: now supports HID command to replace custom characters. (Command: 0x30)
PIC BugFix: We will write custom characters to both controllers in the display.
PC Application: Added new performance counters. (HDD Single with graph & Many HDD % usage)
PC Application: User can now select data to be displayed per line. More than one item can be displayed. Program will cycle through items at specified rate.
PC Applicaion BugFix: Hidden daughter form object "HIDInterface" will be hidden from the "Applications" tab of task manager. (Set form.Text = null)
PC Applicaion BugFix: Main form will be hidden from "Applications" tab of task manager when minimized to tray. It will reappear when viable.
PC Application: Will detect monitor going into low power state and can turn off backlight in responce. This feature requires Windows Vista or above. For previous versions of Windows, the feature will be disabled automatically.
PC Application: Now uses a custom NumericUpDown for backlight idle timeout box. Allows me to use the text "Disabled" instead of value "0" when user wishes to disable the idle timeout detection.