Register

Need some newbie help please

Discuss issues related to the fx-9860G Software Development Kit
Member
User avatar
Posts: 44
Joined: Tue Jul 02, 2013 11:57 am
Location: London
Calculators: Casio fx-7400G, Casio fx-7400G PLUS, Casio fx-7400GII, Casio fx-9750G, Casio fx-9750G PLUS, Casio fx-9860GII

Need some newbie help please

Postby MrMagoo » Tue Jul 02, 2013 3:45 pm

Hey guys,

I am totally new to the casio SDK and really need some guidance.
I was pretty good with the original casio basic, and I have a lot of experience with Autoit, but C has never really sunk in.

I need some help with user inputs, id like something like this;

"Variable 1 = ?"
"Variable 2 = ?"

Then the output is a simple mulitplication of the two.

I think im ok with the print function but I cant figure out how the values are input.

Can I also then save these values to a memory that can be accessed after the calculator has been restarted?

Thanks in advance :-)
"The trouble with internet quotations, is that the majority are totally made up." - Abraham Lincoln 1863

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-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400

Re: Need some newbie help please

Postby SimonLothar » Tue Jul 02, 2013 5:44 pm

Did you get essential functions like GetKey, Print, locate, Bdisp_PutDisp_DD and Bdisp_AllClr_VRAM running properly?
I'll be back!

Member
User avatar
Posts: 44
Joined: Tue Jul 02, 2013 11:57 am
Location: London
Calculators: Casio fx-7400G, Casio fx-7400G PLUS, Casio fx-7400GII, Casio fx-9750G, Casio fx-9750G PLUS, Casio fx-9860GII

Re: Need some newbie help please

Postby MrMagoo » Tue Jul 02, 2013 6:08 pm

SimonLothar wrote:Did you get essential functions like GetKey, Print, locate, Bdisp_PutDisp_DD and Bdisp_AllClr_VRAM running properly?


I'd like to say yes, but I cant :?

I know what locate and getkey do, and I think I can make them work.

Print, I have kind of figured out, just by looking around here.

But I dont even know what the others do, nevermind getting them to work. I have tried looking around, but I cant find a Casio SDK for dummies anywhere.
"The trouble with internet quotations, is that the majority are totally made up." - Abraham Lincoln 1863

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-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400

Re: Need some newbie help please

Postby SimonLothar » Tue Jul 02, 2013 9:45 pm

Try to compile the following code (f. i. as file test.c).
(SDK's main menu: Project/Rebuild all)

Code: Select all
#include <fxlib.h>

int AddIn_main(int isAppli, unsigned short OptionNum)
{
  unsigned int key;
  Bdisp_AllClr_VRAM();          // clear the screen
  locate( 1, 1 );                  // position the cursor
  Print( "Hello world!" );        // display a message
  while (1) GetKey( &key );   // wait endlessly
}

#pragma section _BR_Size
unsigned long BR_Size;
#pragma section

#pragma section _TOP
int InitializeSystem(int isAppli, unsigned short OptionNum)
{
  return INIT_ADDIN_APPLICATION(isAppli, OptionNum);
}
#pragma section
I'll be back!

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-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400

Re: Need some newbie help please

Postby SimonLothar » Tue Jul 02, 2013 9:53 pm

Be sure to explore the SDK's main menu item
"Help" -> "Contents" -> "using the fx-9860G SDK"
I'll be back!

Member
User avatar
Posts: 44
Joined: Tue Jul 02, 2013 11:57 am
Location: London
Calculators: Casio fx-7400G, Casio fx-7400G PLUS, Casio fx-7400GII, Casio fx-9750G, Casio fx-9750G PLUS, Casio fx-9860GII

Re: Need some newbie help please

Postby MrMagoo » Tue Jul 02, 2013 9:54 pm

SimonLothar wrote:Try to compile the following code (f. i. as file test.c).
(SDK's main menu: Project/Rebuild all)

Code: Select all
#include <fxlib.h>

int AddIn_main(int isAppli, unsigned short OptionNum)
{
  unsigned int key;
  Bdisp_AllClr_VRAM();          // clear the screen
  locate( 1, 1 );                  // position the cursor
  Print( "Hello world!" );        // display a message
  while (1) GetKey( &key );   // wait endlessly
}

#pragma section _BR_Size
unsigned long BR_Size;
#pragma section

#pragma section _TOP
int InitializeSystem(int isAppli, unsigned short OptionNum)
{
  return INIT_ADDIN_APPLICATION(isAppli, OptionNum);
}
#pragma section


Ok, all done. Worked perfectly.
Why do we not need a wend ?
What is the getkey function doing?

In other languages I am familar with, an endless loop would be done like this

While 1
Sleep(500) ; to reduce load
Wend

I assume "while (1) GetKey( &key ); // wait endlessly" is the same?
"The trouble with internet quotations, is that the majority are totally made up." - Abraham Lincoln 1863

Senior Member
Posts: 369
Joined: Tue Jan 03, 2012 11:24 pm
Calculators: Casio Afx 1.0, Casio fx-9860GII SD, Casio Classpad 330, Casio fx-CG20, Casio Classpad fx-CP400

Re: Need some newbie help please

Postby helder7 » Tue Jul 02, 2013 10:39 pm

You can put parenthesis in while, like:

Code: Select all
    while(1){
        GetKey(&key);
    }


they (parenthesis) will symbolize the Wend of the while.

Getkey returns the pressed calculator key code to the "unsigned int key;". Its a infinite loop.
SiO2 + CaCO3 ----------> CaSiO3 + CO2

Member
User avatar
Posts: 44
Joined: Tue Jul 02, 2013 11:57 am
Location: London
Calculators: Casio fx-7400G, Casio fx-7400G PLUS, Casio fx-7400GII, Casio fx-9750G, Casio fx-9750G PLUS, Casio fx-9860GII

Re: Need some newbie help please

Postby MrMagoo » Tue Jul 02, 2013 10:44 pm

helder7 wrote:You can put parenthesis in while, like:

Code: Select all
    while(1){
        GetKey(&key);
    }


they (parenthesis) will symbolize the Wend of the while.

Getkey returns the pressed calculator key code to the "unsigned int key;". Its a infinite loop.


I see, so the key code is assigned to "key"?

If i did;

While key = 0{
Getkey(&key);
}[/code]

Would this loop until a key is pressed?
"The trouble with internet quotations, is that the majority are totally made up." - Abraham Lincoln 1863

Senior Member
Posts: 369
Joined: Tue Jan 03, 2012 11:24 pm
Calculators: Casio Afx 1.0, Casio fx-9860GII SD, Casio Classpad 330, Casio fx-CG20, Casio Classpad fx-CP400

Re: Need some newbie help please

Postby helder7 » Tue Jul 02, 2013 11:04 pm

MrMagoo wrote:If i did;

While key = 0{
Getkey(&key);
}[/code]

Would this loop until a key is pressed?


While should be lowercase, "while"

To check if key is equal to 0, you should use the operator ==, not = (check this wikipedia article about operators)

You can/should simply use the following code to getkey indefinitely:
while(1){
GetKey(&key);
}

Makes no sense only loop until a key is pressed.

you can use a code like the code in your exemple for exemple to write text while a key (in this case EXE) is pressed:
Code: Select all
    while (key == KEY_CTRL_EXE){
PrintXY(1, 1,(unsigned char*)"some text", 0);
}
SiO2 + CaCO3 ----------> CaSiO3 + CO2

Member
User avatar
Posts: 44
Joined: Tue Jul 02, 2013 11:57 am
Location: London
Calculators: Casio fx-7400G, Casio fx-7400G PLUS, Casio fx-7400GII, Casio fx-9750G, Casio fx-9750G PLUS, Casio fx-9860GII

Re: Need some newbie help please

Postby MrMagoo » Tue Jul 02, 2013 11:17 pm

helder7 wrote:
MrMagoo wrote:If i did;

While key = 0{
Getkey(&key);
}[/code]

Would this loop until a key is pressed?


While should be lowercase, "while"

To check if key is equal to 0, you should use the operator ==, not = (check this wikipedia article about operators)

You can/should simply use the following code to getkey indefinitely:
while(1){
GetKey(&key);
}

Makes no sense only loop until a key is pressed.

you can use a code like the code in your exemple for exemple to write text while a key (in this case EXE) is pressed:
Code: Select all
    while (key == KEY_CTRL_EXE){
PrintXY(1, 1,(unsigned char*)"some text", 0);
}



Ok excellent, can we add a select case control that allows the code to jump to various functions?

so if the user presses F1 while in the loop it jumps to function1, or F2 and it jumps to function2 etc?

Also, how do we get an input from the user?
"The trouble with internet quotations, is that the majority are totally made up." - Abraham Lincoln 1863

Next

Return to Casio fx-9860 SDK

Who is online

Users browsing this forum: No registered users and 20 guests