Register

fx-9860GII - Arduino - Communication

Discuss anything related to calculators. For specific help on certain games/programs check the Released Projects subforum.
Junior Member
Posts: 14
Joined: Fri Apr 26, 2013 5:57 pm
Location: BW, Germany
Calculators: Casio fx-9860GII

Re: fx-9860GII - Arduino - Communication

Postby Pedantis » Mon May 20, 2013 10:00 pm

Ok, but what is its syscall number? I implemented the syscalls in syscalls.src like this:
Code: Select all
   SYSCALL 040C,   _Serial_ReadOneByte
   SYSCALL 040E,   _Serial_BufferedTransmitOneByte
   SYSCALL 0418,   _Serial_Open
   SYSCALL 0419,   _Serial_Close
   SYSCALL 0414,   _Serial_ClearTransmitBuffer
   SYSCALL 0CC5,   _InputString


But were can I find the numbers (like 040C, 0414)? Until now I just googled it.

EDIT: Seems like I just have to remove 0x 8-)

Junior Member
Posts: 14
Joined: Fri Apr 26, 2013 5:57 pm
Location: BW, Germany
Calculators: Casio fx-9860GII

Re: fx-9860GII - Arduino - Communication

Postby Pedantis » Tue May 21, 2013 1:07 am

Ok, I was able to implement the syscall correctly. It supports nearly every single mathematical expression (sin, ln, sqrt (as a symbol)) but not spaces and not small chars :(
Does anybody know how to do that?

Senior Member
User avatar
Posts: 113
Joined: Sun Dec 16, 2012 2:59 pm
Calculators: None

Re: fx-9860GII - Arduino - Communication

Postby Casimo » Tue May 21, 2013 9:21 am

You can use your own string input or an implemented one:
1) download mylib
2) include mylib.h
3) declare "struct String * msg;"
4) init string "msg = stringInit("", strlen(test));"
5) get message "stringInput(1, 1, msg, 8, strlen(test), "", 1, INPUT_STRING);"
6) Your data is now "s1->data"

I don't think that you have to clear the transmit buffer more than one time ;)
Image

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: fx-9860GII - Arduino - Communication

Postby SimonLothar » Tue May 21, 2013 10:15 am

Pedantis wrote:Strangely, the resulted output on my computer looks always like this:
"Loÿrÿeÿm iÿpsum doÿlÿoÿrÿ siÿtÿ ameÿtÿ"
Does somebody know why?
Looks like some parity problem.
The ÿ always occurs after even-parity characters.

Try to adjust the parity setting on either side:
f.i. here:
mode[ 2 ] = 2;//parity: 0=no; 1=odd; 2=even
I'll be back!

Junior Member
Posts: 14
Joined: Fri Apr 26, 2013 5:57 pm
Location: BW, Germany
Calculators: Casio fx-9860GII

Re: fx-9860GII - Arduino - Communication

Postby Pedantis » Tue May 21, 2013 10:29 am

SimonLothar: That's exactly what I did yesterday to fix it ;)
Casimo: I already tried that, but I wasn't able to read the information from s1->data...
That works now, but, when compiling, the linker aborts.
First, I got an undefined external symbol error "_stringInput" (which was fixed by changing the name of the specific syscall in syscalls.src), and now he would like to see "_stringInit" defined, but I am not familiar with that syscall and wasn't able to find it in SimonLothars work...
Does somebody know that syscall? Does it even exist?

BTW, Casimo: In your example the information should be stored in msg->data, not in s1->data, or am I wrong?

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: fx-9860GII - Arduino - Communication

Postby SimonLothar » Wed May 22, 2013 1:30 pm

Pedantis wrote:First, I got an undefined external symbol error "_stringInput" (which was fixed by changing the name of the specific syscall in syscalls.src), and now he would like to see "_stringInit" defined, but I am not familiar with that syscall and wasn't able to find it in SimonLothars work...
Does somebody know that syscall? Does it even exist?
stringInput and stringInit are functions contained in mylib.c. These are no syscalls.
I'll be back!

Junior Member
Posts: 14
Joined: Fri Apr 26, 2013 5:57 pm
Location: BW, Germany
Calculators: Casio fx-9860GII

Re: fx-9860GII - Arduino - Communication

Postby Pedantis » Wed May 22, 2013 6:32 pm

Yes, I just figured that out, sorry :roll:
Well, it works now, here is my final code:
Code: Select all
#include <string.h>
#include "fxlib.h"
#include "mylib.h"

int Serial_BufferedTransmitOneByte(unsigned char);
int Serial_Open(void *sm);
int Serial_Close(int mode);
struct String* msg;

int i;
unsigned int key;
unsigned char demo;
char mode[6];

int AddIn_main(int isAppli, unsigned short OptionNum)
{
    messageBox("Use this program to|tweet via serial","fx-9860GII twitter client");
    Bdisp_AllClr_DDVRAM();
    msg = stringInit("", 50);
    mode[0] = 0;
    mode[1] = 5;
    mode[2] = 2;
    mode[3] = 0;
    mode[4] = 0;
    mode[5] = 0;
    Serial_Open(&mode);
    stringInput(2,3,msg,19,50,"Tweet",1,INPUT_STRING);
    if (strlen(msg->data)>0)
    {
        for(i=0; i<strlen(msg->data); i++)
        {
            Serial_ClearTransmitBuffer();
            demo=msg->data[i];
            Serial_BufferedTransmitOneByte(demo);
            Sleep(100);
        }
        /*This is the tweeting trigger used by the Arduino*/
        Serial_BufferedTransmitOneByte('X');
        Sleep(100);
        Serial_BufferedTransmitOneByte('Y');
        /*----------------------------------------------*/
        Bdisp_AllClr_DDVRAM();
        locate(2,4);
        Print((unsigned char*)"Tweeted sucessfully");
        while(1)
        {
            GetKey(&key);
        }
    }
    return 1;
}

#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

Thanks to everybody who helped me starting to code with the SDK! ;)
I'm going to try to add a possibility to enter small characters.

Previous

Return to General

Who is online

Users browsing this forum: No registered users and 56 guests