Register

Power Graphic 2

Learn how to program. Code snippets for creating sprites etc. Submit your own or use those of others.
Senior Member
Posts: 68
Joined: Tue May 08, 2012 5:40 pm

Power Graphic 2

Postby happy » Sun Sep 23, 2012 5:38 pm

Hi,

I went through the docs, but still can't get RTC_SetDateTime (syscall 0x11DE) and RTC_GetDateTime (syscall 0x11E2) to work..

I did manage to get RTC_GetTime (syscall 0x03A) to work though.

1) Could someone (Simon..!) please show me a sample code on how to use RTC_SetDateTime and RTC_GetDateTime?

2) This is the "bcd2int" function I used for GetTime().

Code: Select all
     bcd2int int (int bcd) {return 10 * ((bcd & 0xF0) >> 4) + (bcd & 0x0f);}


Could you please write me a "int2bcd"?

Thanks!

Senior Member
User avatar
Posts: 605
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750 G II, Casio fx-9750 G II (SH4), Casio fx-9860G, Casio fx-9860 G SD, Casio fx-9860G Slim, Casio fx-9860 GII SD, Casio fx-9860 GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG 20, Casio Classpad fx-cp400, Casio fx-CG 50

Re: Power Graphic 2

Postby SimonLothar » Sun Sep 23, 2012 5:58 pm

happy wrote:I went through the docs, but still can't get RTC_SetDateTime (syscall 0x11DE) and RTC_GetDateTime (syscall 0x11E2) to work..
These are the Prizm-syscalls.
You have to use the fx-9860-syscall 0x23E: void RTC_SetDateTime( unsigned char[7]*timestr );
to set the DateTime.
There is no syscall to read the complete DateTime on the fx-9860-calculators. You have to read the corresponding RTC registers to get the date. But have in mind, that the RTC-base-address of G/GII MPUs (7337/7355) is different compared to the GII-2 MPU (7305).
I'll be back!

Senior Member
Posts: 68
Joined: Tue May 08, 2012 5:40 pm

Re: Power Graphic 2

Postby happy » Mon Sep 24, 2012 5:52 am

SimonLothar wrote:You have to use the fx-9860-syscall 0x23E: void RTC_SetDateTime( unsigned char[7]*timestr );

Argh this BCD stuff is killing me! Not able to get RTC_SetDateTime to work..

SimonLothar wrote:But have in mind, that the RTC-base-address of G/GII MPUs (7337/7355) is different compared to the GII-2 MPU (7305).

Revolution defines this -
Code: Select all
#define RTC   (*(volatile struct st_rtc *)0xFFFFFEC0)
and it (and all other Revolution defined RTC set and get) works in GII. What would the address be in GII-2?

Senior Member
Posts: 68
Joined: Tue May 08, 2012 5:40 pm

Re: Power Graphic 2

Postby happy » Mon Sep 24, 2012 6:09 pm

Saw syscalls 0x05C and 0x05D hidden away in the doc, used them for BCD to int conversions and back. Very useful, thanks!

Still would like to get date (YMD). Using Revolution for that now in GII, is it as simple as just changing the RTC address to make it work in GII-2? If yes, what would that address be..?

Senior Member
User avatar
Posts: 605
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750 G II, Casio fx-9750 G II (SH4), Casio fx-9860G, Casio fx-9860 G SD, Casio fx-9860G Slim, Casio fx-9860 GII SD, Casio fx-9860 GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG 20, Casio Classpad fx-cp400, Casio fx-CG 50

Re: Power Graphic 2

Postby SimonLothar » Mon Sep 24, 2012 6:50 pm

happy wrote:Still would like to get date (YMD). Using Revolution for that now in GII, is it as simple as just changing the RTC address to make it work in GII-2? If yes, what would that address be..?
The RTC-base address of the SH7305 is 0xA413FEC0.
I'll be back!

Senior Member
Posts: 68
Joined: Tue May 08, 2012 5:40 pm

Re: Power Graphic 2

Postby happy » Mon Sep 24, 2012 7:04 pm

Works, thank you!

Return to Tutorials & Code Snippets

Who is online

Users browsing this forum: No registered users and 2 guests