Jump to content



Photo
- - - - -

Chr$(X),char(X)

Integer Character

  • Please log in to reply
9 replies to this topic

#1 Maverich40

Maverich40

    Casio Fan

  • Members
  • PipPip
  • 32 posts
  • Gender:Male
  • Location:Pennsylvania
  • Interests:Math, Programming, Astronomy, Space

  • Calculators:
    Casio fxCG500, fxCG10, fx-115ES, &c. and other brands.

Posted 14 August 2013 - 04:45 AM

Is there any way at all, under Casio BASIC [9860, CG10] to generate a Character which can then be concatenated together to form a String?

For some reason I see absolutely no way to do this, and nothing comes up in any google seach!

Chr$(x), Char(x), etc, $#ASC_Value, there must be SOMETHING that allows a character from
integer to be created? Otherwise it just another of 1000's of examples of how weak and very much behind the times Casio Basic is for all of their calculators!

Thanks for any working suggestions.

//Maverich40//

#2 3298

3298

    Casio Addict

  • Members
  • PipPipPip
  • 79 posts
  • Gender:Male
  • Location:Germany

  • Calculators:
    fx-9750G Plus
    Algebra FX 2.0 (ROM 1.03,broken)
    HP 50G

Posted 14 August 2013 - 08:51 AM

Sorry, Casio calculators don't have such a function. Yes, it would be very useful, but when I was in need of such a function, I just created huge translation tables with If-Then-Else-IfEnd and =>. I did that to store strings because my calculator didn't (and still doesn't, of course) support string variables. Anyway, that's a slow method (slightly more than one character per second :( - the 9860 and newer should be a bit faster because the Casio-Basic interpreter is faster, though I suspect you won't get more than three characters per second), but the only one you can use until someone screams at Casio loud enough to make them create such a function.
By the way, the other way round (character to integer) isn't possible either with built-in functions. That was the other half of my translation tables, with about the same speed.

#3 Maverich40

Maverich40

    Casio Fan

  • Members
  • PipPip
  • 32 posts
  • Gender:Male
  • Location:Pennsylvania
  • Interests:Math, Programming, Astronomy, Space

  • Calculators:
    Casio fxCG500, fxCG10, fx-115ES, &c. and other brands.

Posted 14 August 2013 - 04:12 PM

Can your program be called as a subroutine? And display a Character as needed?
If we could merely store a List-of-Chars ['A','B','C',...] that would of course work.

<HINT> Surely someone knows enough about 9860 programming to create a _binary_app_ that could handle such an important task. </HINT>

//Maverich40//

#4 3298

3298

    Casio Addict

  • Members
  • PipPipPip
  • 79 posts
  • Gender:Male
  • Location:Germany

  • Calculators:
    fx-9750G Plus
    Algebra FX 2.0 (ROM 1.03,broken)
    HP 50G

Posted 15 August 2013 - 09:29 AM

I designed it as a subroutine, but I never published it. I don't have it on this computer, but it should be in the archives scattered over my desktop's hard drive. I'll look for it when I'm back at home.
Lists of characters are also impossible. They would be handy for translation tables (simply use your integer as index and fetch the corresponding character from the list), but oh well, this is Casio-Basic.
The problem with binary apps for this is that you can't easily interface to Casio-Basic. There have been attempts, but basically they need to modify the interpreter in the calculator's OS for that. Casio-Basic has no command to call an addin, so you need to modify existing commands. This is something programmers want to avoid because the old function of that command wouldn't be available anymore.

Edit: I found an early version of my program inside a backup file that dates back to Feb '09, but because I currently don't have a calc<->PC cable available to send the backup to the calc and the individual programs back to the PC, I won't upload it (here's what the name entry for that program looks like: FF4F4954584554FFFF - everything is written in text-encoded hex numbers and backwards - I can fix these, though there is no way to convert the bytecode to *.cat or *.g1m or similar formats). I could extract it manually, but that would amount to a rewrite, and that slightly buggy version simply isn't worth it. There is no software to automate this process.
Instead I'll give you a template for that conversion table:
A=65=>"A"->Str 1
A=66=>"B"->Str 1
A=67=>"C"->Str 1
... (guess what you have to write here ... hint: not the three dots I wrote)
A=90=>"Z"->Str 1
Store this in a program, then call it with the number you want to have converted in A. You will get the result in the string variable Str 1.
You can add anything you need, small letters, numbers, special symbols, ... of course you don't even have to follow the ASCII table, you can invent your own format.

Edited by 3298, 16 August 2013 - 02:47 PM.


#5 Casimo

Casimo

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 641 posts
  • Gender:Not Telling

Posted 16 August 2013 - 03:32 PM

Have you already tried StrMid("ABCDEFG.......", A - 64, 1) -> Str 1 ;) ?

#6 Maverich40

Maverich40

    Casio Fan

  • Members
  • PipPip
  • 32 posts
  • Gender:Male
  • Location:Pennsylvania
  • Interests:Math, Programming, Astronomy, Space

  • Calculators:
    Casio fxCG500, fxCG10, fx-115ES, &c. and other brands.

Posted 18 August 2013 - 07:00 PM

Amazing looking outside the box! Thank you for sharing that wisdom.

#7 Maverich40

Maverich40

    Casio Fan

  • Members
  • PipPip
  • 32 posts
  • Gender:Male
  • Location:Pennsylvania
  • Interests:Math, Programming, Astronomy, Space

  • Calculators:
    Casio fxCG500, fxCG10, fx-115ES, &c. and other brands.

Posted 18 August 2013 - 07:27 PM

Casio Overlord: would you know why these special String functions only appear in the Catalog when in Programming Mode only?
They are still a bit combersum to use... but I suppose I could work something out for what I have in mind.
Are you familiar with Grid Squares (maidenhead conversion of Lat, Lon into a 4,6,8 Alpha-Numeric String that represents an area on the Globe of the Earth.
All I set out to do was create a Casio 9860GII program to do just that. I have the algorithm which I've been able to translate to Fortran, Pascal, and of course
Octave and C. Casio 9860 is proving challenging. HaHa.

#8 Maverich40

Maverich40

    Casio Fan

  • Members
  • PipPip
  • 32 posts
  • Gender:Male
  • Location:Pennsylvania
  • Interests:Math, Programming, Astronomy, Space

  • Calculators:
    Casio fxCG500, fxCG10, fx-115ES, &c. and other brands.

Posted 18 August 2013 - 08:30 PM

I find I am having trouble with this particular algorithm. In my Fortran - Octave applications, we have Ceil and Floor, but I do not apparently know how to
implement these in Casio 9860 yet... even in Program Mode no such functions. Int, IntDiv, Frac even...

#9 Maverich40

Maverich40

    Casio Fan

  • Members
  • PipPip
  • 32 posts
  • Gender:Male
  • Location:Pennsylvania
  • Interests:Math, Programming, Astronomy, Space

  • Calculators:
    Casio fxCG500, fxCG10, fx-115ES, &c. and other brands.

Posted 19 August 2013 - 08:00 PM

I made a "new topic" post about what I am actually trying to do, and now have succeeded beyond my wildest dreams,
so please pick up this thread from "GridSquares" and/or "how to do ceil, mod" in Casio 9860. Thanks.

Thanks to everyone who helped.
//Maverich40 at ya hoo dot com//

#10 Casimo

Casimo

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 641 posts
  • Gender:Not Telling

Posted 25 August 2013 - 09:50 AM

Casio Overlord: would you know why these special String functions only appear in the Catalog when in Programming Mode only?
Are you familiar with Grid Squares (maidenhead conversion of Lat, Lon into a 4,6,8 Alpha-Numeric String that represents an area on the Globe of the Earth.


Sorry, I do not know :P




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users