Register

Need some newbie help please

Discuss issues related to the fx-9860G Software Development Kit
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 » Wed Jul 03, 2013 12:11 pm

This time it complains about "stringSet".

Now comment the complete function "void callbackEvents(void* ptr){...}" and retry a rebuild.

Perhaps you could show the contents of the file test.g1w, too.
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 » Wed Jul 03, 2013 12:17 pm

Ok, you lost me now.

I dont know what callbackEvents is, or how to complete the function. I literally copied and pasted from the mylib example.

test.g1w produces this;

Code: Select all
[DLSimProject]
Name=Test
Version=1.0
Model=:fx-9860G.dlm
SourcePath=SRC
MemoryPath=INIT
MemCardPath=SDCard

[Program1]
Program=Test.G1A
Debug=Debug\FXADDINror.dbg
LoadAddress=80000000:90100000

[Files]
SourceFile=:Test.c
"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 » Wed Jul 03, 2013 12:48 pm

To comment a function is to enclose it in /* and */. This prevents the compiler to heed for this part of the source code, f. i. while testing.
Usually /* and */ are used to write a block comment. Sometimes, if you want to exclude a piece of code from compiling, you enclose this code with /* and */, too.
If a compiling error does not occur after you commented a part of the code, you know, that the problem lies within the commented code. This is one way to isolate bugs.

The dump of your test.g1w shows no sign of mylib.c in the files-section. Try to include mylib.c into the list of source files. There must be some panel in the SDK's workbench called "source files" or such (I do not have a SDK in this office, so I cannot tell the exact description). mylib.c must be included there, otherwise the compiler cannot find mylib's functions.
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 » Wed Jul 03, 2013 1:05 pm

Ah ha! That worked! Excellent. :D Thanks

So now I basically want to create a menu, with various choices.
Each choice will take the user to a different type of calculation, with various different inputs. Produce a result, then take them back to the main menu.

Whats the best way of going about this?
"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 » Wed Jul 03, 2013 1:40 pm

MrMagoo wrote:So now I basically want to create a menu, with various choices.
Each choice will take the user to a different type of calculation, with various different inputs. Produce a result, then take them back to the main menu.
Whats the best way of going about this?

mylib seems to contain some appropriate functions (Though I do not know mylib in detail).

But I'd recommend to try some basic exercises yourself to get accustomed with the system.

Use locate() and Print() to display the choices:
f. i.

F1: option 1
F2: option 2
EXIT: return

wait for the user input with GetKey()

use a switch-construct to decide, what to do in response to the key, which has been hit.

Code: Select all
int lContinue = 1;

while( lContinue ){
  GetKey( &key );
  switch (key){
    case KEY_CTRL_F1 :
      option1();
      break;
    case KEY_CTRL_F2 : 
      option2();
      break;
    case KEY_CTRL_EXIT :
      lContinue = 0;
      break;
  }
}

with the function definitions

Code: Select all
void option1(){
...
}

void option2(){
...
}

These functions could do anything you want, f. i. perform a secondary menu, display some information or ask for some.
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 » Wed Jul 03, 2013 2:43 pm

I tried this, but keep getting illegal token errors

Code: Select all
#include "fxlib.h"
#include <stdio.h>

int AddIn_main(int isAppli, unsigned short OptionNum)
{
    unsigned int key;

    Bdisp_AllClr_DDVRAM();

    locate(1,1);
    Print((unsigned char*)"Menu");
    locate(1,2);
    Print((unsigned char*)"[F1] Option1");
    locate(1,3);
    Print((unsigned char*)"[F2] Option2");


int lContinue = 1;

while( lContinue ){
  GetKey( &key );
  switch (key){
    case KEY_CTRL_F1 :
      option1();
      break;
    case KEY_CTRL_F2 :
      option2();
      break;
    case KEY_CTRL_EXIT :
      lContinue = 0;
      break;
  }
}


void option1(){
Bdisp_AllClr_DDVRAM();
locate(1,2);
Print((unsigned char*)"You pressed Option1");
}

void option2(){
Bdisp_AllClr_DDVRAM();
locate(1,2);
Print((unsigned char*)"You pressed Option2");
}




//****************************************************************************
//**************                                              ****************
//**************                 Notice!                      ****************
//**************                                              ****************
//**************  Please do not change the following source.  ****************
//**************                                              ****************
//****************************************************************************


#pragma section _BR_Size
unsigned long BR_Size;
#pragma section


#pragma section _TOP

//****************************************************************************
//  InitializeSystem
//
//  param   :   isAppli   : 1 = Application / 0 = eActivity
//              OptionNum : Option Number (only eActivity)
//
//  retval  :   1 = No error / 0 = Error
//
//****************************************************************************
int InitializeSystem(int isAppli, unsigned short OptionNum)
{
    return INIT_ADDIN_APPLICATION(isAppli, OptionNum);
}

#pragma section



Code: Select all
Executing Hitachi SH C/C++ Compiler/Assembler phase

set SHC_INC=E:\Casio\OS\SH\include
set PATH=E:\Casio\OS\SH\bin
set SHC_LIB=E:\Casio\OS\SH\bin
set SHC_TMP=E:\Casio\Projects\S\Debug
"E:\Casio\OS\SH\bin\shc.exe" -subcommand=C:\Users\D~1.LAW\AppData\Local\Temp\hmk1EAD.tmp
E:\Casio\Projects\S\S.c(19) : C2500 (E) Illegal token "int"
E:\Casio\Projects\S\S.c(19) : C2225 (E) Undeclared name "lContinue"
E:\Casio\Projects\S\S.c(19) : C2220 (E) Modifiable lvalue required for "="
E:\Casio\Projects\S\S.c(37) : C2500 (E) Illegal token "void"
E:\Casio\Projects\S\S.c(37) : C2500 (E) Illegal token "{"
E:\Casio\Projects\S\S.c(43) : C2500 (E) Illegal token "void"
E:\Casio\Projects\S\S.c(43) : C2500 (E) Illegal token "{"
E:\Casio\Projects\S\S.c(61) : C2709 (E) Illegal section name declaration
E:\Casio\Projects\S\S.c(62) : C2500 (E) Illegal token "unsigned"
E:\Casio\Projects\S\S.c(62) : C2225 (E) Undeclared name "BR_Size"
E:\Casio\Projects\S\S.c(63) : C2709 (E) Illegal section name declaration
E:\Casio\Projects\S\S.c(66) : C2709 (E) Illegal section name declaration
E:\Casio\Projects\S\S.c(77) : C2500 (E) Illegal token "int"
E:\Casio\Projects\S\S.c(77) : C2500 (E) Illegal token "int"
E:\Casio\Projects\S\S.c(78) : C2500 (E) Illegal token "{"
E:\Casio\Projects\S\S.c(82) : C2709 (E) Illegal section name declaration
E:\Casio\Projects\S\S.c(83) : C2500 (E) Illegal token ""

HMAKE MAKE UTILITY Ver. 1.1
Copyright (C) Hitachi Micro Systems Europe Ltd. 1998
Copyright (C) Hitachi Ltd. 1998
"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 » Wed Jul 03, 2013 2:52 pm

There is a closing curly bracket missing.
Code: Select all
  int lContinue = 1;

  while( lContinue ){
    GetKey( &key );
    switch (key){
      case KEY_CTRL_F1 :
        option1();
        break;
      case KEY_CTRL_F2 :
        option2();
        break;
      case KEY_CTRL_EXIT :
        lContinue = 0;
        break;
    }
  }

}  // this is the missing curly bracket

void option1(){
Bdisp_AllClr_DDVRAM();
locate(1,2);
Print((unsigned char*)"You pressed Option1");
}
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 » Wed Jul 03, 2013 3:17 pm

Ok that fixed that issue,

I now have this error

E:\Casio\Projects\S\S.c(44) : C2144 (E) Type mismatch

On this line;
Code: Select all
void option1() {
"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 » Wed Jul 03, 2013 3:28 pm

try add
Code: Select all
void option1();
void option2();

before int AddIn_main:

Code: Select all
#include "fxlib.h"
#include <stdio.h>

void option1();
void option2();
int lContinue = 1;

int AddIn_main(int isAppli, unsigned short OptionNum)
{
    unsigned int key;

    Bdisp_AllClr_DDVRAM();

    locate(1,1);
    Print((unsigned char*)"Menu");
    locate(1,2);
    Print((unsigned char*)"[F1] Option1");
    locate(1,3);
    Print((unsigned char*)"[F2] Option2");


while( lContinue ){
  GetKey( &key );
  switch (key){
    case KEY_CTRL_F1 :
      option1();
      break;
    case KEY_CTRL_F2 :
      option2();
      break;
    case KEY_CTRL_EXIT :
      lContinue = 0;
      break;
  }
}
}


void option1(){
Bdisp_AllClr_DDVRAM();
locate(1,2);
Print((unsigned char*)"You pressed Option1");
}

void option2(){
Bdisp_AllClr_DDVRAM();
locate(1,2);
Print((unsigned char*)"You pressed Option2");
}




//****************************************************************************
//**************                                              ****************
//**************                 Notice!                      ****************
//**************                                              ****************
//**************  Please do not change the following source.  ****************
//**************                                              ****************
//****************************************************************************


#pragma section _BR_Size
unsigned long BR_Size;
#pragma section


#pragma section _TOP

//****************************************************************************
//  InitializeSystem
//
//  param   :   isAppli   : 1 = Application / 0 = eActivity
//              OptionNum : Option Number (only eActivity)
//
//  retval  :   1 = No error / 0 = Error
//
//****************************************************************************
int InitializeSystem(int isAppli, unsigned short OptionNum)
{
    return INIT_ADDIN_APPLICATION(isAppli, OptionNum);
}

#pragma section
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 » Wed Jul 03, 2013 3:41 pm

Boom! Yes that works perfectly.

So each function needs to be declared just like a variable? I see!

EDIT, Would I also be right in thinking if I added all the functions to their own file, and inlcuded that file, I wouldnt need to declare them? RE-EDIT, Ok I tried that and go another error * L2300 (E) Duplicate symbol "_option1" in "E:\Casio\Projects\S\Debug\S.obj"
"The trouble with internet quotations, is that the majority are totally made up." - Abraham Lincoln 1863

PreviousNext

Return to Casio fx-9860 SDK

Who is online

Users browsing this forum: No registered users and 25 guests