Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming > Application Programming

Reply
 
LinkBack Thread Tools
Old 04-27-09   #1 (permalink)
PC Gamer
 
Du-z's Avatar
 
intel nvidia

Join Date: Aug 2008
Location: Australia - Brisbane
Posts: 832

Rep: 61 Du-z is acknowledged by some
Unique Rep: 49
Folding Team Rank: 626
Trader Rating: 0
Default reading/writing to the registry

hey guys,

im just starting out with programming so please bear with me

what i want to be able to do is have a program that read a value in the registry
this value will be the CPU temperature as reported by Everest.
HKEY_CURRENT_USER\Software\Lavalys\EVEREST\SensorV alues\Value.TCPU

Heres is the part i were i have no idea on how to do.

i want this value to basically be converted into another number depending on the temprature range

e.g

< 40*C = 1
41-55 = 2
56-60 = 3
61-65 = 4
66-70 = 5
71-75 = 6
>76*C = 7

Basically a Microcontroler that i have programed will interpret these numbers and drive up to 24 RGB LEDs

e.g

1=purple
2=blue
3=green
4=yellow
5=orange
6=red
7= red w/ white flash for .2seconds every second

this will be my first step, afterwards i would be good to be able to have a choice to use the GPU temperatures (with a diferent range of temperature of course), or manual control

what would be the best programming langage to do this with, and how would i go about converting the numbers.
__________________

.

My First Case Mod: PhantomLED Fan and LED Controller

System: Whats a Sig Rig.... :p
CPU
E8400 @ 4005 Mhz (9 x 445) (C0)
Motherboard
Asus P5KC
Memory
2x2GB DDR3 G.Skill [PI] @ 1440 (720) Mhz 6-6-6-16
Graphics Card
XFX 8800GT
Hard Drive
WD 1TB Cavier Black, 320GB Cavier Green, SG 60GB
Sound Card
Onboard (Realtek)
Power Supply
Thermaltake QFan ToughPower 850W (12volts=62Amps)
Case
Antec 1200
CPU cooling
Xigmatek S1283 (With Crossbow and AS5)
GPU cooling
Stock (Full Shroud, Single Slot)
OS
Windows 7 64-bit / Vista 32-bit
Monitor
Samsung 22" 1680x1050

Last edited by Du-z : 04-27-09 at 09:11 PM
Du-z is offline I fold for Overclock.net   Reply With Quote
Old 04-27-09   #2 (permalink)
Case Modder
 
Spotswood's Avatar
 
Join Date: Jul 2008
Location: New Hampshire, USA
Posts: 236

Rep: 46 Spotswood is acknowledged by some
Unique Rep: 39
Trader Rating: 0
Default

Reading a Registry value and doing the conversion is trivial/easy. However, there's probably a whole lot of other "stuff" the application has to do (like communicate with the MC, polling/monitoring the Registry key for changes to its value, etc.) that help to determine the ease/appropriateness of the chosen language to write the application in. For starters, C#, C++ or Java would all probably work.
__________________
Rich
Custom Wooden Case Builder
Overclock.net Mod of the Month
Spotswood is offline   Reply With Quote
Old 04-28-09   #3 (permalink)
PC Gamer
 
Du-z's Avatar
 
intel nvidia

Join Date: Aug 2008
Location: Australia - Brisbane
Posts: 832

Rep: 61 Du-z is acknowledged by some
Unique Rep: 49
Folding Team Rank: 626
Trader Rating: 0
Default

thanks for the reply

rather than this program comunicating with the MC, the MC will comunitcate with the registry i.e it look at the registry read value then determine what pin need to have power aplied to it the MC will also have a Polling rate of 1-2 seconds.

and it would need to monitor the regitry for changes every second or two

also it would be good to beable to turn this off and have a manual colour control.

the programming languge for this MC is a hybrid between C and C++
__________________

.

My First Case Mod: PhantomLED Fan and LED Controller

System: Whats a Sig Rig.... :p
CPU
E8400 @ 4005 Mhz (9 x 445) (C0)
Motherboard
Asus P5KC
Memory
2x2GB DDR3 G.Skill [PI] @ 1440 (720) Mhz 6-6-6-16
Graphics Card
XFX 8800GT
Hard Drive
WD 1TB Cavier Black, 320GB Cavier Green, SG 60GB
Sound Card
Onboard (Realtek)
Power Supply
Thermaltake QFan ToughPower 850W (12volts=62Amps)
Case
Antec 1200
CPU cooling
Xigmatek S1283 (With Crossbow and AS5)
GPU cooling
Stock (Full Shroud, Single Slot)
OS
Windows 7 64-bit / Vista 32-bit
Monitor
Samsung 22" 1680x1050

Last edited by Du-z : 04-28-09 at 05:10 AM
Du-z is offline I fold for Overclock.net   Reply With Quote
Old 04-28-09   #4 (permalink)
Case Modder
 
Spotswood's Avatar
 
Join Date: Jul 2008
Location: New Hampshire, USA
Posts: 236

Rep: 46 Spotswood is acknowledged by some
Unique Rep: 39
Trader Rating: 0
Default

Quote:
Originally Posted by Du-z View Post
thanks for the reply

rather than this program comunicating with the MC, the MC will comunitcate with the registry i.e it look at the registry read value then determine what pin need to have power aplied to it the MC will also have a Polling rate of 1-2 seconds.

and it would need to monitor the regitry for changes every second or two

also it would be good to beable to turn this off and have a manual colour control.

the programming languge for this MC is a hybrid between C and C++
Fire-up a thread to poll/pull the value or use RegNotifyChangeKeyValue to wait for changes. Read the value via RegGetValue.
__________________
Rich
Custom Wooden Case Builder
Overclock.net Mod of the Month
Spotswood is offline   Reply With Quote
Old 04-28-09   #5 (permalink)
PC Gamer
 
Du-z's Avatar
 
intel nvidia

Join Date: Aug 2008
Location: Australia - Brisbane
Posts: 832

Rep: 61 Du-z is acknowledged by some
Unique Rep: 49
Folding Team Rank: 626
Trader Rating: 0
Default

sorry mate but i have no idea on how to do this, i'm a super newbie at this (read 1 day)

ive only ever done HTML and a bit of PHP
__________________

.

My First Case Mod: PhantomLED Fan and LED Controller

System: Whats a Sig Rig.... :p
CPU
E8400 @ 4005 Mhz (9 x 445) (C0)
Motherboard
Asus P5KC
Memory
2x2GB DDR3 G.Skill [PI] @ 1440 (720) Mhz 6-6-6-16
Graphics Card
XFX 8800GT
Hard Drive
WD 1TB Cavier Black, 320GB Cavier Green, SG 60GB
Sound Card
Onboard (Realtek)
Power Supply
Thermaltake QFan ToughPower 850W (12volts=62Amps)
Case
Antec 1200
CPU cooling
Xigmatek S1283 (With Crossbow and AS5)
GPU cooling
Stock (Full Shroud, Single Slot)
OS
Windows 7 64-bit / Vista 32-bit
Monitor
Samsung 22" 1680x1050
Du-z is offline I fold for Overclock.net   Reply With Quote
Old 04-28-09   #6 (permalink)
Case Modder
 
Spotswood's Avatar
 
Join Date: Jul 2008
Location: New Hampshire, USA
Posts: 236

Rep: 46 Spotswood is acknowledged by some
Unique Rep: 39
Trader Rating: 0
Default

This should help you get started.

Code:
#include <windows.h>

bool ReadEVERESTSensorValue(char* name, LPBYTE buffer, DWORD bufferChars)
{
    HKEY key;
    // TODO: Verify Registry key path.
    LONG result = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Lavalys\\EVEREST\\SensorValues", &key);
    if (result != ERROR_SUCCESS)
        return false;

    DWORD type;
    DWORD charsRead = bufferChars;
    result = RegQueryValueExA(key, name, 0, &type, buffer, &charsRead);
    if (result != ERROR_SUCCESS) {
        RegCloseKey(key);
        return false;
    }

    RegCloseKey(key);
    return true;
}

DWORD ConvertTemperatureToLEDNumber(DWORD temp)
{
    // Simple, brute-force implementation...
    if (temp <= 40) return 1;
    if (temp >= 41 && temp <= 55) return 2;
    if (temp >= 56 && temp <= 60) return 3;
    if (temp >= 61 && temp <= 65) return 4;
    if (temp >= 66 && temp <= 70) return 5;
    if (temp >= 71 && temp <= 75) return 6;
    return 7;
}

int main()
{
    // Assuming the value is stored as a DWORD...
    DWORD value;
    bool success = ReadEVERESTSensorValue("TCPU", (LPBYTE)&value, sizeof(value));
    if (success)
        DWORD led = ConvertTemperatureToLEDNumber(value);

    return 0;
}
__________________
Rich
Custom Wooden Case Builder
Overclock.net Mod of the Month
Spotswood is offline   Reply With Quote
Old 04-29-09   #7 (permalink)
PC Gamer
 
Du-z's Avatar
 
intel nvidia

Join Date: Aug 2008
Location: Australia - Brisbane
Posts: 832

Rep: 61 Du-z is acknowledged by some
Unique Rep: 49
Folding Team Rank: 626
Trader Rating: 0
Default

you little ripper, thanks mate.

Edit: the value the Everest puts out is a String Value not a DWORD, or to be more specific a REG_SZ
__________________

.

My First Case Mod: PhantomLED Fan and LED Controller

System: Whats a Sig Rig.... :p
CPU
E8400 @ 4005 Mhz (9 x 445) (C0)
Motherboard
Asus P5KC
Memory
2x2GB DDR3 G.Skill [PI] @ 1440 (720) Mhz 6-6-6-16
Graphics Card
XFX 8800GT
Hard Drive
WD 1TB Cavier Black, 320GB Cavier Green, SG 60GB
Sound Card
Onboard (Realtek)
Power Supply
Thermaltake QFan ToughPower 850W (12volts=62Amps)
Case
Antec 1200
CPU cooling
Xigmatek S1283 (With Crossbow and AS5)
GPU cooling
Stock (Full Shroud, Single Slot)
OS
Windows 7 64-bit / Vista 32-bit
Monitor
Samsung 22" 1680x1050

Last edited by Du-z : 04-29-09 at 06:24 AM
Du-z is offline I fold for Overclock.net   Reply With Quote
Old 04-29-09   #8 (permalink)
Case Modder
 
Spotswood's Avatar
 
Join Date: Jul 2008
Location: New Hampshire, USA
Posts: 236

Rep: 46 Spotswood is acknowledged by some
Unique Rep: 39
Trader Rating: 0
Default

Quote:
Originally Posted by Du-z View Post
you little ripper, thanks mate.

Edit: the value the Everest puts out is a String Value not a DWORD, or to be more specific a REG_SZ
No problem...
Code:
int main()
{
    char value[16] = {0};
    bool success = ReadEVERESTSensorValue("TCPU", (LPBYTE)value, sizeof(value));
    if (success)
        DWORD led = ConvertTemperatureToLEDNumber(atoi(value));

    return 0;
}
__________________
Rich
Custom Wooden Case Builder
Overclock.net Mod of the Month
Spotswood is offline   Reply With Quote
Old 05-04-09   #9 (permalink)
PC Gamer
 
Du-z's Avatar
 
intel nvidia

Join Date: Aug 2008
Location: Australia - Brisbane
Posts: 832

Rep: 61 Du-z is acknowledged by some
Unique Rep: 49
Folding Team Rank: 626
Trader Rating: 0
Default

thanks mate, i can't see it in the code but is there a output into the registry?
__________________

.

My First Case Mod: PhantomLED Fan and LED Controller

System: Whats a Sig Rig.... :p
CPU
E8400 @ 4005 Mhz (9 x 445) (C0)
Motherboard
Asus P5KC
Memory
2x2GB DDR3 G.Skill [PI] @ 1440 (720) Mhz 6-6-6-16
Graphics Card
XFX 8800GT
Hard Drive
WD 1TB Cavier Black, 320GB Cavier Green, SG 60GB
Sound Card
Onboard (Realtek)
Power Supply
Thermaltake QFan ToughPower 850W (12volts=62Amps)
Case
Antec 1200
CPU cooling
Xigmatek S1283 (With Crossbow and AS5)
GPU cooling
Stock (Full Shroud, Single Slot)
OS
Windows 7 64-bit / Vista 32-bit
Monitor
Samsung 22" 1680x1050
Du-z is offline I fold for Overclock.net   Reply With Quote
Old 05-04-09   #10 (permalink)
Case Modder
 
Spotswood's Avatar
 
Join Date: Jul 2008
Location: New Hampshire, USA
Posts: 236

Rep: 46 Spotswood is acknowledged by some
Unique Rep: 39
Trader Rating: 0
Default

Quote:
Originally Posted by Du-z View Post
thanks mate, i can't see it in the code but is there a output into the registry?
The code assumes that Everest is writing to the Registry. There is a RegSetValueEx function that you could use as well to write to the Registry.
__________________
Rich
Custom Wooden Case Builder
Overclock.net Mod of the Month
Spotswood is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools



All times are GMT -5. The time now is 01:03 PM.


Overclock.net is a Carbon Neutral Site Creative Commons License

Terms of Service / Forum Rules | Privacy Policy | DMCA Info | Advertising | Become an Official Vendor
Copyright © 2009 Shogun Interactive Development. Most rights reserved.
Page generated in 0.17162 seconds with 8 queries