CMOS

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
melgmry0101b
Member
Member
Posts: 109
Joined: Wed Nov 10, 2010 10:49 am

CMOS

Post by melgmry0101b »

Hi everyone,
I want to read the time and date from the CMOS.
I am using visual c++ 2005
i read the wiki document but it doesn't run
---------------
Thank you in advance
User avatar
thepowersgang
Member
Member
Posts: 734
Joined: Tue Dec 25, 2007 6:03 am
Libera.chat IRC: thePowersGang
Location: Perth, Western Australia
Contact:

Re: CMOS

Post by thepowersgang »

I point you to the forum rules and the "How to asks questions the smart way" link

Just saying "it doesn't" work is useless. It's just about as useful as ringing up a doctor and telling him "I feel sick" and expecting him to tell you exactly what is wrong over the phone.

"It doesn't run" - How doesn't it run? Does it not compile, does the code never execute, does it crash? And if so, how does it crash? Are you using Bochs, Qemu, VirtualPC, VirtualBox or Real Hardware.
Learn to ask questions correctly, and you will get kind and useful help. Ignore this advice, and expect to be ignored to the rest of your days.
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
melgmry0101b
Member
Member
Posts: 109
Joined: Wed Nov 10, 2010 10:49 am

Re: CMOS

Post by melgmry0101b »

it returns wrong values on boches , virtual pc and real hardware
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Re: CMOS

Post by neon »

Hello,

Always make sure to provide non-working code, what you expect for it to perform, and what it is doing. Also, you should never copy and paste code.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
User avatar
Karlosoft
Member
Member
Posts: 277
Joined: Thu Feb 14, 2008 10:46 am
Location: Italy
Contact:

Re: CMOS

Post by Karlosoft »

Some values in the CMOS could be stored in BCD format (there are hex values to be used them like decimal). Are you sure your code make this conversion?
User avatar
f2
Member
Member
Posts: 311
Joined: Mon Jun 15, 2009 10:01 am
Location: France

Re: CMOS

Post by f2 »

You can also tell the RTC to store the date/time in binary mode by setting the bit 2 of the status register B. Binary mode is exactly what you would expect the value to be.
"Open source seems to embrace the dark side of human nature." - Ville Turjanmaa
davidv1992
Member
Member
Posts: 223
Joined: Thu Jul 05, 2007 8:58 am

Re: CMOS

Post by davidv1992 »

Not all cmos implementations actually support that, so it is best to just read that register and write code for all possible situations, and not try to edit it.
Post Reply