Ik tracht voor mijn GIP dit jaar een fancontroller te maken, het regelen van het toerental lukt me reeds. Maar ik heb nog een probleem om het toerental in te lezen. Ik gebruik een fan met 3pins dus + en - en speedsignal. Daarom stel ik de vraag heeft iemand soms een idee wat het adres zou kunnen zijn van het derde pinnetje (speedsignal). Ik sluit de fan dus rechtstreeks aan op mijn moederbord. Door middel van speedfan of dergelijke kan je dan je toerental zien maar ik werk met labview en wil dus ook het toerental bekomen. Dank bij voorbaat!
Captnoord
mov eax, 0x666
Okey het ligt er allemaal aan wat voor een moederbord je hebt en wat voor een monitor chip. Winbond enzz
Nou dit is mij source voor de ASUS A7V400X
#include "stdafx.h"
#include <iostream.h>
#include <windows.h>
#include <conio.h>
#include "stdio.h"
#include <iostream>
#include <fstream>
#include "math.h"
#include <stdlib.h>
// By the manual we have two ports to use
// 0x295 - the INDEX port and
// 0x296 - the DATA port
#define INDEX 0x295
#define DATA 0x296
#define BANK_SET 0x4e // lowest three bitti set a bank, in manual lk97 and lk109
#define CPU_TEMP 0x50 // BANK 0 0x4e = xxxxx001
#define MBM_TEMP 0x67 // 0x4e = xxxxx000
// lets give us a direct I/O access under winXP/2000/NT
// this part is not needed under win9x
int inline openIO(){
if (_winmajor > 5)
{
HANDLE h;
h = CreateFile("\\\\.\\giveio", GENERIC_READ, 0, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if(h == INVALID_HANDLE_VALUE) {
cout << "Couldn't access giveio device\n";
return 1;
}
CloseHandle(h);
}
return 0;
}
int main(){
char tempstr[100];
itoa(_winminor,tempstr,10);
switch(_winmajor)
{
case 4:
switch(_winminor)
{
case 0:
//win 95
//MessageBox(NULL,"Windows 95","",MB_OK);
break;
case 1:
//win 95 met Active Accessibility client
//MessageBox(NULL,"Windows 95","",MB_OK);
break;
case 10:
//Windows 98
//MessageBox(NULL,"Windows 98","",MB_OK);
break;
case 90:
//Windows ME
//MessageBox(NULL,"Windows ME","",MB_OK);
break;
}
break;
case 5:
//MessageBox(NULL,"Windows XP???",tempstr,MB_OK);
break;
}
/*extern unsigned int _osver;
extern unsigned int _winmajor;
extern unsigned int _winminor;
extern unsigned int _winver;*/
// cout.imbue(0,0);
cout << "OSVERSION: " << _osver << "\n";
cout << "OSVERSIONMAJOR: " << _winmajor << "\n";
cout << "OSVERSIONMINOR: " << _winminor << "\n";
//voor me a7v600-x
//Linked VIA VT8237 SMBUS at $E800
//Winbond W83781D(11) (ID=$11) found on SMBus at $2D
// lets give us a direct I/O access under winXP/2000/NT
// this part is not needed under win9x
if(openIO()) return -1;
unsigned int base = 0x290;
unsigned int address = base + 0x05;
unsigned int Data = base + 0x06;
//Divisor lezen 0X0B
//
_outp(address,0x0B); //set address op FAN1
unsigned char DIV1 = _inp(Data); //lees FAN1 Uit er van uitgaand dat de div 4 is
unsigned char FAN1DIV = pow(2,(DIV1 & 0x7));
unsigned char FAN2DIV = pow(2,((DIV1 & 0x38)>>3));
unsigned char FAN3DIV = ((DIV1 & 0x80)>>6)*6+2;
//itoa(FAN1DIV,DIV1str,10); //int to str
//itoa(_inp(address),cStrs,2); //int to bin
//cout << "tijdelijk: " << cStrs << "\n";
_outp(address,0x0D); //set address op FAN1
int FAN1 = 1350000/(_inp(Data)*FAN1DIV); //lees FAN1
_outp(address,0x0E); //set address op FAN2
int FAN2 = 1350000/(_inp(Data)*FAN2DIV); //lees FAN2
_outp(address,0x0F); //set address op FAN3
int FAN3 = 1350000/(_inp(Data)*FAN3DIV); //lees FAN3
_outp(address,0x50); //set address op Voltage1
_outp(Data,0xFF); //set address op Voltage1
_outp(address,0x20); //set address op Voltage1
int VOLT0 = (_inp(Data)); //vol1
_outp(address,0x21); //set address op Voltage2
int VOLT1 = (_inp(Data)); //vol2
_outp(address,0x22); //set address op Voltage3
int VOLT2 = (_inp(Data)); //vol3
_outp(address,0x23); //set address op Voltage4
int VOLT3 = (_inp(Data)); //vol4
_outp(address,0x24); //set address op Voltage5
int VOLT4 = (_inp(Data)); //vol5
_outp(address,0x25); //set address op Voltage6
int VOLT5 = (_inp(Data)); //vol6
_outp(address,0x26); //set address op Voltage7
int VOLT6 = (_inp(Data)); //vol7
_outp(address,0x27); //set address op Voltage8
int VOLT7 = (_inp(Data)); //vol8
_outp(address,0x28); //set address op Voltage9
int VOLT8 = (_inp(Data)); //vol9
_outp(address,0x29); //
int TMPIN0 = (_inp(Data)); //temp0
_outp(address,0x2A); //
int TMPIN1 = (_inp(Data)); //temp1
_outp(address,0x2B); //
int TMPIN2 = (_inp(Data)); //temp2
_outp(address,0x58); //
int VENDORID = (_inp(Data)); //ITE VENDOR ID NR
//itoa(FAN1,Fan1str,10); //int to str
//cout << "DIV1: " << FAN1DIV << "\n";
//cout << "DIV2: " << FAN2DIV << "\n";
//cout << "DIV3: " << FAN3DIV << "\n";
cout << "Fan1: " << FAN1 << " RPM\n";
cout << "Fan2: " << FAN2 << " RPM\n";
cout << "Fan3: " << FAN3 << " RPM\n"; // doet niks met mijn A7V600-X
cout << "Volt0: " << VOLT0*0.016 << " V\n"; //intern cpu 1.80V
cout << "Volt1: " << VOLT1*0.016 << " V\n"; //intern cpu2 0V
cout << "Volt2: " << VOLT2*0.016 << " V\n"; //3.3V
cout << "Volt3: " << VOLT3*0.026 << " V\n"; //5V
cout << "Volt4: " << VOLT4*0.064 << " V\n"; //12V for the system
cout << "Volt5: " << VOLT5*0.016 << " V\n"; //-12V for the stystem
cout << "Volt6: " << VOLT6*0.016 << " V\n"; //-5V for the system
cout << "Volt7: " << VOLT7*0.026 << " V\n"; //5V for stand by
cout << "Volt8: " << VOLT8*0.016 << " V\n"; //Battary //constante is goed volgens mij geen idee
cout << "Temp0: " << TMPIN0 << " C\n"; //temp0
cout << "Temp1: " << TMPIN1 << " C\n"; //temp1
cout << "Temp2: " << TMPIN2 << " C\n"; //temp2 //bij de asus A7V600-X niet aanwezig of actief
cout << "VendorID: " << VENDORID << "\n"; //temp1
/*char szDevice[]="COM1";
char seDevice[]="LPT1";
HANDLE hComm=CreateFile(szDevice,fdwAccess,fdwShareMode,NULL,fdwCreate,fdwAttrsAndFlags,hTemplateFile);
*/
/*HANDLE hPhdIo = CreateFile("AUX",GENERIC_READ|GENERIC_WRITE, 0,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);*/
//aux = video
cout << "createfilelog: " << hPhdIo << "\n"; //temp1
CloseHandle(hPhdIo);
int i = 0;
cin >> i;
return 0;
}
Maar let op deze code werkt niet met windowsXP dat komt omdat je als je winXP direct de poorten wil bereiken dan je daarvoor een speciale driver nodig hebt.
de code die hierboven staat heb ik naar aanleiding geschreven van deze code
//
// Simple Winbond W83697HF/F chip motherboard and cpu temp reader
// Require giveio.sys driver under winXP/2000/NT
// Used compiler: visual C++ 6
// Autor: Sander Aiaots
// E-Mail: san@ejaam.com
// I also do not take any responsibility if this program should harm your computer
//
#include <iostream.h>
#include <windows.h>
#include <conio.h>
// By the manual we have two ports to use
// 0x295 - the INDEX port and
// 0x296 - the DATA port
#define INDEX 0x295
#define DATA 0x296
#define BANK_SET 0x4e // lowest three bitti set a bank, in manual lk97 and lk109
#define CPU_TEMP 0x50 // BANK 0 0x4e = xxxxx001
#define MBM_TEMP 0x67 // 0x4e = xxxxx000
// lets give us a direct I/O access under winXP/2000/NT
// this part is not needed under win9x
int inline openIO(){
HANDLE h;
h = CreateFile("\\\\.\\giveio", GENERIC_READ, 0, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if(h == INVALID_HANDLE_VALUE) {
cout << "Couldn't access giveio device\n";
return 1;
}
CloseHandle(h);
return 0;
}
int main(){
// lets give us a direct I/O access under winXP/2000/NT
// this part is not needed under win9x
if(openIO()) return -1;
// Set Bank register to BANK0
_outp(INDEX, BANK_SET);
_outp(DATA, _inp(DATA)|0x01);
//
_outp(INDEX, CPU_TEMP);
cout << "CPU temp: " << _inp(DATA) << "C\n";
// lets unset BANK register, to get Motherboard temperature
_outp(INDEX, BANK_SET);
_outp(DATA, _inp(DATA)&0xf8);
_outp(INDEX, MBM_TEMP);
cout << "MBM temp: " << _inp(DATA) << "C\n";
return 0;
}
}
Hier is WinXP wel ondersteunt maar ik denk alleen met een speciale driver maar het fijne weet ik er niet meer van is te lang geleden.
In labview kan je C implementeren.
Ik hoop dat je hiermee geholpen bent.
Groeten Captnoord
[edit] ik zie nu pas dat de code niet clean is, beetje rommeltje als je er niet uitkomt moet je het maar zeggen dan zal ik wel een poging doen om de code te cleanen
[edit2] ik zie nu welke driver je nodig hebt "giveio.sys" denk ik [google]giveio[/google]
Alvast bedankt voor de hulp maar hier ken ik echt niks van :s, ik heb het volgende moederbord: Intel desktop board D815EEA2. Over die Winbond had ik ook al es iets gelezen in de technische gegevens van het moederbord dacht ik.
Captnoord
mov eax, 0x666
Maar je kan alleen met labview overweg en niet met C, ik kan wel alles voor je gaan voorkouwen maar dat schiet niet op dan. Ik stel voor dat je eerst gaat kijken wat voor een chipset je hebt. Dan de datasheet ervan doorleest, daarna kijkt en probeert te leren wat er in de code staat. Probeer deze dan aan te passen. Het kan zijn dat de code al werkt want een hoop chipsets zijn universeel.
Groeten Captnoord