Per quel che ne sò io in vb leggere la temperatura è un'argomente estremamente complicato, difficile e così dispendioso di codece che non saprei quanto valga farlo.

Per scopo didattico non c'è quasi niente al riguardo sul web, se non programmi utility già pronti allo scopo, ma non in vb.


Questi sotto alcune function e sub trovate su internet sull'argomento, ma non sò dirti quanto queste corrispondono a verità.


'*************************************
Function Get_PCI_Reg(ByVal Bus As Long, ByVal Dev As Long, ByVal Fun As Long, ByVal Reg As Byte) As Long
Dim Data As Long
Dim Old As Long
Data = &H80000000 'Indirizzo base
Data = Data Or ((Bus And &HFF) * 2 ^ 16)
Data = Data Or ((Dev And &H1F) * 2 ^ 11)
Data = Data Or ((Fun And &H7) * 2 ^ 8)
Data = Data Or (Reg And &HFC)
Old = DlPortReadPortUlong(&HCF8)
DlPortWritePortUlong &HCF8, Data
Get_PCI_Reg = DlPortReadPortUlong(&HCFC)
DlPortWritePortUlong &HCF8, Old
End Function

Public Sub smbWaitForFree(ByVal lBaseAddress As Long)
Dim status As Byte
status = DlPortReadPortUchar(lBaseAddress)
Do While (status And 1) <> 0
DoEvents
status = DlPortReadPortUchar(lBaseAddress)
Loop
If (status And &H1E) <> 0 Then DlPortWritePortUchar lBaseAddress, status
End Sub

Public Sub smbWaitForEnd(ByVal lBaseAddress As Long)
Dim status As Byte
status = DlPortReadPortUchar(lBaseAddress)
Do While (status And 1) = 1
DoEvents
status = DlPortReadPortUchar(lBaseAddress)
Loop
End Sub

Public Function smbCallBus(ByVal BaseAddr As Long, _
ByVal Cmd As Byte, _
ByVal Slave As Byte, _
ByVal RW As Byte) As Long
Dim status As Byte
Dim Data As Long
Dim Control As Long
Dim i As Currency
status = DlPortReadPortUshort(BaseAddr)
smbWaitForFree BaseAddr
DlPortWritePortUchar BaseAddr + 3, Cmd
DlPortWritePortUchar BaseAddr + 4, (Slave * 2) Or RW
DlPortWritePortUchar BaseAddr + 2, Control Or &H48
For i = 1 To 10 ' Questo loop è da migliorare !!!
DoEvents
Next i
smbWaitForEnd BaseAddr
Data = DlPortReadPortUchar(BaseAddr + 6)
Data = Data * 2 ^ 8
Data = Data Or (DlPortReadPortUshort(BaseAddr + 5) And &HFF)
smbCallBus = Data And &HFFFF
End Function

'************************************************* ******






link
homepage http://%77%77%77%2e%74%77%6f%72%6b%2e%69%74/
forum http://%77%77%77%2e%74%77%6f%72%6b%2...um/default.asp