setting the CMOS clock

I try to set the CMOS clock programmatically.
I’m working on PC compliant hardware, so I’m using ioport 0x70 and 0x71,
disabling clock updates while setting the new time and day.

But, sometimes I have a completely erratic result, and more often,
everything is back in 1970 (something like 0, for time_t!)

I have brand new batteries for the CMOS!

Do you have any hint ?

Do you have any piece of code that shows how to set the CMOS clock (I might
have done something silly!)

Thanks,

Didier

Hi Didier,
Could you give some piece of your code, what exactly you’re doing? Did you use RTC update-ended
interrupt, just poll the bit in status register or exactly set bit in control register to disable
clock updates? What is your hardware? Does you chip allow to disable updates?
You could look at article about RTC clock (it’s in russian :slight_smile:)
http://qnx.org.ru/docs-devel/text_rtc.html
Or just grab the example tarball
ftp://ftp.qnx.org.ru/pub/projects/ed1k/clock.tgz
Look at SetRTCAlarmTime() (rtc.c/rtc.h) and modify it for SetRTCCurTime() by using regs 0,2,4.
Cheers.

Eduard.
ed1k at ukr dot net

Didier Harrang <didier.harrang@bcisa.com> wrote in article <ae7bqu$bj$1@inn.qnx.com>…

I try to set the CMOS clock programmatically.
I’m working on PC compliant hardware, so I’m using ioport 0x70 and 0x71,
disabling clock updates while setting the new time and day.

But, sometimes I have a completely erratic result, and more often,
everything is back in 1970 (something like 0, for time_t!)

I have brand new batteries for the CMOS!

Do you have any hint ?

Do you have any piece of code that shows how to set the CMOS clock (I might
have done something silly!)

Thanks,

Didier

Could you please post the relevant code?

Cheers,
-Brian


+===============================+
Brian K. Hlady
Technical Account Manager
QNX Software Systems, Ltd.
bhlady@qnx.com
+===============================+
“Didier Harrang” <didier.harrang@bcisa.com> wrote in message
news:ae7bqu$bj$1@inn.qnx.com

I try to set the CMOS clock programmatically.
I’m working on PC compliant hardware, so I’m using ioport 0x70 and 0x71,
disabling clock updates while setting the new time and day.

But, sometimes I have a completely erratic result, and more often,
everything is back in 1970 (something like 0, for time_t!)

I have brand new batteries for the CMOS!

Do you have any hint ?

Do you have any piece of code that shows how to set the CMOS clock (I
might
have done something silly!)

Thanks,

Didier