Jump to content



Photo
- - - - -

Fx-9860 Timers And Hardware


  • Please log in to reply
33 replies to this topic

#1 kucalc

kucalc

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1422 posts
  • Gender:Male
  • Location:USA
  • Interests:Programming: C/C++, Fortran, LISP, COBOL 85 Standard, PHP, x86 and SH3 Assembly

    Computer graphics

  • Calculators:
    fx-9860G / fx-7400G Plus / Algebra FX 2.0+ / fx-9770G / CFX-9850G / CFX-9850GB+ / TI-89 / TI-nSpire

Posted 10 March 2007 - 07:22 AM

If you tried out my CLOCK program: http://www.casiocalc...clock-utility-f You would see that it's possible to access the fx-9860 hardware. My CLOCK program accesses the fx-9860's built-in RTC. I figured out the addresses of the serial port, RTC and the SH3 timers. I think I can now create grayscales using the SH3 timers by flickering the screen at a fast frequency (about 32KHz). Very fast that the human eye won't notice it. I'll release a demo of the accessing serial port very soon. Maybe then I could use my fx-9860 to transfer programs into my Algebra FX without having to buy a serial cable. :D What do you guys think?

#2 Menno

Menno

    Casio Freak

  • Members
  • PipPipPipPip
  • 184 posts
  • Gender:Male
  • Location:Netherlands

  • Calculators:
    Casio 880P
    Casio Graph 25+
    Casio fx-9860g sd

Posted 10 March 2007 - 11:31 AM

Kucalc this is great :) this opens a way to create an agenda :)

#3 Menno

Menno

    Casio Freak

  • Members
  • PipPipPipPip
  • 184 posts
  • Gender:Male
  • Location:Netherlands

  • Calculators:
    Casio 880P
    Casio Graph 25+
    Casio fx-9860g sd

Posted 10 March 2007 - 12:17 PM

only day i do not understand, ok it is the sixth day but it does not ask for the daynumber (the tenth for today)

#4 eew

eew

    Casio Freak

  • Members
  • PipPipPipPip
  • 139 posts
  • Gender:Female
  • Location:Netherlands

  • Calculators:
    recent calculators:
    Casio fx-9860G SD
    Casio fx-82ms

    old calculators:
    HP 41C (1979)
    TI SR-40 (1976)
    Commodore [unkown type] (-+1970)

Posted 10 March 2007 - 12:28 PM

It is gread.

only day i do not understand, ok it is the sixth day but it does not ask for the daynumber (the tenth for today)


I've got this probem to.

#5 thomatos

thomatos

    Newbie

  • Members
  • Pip
  • 28 posts

  • Calculators:
    fx-9860 G

Posted 10 March 2007 - 12:39 PM

Look at the read-me file where all is explain ^^ !!!

#6 eew

eew

    Casio Freak

  • Members
  • PipPipPipPip
  • 139 posts
  • Gender:Female
  • Location:Netherlands

  • Calculators:
    recent calculators:
    Casio fx-9860G SD
    Casio fx-82ms

    old calculators:
    HP 41C (1979)
    TI SR-40 (1976)
    Commodore [unkown type] (-+1970)

Posted 10 March 2007 - 12:41 PM

This problem is not mentiont in de read me file. This is a bug.

#7 Menno

Menno

    Casio Freak

  • Members
  • PipPipPipPip
  • 184 posts
  • Gender:Male
  • Location:Netherlands

  • Calculators:
    Casio 880P
    Casio Graph 25+
    Casio fx-9860g sd

Posted 10 March 2007 - 12:42 PM

yes i have read the readme,

i know saturday is the sixth day, but you cannot set the day of the month, wich for today is the tenth day....get what i mean

saturday 10 march

it now says it is month three, day 6, while it is month 3 day 10 daytype 6

#8 vanhoa

vanhoa

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 854 posts
  • Gender:Male
  • Location:Vietnam

  • Calculators:
    AFX 2.0, CP 300, CP 330, nSpire, TI 89, FX 5800

Posted 10 March 2007 - 03:09 PM

If you tried out my CLOCK program: http://www.casiocalc...clock-utility-f You would see that it's possible to access the fx-9860 hardware. My CLOCK program accesses the fx-9860's built-in RTC. I figured out the addresses of the serial port, RTC and the SH3 timers. I think I can now create grayscales using the SH3 timers by flickering the screen at a fast frequency (about 32KHz). Very fast that the human eye won't notice it. I'll release a demo of the accessing serial port very soon. Maybe then I could use my fx-9860 to transfer programs into my Algebra FX without having to buy a serial cable. :D What do you guys think?



Can you still use the built-in debugger?

#9 kucalc

kucalc

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1422 posts
  • Gender:Male
  • Location:USA
  • Interests:Programming: C/C++, Fortran, LISP, COBOL 85 Standard, PHP, x86 and SH3 Assembly

    Computer graphics

  • Calculators:
    fx-9860G / fx-7400G Plus / Algebra FX 2.0+ / fx-9770G / CFX-9850G / CFX-9850GB+ / TI-89 / TI-nSpire

Posted 10 March 2007 - 04:58 PM

only day i do not understand, ok it is the sixth day but it does not ask for the daynumber (the tenth for today)


The fx-9860 does not keep track of which day it is in a month. Insteads it uses 0-6 to correspond with the day of the week.

This problem is not mentiont in de read me file. This is a bug.


It is not a bug. Again, the fx-9860 does not keep track of days in a month. It keeps track of which day in a week. 0-6 for Sunday-Saturday. It says that in the README file.

Can you still use the built-in debugger?


Maybe, I'll have to check.

#10 eew

eew

    Casio Freak

  • Members
  • PipPipPipPip
  • 139 posts
  • Gender:Female
  • Location:Netherlands

  • Calculators:
    recent calculators:
    Casio fx-9860G SD
    Casio fx-82ms

    old calculators:
    HP 41C (1979)
    TI SR-40 (1976)
    Commodore [unkown type] (-+1970)

Posted 10 March 2007 - 06:42 PM

No, but there is another problem, if you want to set the time, you don't see some options.

#11 kucalc

kucalc

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1422 posts
  • Gender:Male
  • Location:USA
  • Interests:Programming: C/C++, Fortran, LISP, COBOL 85 Standard, PHP, x86 and SH3 Assembly

    Computer graphics

  • Calculators:
    fx-9860G / fx-7400G Plus / Algebra FX 2.0+ / fx-9770G / CFX-9850G / CFX-9850GB+ / TI-89 / TI-nSpire

Posted 10 March 2007 - 08:05 PM

No, but there is another problem, if you want to set the time, you don't see some options.


Ok, I released a new version. It now supports years and fixes some bugs.

#12 2072

2072

    Casio over god

  • Admin
  • PipPipPipPipPipPipPipPip
  • 1564 posts
  • Gender:Male
  • Location:Somewherebourg
  • Interests:Alternative states of consciousness, programming, making things work the best they possibly can.

  • Calculators:
    AFX2 ROM 1.02, CFX-9940GT+, FX-180P-Plus

Posted 10 March 2007 - 11:06 PM

if it's like in the AFX2 there is another serial port where you can read the number of days elapsed since the RTC was first turned on, with this you can compute months and days... That's what I did in TOUCHE for the AFX.
What are the port numbers you read? Maybe it works like the AFX...

#13 kucalc

kucalc

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1422 posts
  • Gender:Male
  • Location:USA
  • Interests:Programming: C/C++, Fortran, LISP, COBOL 85 Standard, PHP, x86 and SH3 Assembly

    Computer graphics

  • Calculators:
    fx-9860G / fx-7400G Plus / Algebra FX 2.0+ / fx-9770G / CFX-9850G / CFX-9850GB+ / TI-89 / TI-nSpire

Posted 11 March 2007 - 02:20 AM

if it's like in the AFX2 there is another serial port where you can read the number of days elapsed since the RTC was first turned on, with this you can compute months and days... That's what I did in TOUCHE for the AFX.
What are the port numbers you read? Maybe it works like the AFX...


Well, the fx-9860 uses a SuperH processor, while a Algebra FX uses a 80186 compatible. The RTC is built into the CPU, and I don't think it keeps track of what you said. But it doesn't matter, I figured out how to implement the day of the month (I found the address). I release a new version of my CLOCK utility soon.

For fx-9860 developers, don't worry, I'm linking together all of my functions (accessing USB, serial port, timers, etc.) together into a library so other people can access the hardware level. Basically, I'm rewriting the SDK. :D

EDIT: Ok, I released a new version of CLOCK, v1.02. Now it supports dates (day of the month) and years (detects leap years). Also the display is cleaned up so it looks a bit nice. I was looking at how many clicks, wow, over 30 clicks in a day. :D

#14 Menno

Menno

    Casio Freak

  • Members
  • PipPipPipPip
  • 184 posts
  • Gender:Male
  • Location:Netherlands

  • Calculators:
    Casio 880P
    Casio Graph 25+
    Casio fx-9860g sd

Posted 11 March 2007 - 05:54 AM

:) great work man :)

it would be great if it could be used by others too, an agenda would be so nice...

also it is nice in games to show played time and so on... For my work this feature is also very usefull, we use time as one of our parameters, we have radio controlled watches but we tend to forget them sometimes, now we have a watch with us on our calculator.... this is quite handy

Edited by 2072, 11 March 2007 - 07:30 AM.
useless quote removed


#15 kucalc

kucalc

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1422 posts
  • Gender:Male
  • Location:USA
  • Interests:Programming: C/C++, Fortran, LISP, COBOL 85 Standard, PHP, x86 and SH3 Assembly

    Computer graphics

  • Calculators:
    fx-9860G / fx-7400G Plus / Algebra FX 2.0+ / fx-9770G / CFX-9850G / CFX-9850GB+ / TI-89 / TI-nSpire

Posted 11 March 2007 - 06:09 AM

:) great work man :)

it would be great if it could be used by others too, an agenda would be so nice...


Glad to hear that. I'll try to finish the SDK soon. :D

#16 vanhoa

vanhoa

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 854 posts
  • Gender:Male
  • Location:Vietnam

  • Calculators:
    AFX 2.0, CP 300, CP 330, nSpire, TI 89, FX 5800

Posted 11 March 2007 - 07:45 AM

haha, i've used the timer to procedure grayscale but in the PC it doesnt works :(

For more infos about SH assembly, look at here http://www.renesas.c...e...ation&lid=6

#17 kucalc

kucalc

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1422 posts
  • Gender:Male
  • Location:USA
  • Interests:Programming: C/C++, Fortran, LISP, COBOL 85 Standard, PHP, x86 and SH3 Assembly

    Computer graphics

  • Calculators:
    fx-9860G / fx-7400G Plus / Algebra FX 2.0+ / fx-9770G / CFX-9850G / CFX-9850GB+ / TI-89 / TI-nSpire

Posted 11 March 2007 - 08:50 AM

haha, i've used the timer to procedure grayscale but in the PC it doesnt works :(


Well, if it doesn't work on the PC, then how do you know it's actually creating greyscales? Timers alone won't get you greyscales. You have to make use of interrupts and program them which you didn't mention.

Now what I need is direct control of the DD (Display Driver), not VRAM. Each time a interrupt is called (which is called at a specific frequency), I copy the next buffer (multiple buffers which determine the grayscaled image result) directly to the screen. I'm still looking though how to write directly to the DD.

#18 vanhoa

vanhoa

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 854 posts
  • Gender:Male
  • Location:Vietnam

  • Calculators:
    AFX 2.0, CP 300, CP 330, nSpire, TI 89, FX 5800

Posted 11 March 2007 - 09:30 AM

" Timers alone won't get you greyscales." Yes, but it prevent flicked.

#19 Xerxes

Xerxes

    Casio Freak

  • Members
  • PipPipPipPip
  • 130 posts
  • Gender:Male

Posted 11 March 2007 - 04:50 PM

Hi kucalc,

if you need the weekday of a date, this function can be usefull:

function
  weekday(y,m:word):word;
var
  j,c,w:word;
begin
  if m<3 then begin
	inc(m,12);
	dec(y);
  end;
  j:=y mod 100;
  c:=y div 100;
  w:=(6+((m+1)*13 div 5)+j+j div 4+c div 4+5*c) mod 7;
  weekday:=w;
end;


#20 kucalc

kucalc

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1422 posts
  • Gender:Male
  • Location:USA
  • Interests:Programming: C/C++, Fortran, LISP, COBOL 85 Standard, PHP, x86 and SH3 Assembly

    Computer graphics

  • Calculators:
    fx-9860G / fx-7400G Plus / Algebra FX 2.0+ / fx-9770G / CFX-9850G / CFX-9850GB+ / TI-89 / TI-nSpire

Posted 11 March 2007 - 05:15 PM

" Timers alone won't get you greyscales." Yes, but it prevent flicked.


Lol :lol:, again, how would you know that if it doesn't work in the emulator? I guess it's possible, but only very, very, very few pixels can be used for grayscales just using timers alone. Current drawing functions are too slow since they are memory mapped which is the main cause of flickering. Having direct access of the LCD will provide the fast speeds neccessary to have grayscales.

Hi kucalc,

if you need the weekday of a date, this function can be usefull


Thanks Xerxes, but I already figured out how to get the date (day of the month) and years. Download CLOCK again from the File Sharing. Also the display is a bit cleaned up. :D

#21 TyYann

TyYann

    Casio Freak

  • Members
  • PipPipPipPip
  • 107 posts
  • Gender:Male
  • Location:Seoul, South Korea

  • Calculators:
    Casio fx-4000P (since 1988)
    Casio CFX-9850GB PLUS
    Sharp EL-9900
    Casio fx-9860G SD
    Casio fx-9860GII SD
    Casio Graph 90+E
    TI-83 Premium CE (no Python)
    and a 25-column abacus...

Posted 12 March 2007 - 01:51 PM

I found 2 bugs in your clock :unsure: .

If you are not setting the time, you can't exit by pressing <span class=MENU' /> . Only by pressing EXIT. The opposite would be more consistant with the rest of the calc.

What is a real bug, is that (maybe because of the first bug ?), if you exit Clock, you can't go back by directly pressing <span class=EXE' /> . you have to enter another part, exit it and then you get back your access to Clock...

Anyways, good work. 2 thumbs up.

#22 eew

eew

    Casio Freak

  • Members
  • PipPipPipPip
  • 139 posts
  • Gender:Female
  • Location:Netherlands

  • Calculators:
    recent calculators:
    Casio fx-9860G SD
    Casio fx-82ms

    old calculators:
    HP 41C (1979)
    TI SR-40 (1976)
    Commodore [unkown type] (-+1970)

Posted 12 March 2007 - 03:27 PM

The last "bug" is white every add-in, I think it is a but in the SDK.

#23 Menno

Menno

    Casio Freak

  • Members
  • PipPipPipPip
  • 184 posts
  • Gender:Male
  • Location:Netherlands

  • Calculators:
    Casio 880P
    Casio Graph 25+
    Casio fx-9860g sd

Posted 12 March 2007 - 03:51 PM

i think that has something to do with

SetQuitHandler(

);

but i cannot get it to work

:(

should read some more about quiting applications in C

it seems the Return 1 is still in 1 mode after exit

kucalc, vanhoa anyone?????

;)

#24 vanhoa

vanhoa

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 854 posts
  • Gender:Male
  • Location:Vietnam

  • Calculators:
    AFX 2.0, CP 300, CP 330, nSpire, TI 89, FX 5800

Posted 12 March 2007 - 03:57 PM

There is 2 way to exit (as i know so far)

1./. exit AddIn_main by return; //Note:AddIn_main isnt the first function or the last function that is called when your addin is called.
2./. Use GetKey();

The first way may cause some crash.
The second way is not good for game. //I used a methol to solve this problem but it only work on the emu, not on the calc (Lites and RushHour)


i think that has something to do with


SetQuitHandler(

);

but i cannot get it to work


void save(){
//Save your infos (for example: hi-score,current application status,...)
}

int AddIn_main(int isAppli, unsigned short OptionNum)
{
...
SetQuitHandler(save);
...
}

#25 Menno

Menno

    Casio Freak

  • Members
  • PipPipPipPip
  • 184 posts
  • Gender:Male
  • Location:Netherlands

  • Calculators:
    Casio 880P
    Casio Graph 25+
    Casio fx-9860g sd

Posted 12 March 2007 - 04:17 PM

There is 2 way to exit (as i know so far)

1./. exit AddIn_main by return; //Note:AddIn_main isnt the first function or the last function that is called when your addin is called.
2./. Use GetKey();

The first way may cause some crash.
The second way is not good for game. //I used a methol to solve this problem but it only work on the emu, not on the calc (Lites and RushHour)
void save(){
//Save your infos (for example: hi-score,current application status,...)
}

int AddIn_main(int isAppli, unsigned short OptionNum)
{
...
SetQuitHandler(save);
...
}



so it is more for functions to be carried out when quiting

does it work on every type of quit?

i still find the bug very annoying, you have to run another app to re-run a first application

should there be a solution to start a dummy application when exit an application?

like: while 1==1, do something, return 1,

#26 Xerxes

Xerxes

    Casio Freak

  • Members
  • PipPipPipPip
  • 130 posts
  • Gender:Male

Posted 12 March 2007 - 07:09 PM

I have downloaded the program again but the program still doesn't know the right weekday automatically and I have found two bugs:

- If you adjust the hours by decrementing, the displayed time is not correct.

- It is possible to set month and date to zero and minutes and secounds to 60.

#27 kucalc

kucalc

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1422 posts
  • Gender:Male
  • Location:USA
  • Interests:Programming: C/C++, Fortran, LISP, COBOL 85 Standard, PHP, x86 and SH3 Assembly

    Computer graphics

  • Calculators:
    fx-9860G / fx-7400G Plus / Algebra FX 2.0+ / fx-9770G / CFX-9850G / CFX-9850GB+ / TI-89 / TI-nSpire

Posted 12 March 2007 - 11:40 PM

The last "bug" is white every add-in, I think it is a but in the SDK.


Yes, that bug is not because of the programmers fault, but because of the SDK. But I have a solution, it will be in the future release of EPSILON, to reset the portion of memory used by the add-in.

I have downloaded the program again but the program still doesn't know the right weekday automatically


You have to set the correct settings yourself first. The fx-9860 doesn't "automatically" detect the correct weekday.

#28 TyYann

TyYann

    Casio Freak

  • Members
  • PipPipPipPip
  • 107 posts
  • Gender:Male
  • Location:Seoul, South Korea

  • Calculators:
    Casio fx-4000P (since 1988)
    Casio CFX-9850GB PLUS
    Sharp EL-9900
    Casio fx-9860G SD
    Casio fx-9860GII SD
    Casio Graph 90+E
    TI-83 Premium CE (no Python)
    and a 25-column abacus...

Posted 13 March 2007 - 01:48 AM

I found something else...
When in clock, you can't swich the calc off :nonono:

#29 kucalc

kucalc

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1422 posts
  • Gender:Male
  • Location:USA
  • Interests:Programming: C/C++, Fortran, LISP, COBOL 85 Standard, PHP, x86 and SH3 Assembly

    Computer graphics

  • Calculators:
    fx-9860G / fx-7400G Plus / Algebra FX 2.0+ / fx-9770G / CFX-9850G / CFX-9850GB+ / TI-89 / TI-nSpire

Posted 13 March 2007 - 02:01 AM

A lot of the add-ins for the fx-9860 here do that. That's not a bug. That's because in the fx-9860 SDK there are two main ways of getting user input:

GetKey and IsKeyDown(Up)

GetKey will allow you to turn off you calculator while running a add-in, but at a cost. GetKey PAUSES the calculator until you press a key.

IsKeyDown (and IsKeyUp), this is what I'm using, does not allow you to turn off your calculator. But, it does not pause the calculator. It checks at that instant when the function is called if the key is pressed down.

You see, if I use GetKey you can then turn off your calculator, but you then have to press a key every second to keep the CLOCK running because GetKey pauses the program until you press a key. :lol:

#30 Menno

Menno

    Casio Freak

  • Members
  • PipPipPipPip
  • 184 posts
  • Gender:Male
  • Location:Netherlands

  • Calculators:
    Casio 880P
    Casio Graph 25+
    Casio fx-9860g sd

Posted 13 March 2007 - 04:55 AM

About pausing the calc with GetKey, i suppose that does not stop the RTC, in other words, the RTC keeps counting even if you use Sleep or GetKey is that right?

#31 vanhoa

vanhoa

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 854 posts
  • Gender:Male
  • Location:Vietnam

  • Calculators:
    AFX 2.0, CP 300, CP 330, nSpire, TI 89, FX 5800

Posted 13 March 2007 - 05:02 AM

Yes, but it pause the addin so the display ....

#32 TyYann

TyYann

    Casio Freak

  • Members
  • PipPipPipPip
  • 107 posts
  • Gender:Male
  • Location:Seoul, South Korea

  • Calculators:
    Casio fx-4000P (since 1988)
    Casio CFX-9850GB PLUS
    Sharp EL-9900
    Casio fx-9860G SD
    Casio fx-9860GII SD
    Casio Graph 90+E
    TI-83 Premium CE (no Python)
    and a 25-column abacus...

Posted 14 March 2007 - 08:16 AM

Why not use a IsKeyDown to redirect toward a GetKey ? It is fast enough for the key to be still pressed when arriving at the 2nd test, isn't it ?

#33 2072

2072

    Casio over god

  • Admin
  • PipPipPipPipPipPipPipPip
  • 1564 posts
  • Gender:Male
  • Location:Somewherebourg
  • Interests:Alternative states of consciousness, programming, making things work the best they possibly can.

  • Calculators:
    AFX2 ROM 1.02, CFX-9940GT+, FX-180P-Plus

Posted 14 March 2007 - 10:11 AM

the best is to find the keyboard controller and/or buffer in memory and to re-create your own key functions...

exit(0); is not working to quit a program?

#34 vanhoa

vanhoa

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 854 posts
  • Gender:Male
  • Location:Vietnam

  • Calculators:
    AFX 2.0, CP 300, CP 330, nSpire, TI 89, FX 5800

Posted 14 March 2007 - 10:50 AM

no exit() support;




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users