I have absolutely no experience or knowledge regarding hardware registers and how to interface with them via code. However, my current C# project requires me to read temperatures from a chip on the SMBus, and I think I'm going to have to get my hands dirty. In case you would like to know, the temperature sensor is the Winbond W83793G.
I have a long way to go, but I've started by looking at this document on Page 5: smbus.org/specs/smbb10.pdf
It seems the first step to accomplishing my task is to write to the following hardware registers: AX, BH, BL, CH, CL, and read the return values from the following: Carry, AH, AL, BL, CH, CL, DX. Using this I can determine whether the 'SMBus BIOS Interface' is available. More importantly, if I can manage this much in C#, I can follow the rest of the documentation to eventually read from the Winbond W83793G and pull out the values I want from the temperatures sensors. And no, OpenHardwareMonitor doesn't currently support SMBus, so I can't refer to it for code.
In summary, my basic question is: What is an easy, efficient way to read from and write to hardware registers using C#?
And in addition, if you could provide any feedback on my specific problem of reading from the chip, that would be a bonus for me and I'd appreciate it very much!
C# is a managed language running in a virtual machine. It runs on a variety of platforms. It has no inbuilt concept of hardware registers.
You will need to use low level programming languages to write the code to access the hardware registers.
If this code is compiled into windows dlls you could then wrap this code in C# by accessing the non-managed dlls using PInvoke.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With