Author Topic: TI & programming languages used on the NSpire CX CAS  (Read 20988 times)

0 Members and 1 Guest are viewing this topic.

Offline stefos

  • LV3 Member (Next: 100)
  • ***
  • Posts: 45
  • Rating: +3/-21
    • View Profile
TI & programming languages used on the NSpire CX CAS
« on: December 12, 2013, 08:25:49 pm »
Hi everyone,

As you probably know, I'm very new here!

My A.S. degree is in IT.

I don't know much about calculator languages so I'd appreciate the help & probably so would anyone else who reads this!

Can someone please clarify the following languages & their interfacing, as it were, with the TI NSpire CX CAS?
I don't really understand the differences insofar as ease of actually using the languages goes & which language can do what
programming wise.

Basic
C/Assembly
LUA

What do I currently know or think I know?
Basic was/is a "basic" boolean type of calculator language for making programs for the calculator
C is a programming language for computers....Not sure exactly how it's been matriculated to calculators except for the fact
that commands are executed
Assembly...I have ZERO idea where this fits
LUA is TI's proprietary calculator programming language?

I ask because on ticalc.org, Assembly & Basic & LUA programs are found but not C based programs.
Other websites probably use the other languages.

Thank you from me & every other viewer of this particular thread in the future!
Stefos

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: TI & programming languages used on the NSpire CX CAS
« Reply #1 on: December 12, 2013, 08:58:30 pm »
You will find that BASIC, C and Lua, being high level languages, are very similar in terms of functionality, though there are some differences in the data types and built in functions available. TI-BASIC has all the built in math functions and high precision floating point values used in the calculator app, Lua has its drawing routines, and C is more barebones. BASIC and Lua are interpreted languages, which means the calculator goes through the code you typed out and follows it accordingly, using another program, the interpreter, to do so. This is inefficient, but for many purposes acceptable. C is a high level language like the previous two, but it is compiled into assembly language, which runs directly on the processor, making it very fast. You can also code in assembly, where you are writing out the actual instructions the processor runs. You don't get nice things like if-else statements, loops, array indexing, etc., instead having to recreate these features using the various CPU instructions available to you. Properly written, it is even faster than C, but it takes more skill to do so.
« Last Edit: December 12, 2013, 09:00:35 pm by t0xic_kitt3n »

Offline Legimet

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +29/-0
    • View Profile
Re: TI & programming languages used on the NSpire CX CAS
« Reply #2 on: December 12, 2013, 10:22:49 pm »
TI-Basic is TI's own language for calculators. On the Nspire, this is only well-suited for mathematical programs, and graphics features are limited. To program, you need a physical Nspire or the student software.

Assembly is low level cpu instructions. The Nspire has an ARM processor, so you must use ARM assembly. With asm (as we usually abbreviate it), you don't get high level language features, so almost nobody programs in it. But it is helpful to know assembly because you understand how the cpu works, and it can be very fast if you write it well. Ndless SDK required to program, and Ndless is required on the calc to run.

To program in C, you need the Ndless SDK along with a GNU ARM toolchain (binutils, gcc, gdb) and the Newlib standard library. Many of the stdlib functions are available as syscalls in the OS, and many functions from Newlib also work. As usual, C is translated into assembly language before assembling, so you need Ndless on your calc. (C programs are categorized under Assembly on ticalc.org) C++ is also available.

Lua is lightweight, cross-platform interpreted language that first appeared 20 years ago. On the Nspire, you don't have some of the system functions normally available in Lua, but you have additional proprietary libraries from TI that give you things like graphics. You can program this either with the Student Software or a tool called Luna, and Ndless is not required.

So, in order of increasing control, the languages you can use are:
TI-Basic
Lua
C/C++
Asm

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: TI & programming languages used on the NSpire CX CAS
« Reply #3 on: December 12, 2013, 10:36:09 pm »
More random info that might be helpful:
  • C programs compile to native code (like assembly) so there's no real difference to a user whether a program was made in C or assembly, so they're all found under http://www.ticalc.org/pub/nspire/asm/.
  • Lua is a pretty standard language that is used in far more places than TI calculators—see http://http://www.lua.org/. TI simply ported the Lua interpreter to their Nspire handhelds so that you can use the language there. Lua is now one of the most convenient ways to make games and graphical programs on the TI-Nspire series.
  • TI-BASIC is a bit of a misnomer that was originally applied to the proprietary language on TI's earlier graphing calculators (especially the Z80 series), and it doesn't have much to do with the actual computer language called BASIC. The TI-Nspire math scripting language is even more different, even though we still often refer to it as Nspire BASIC. It's also a lot more limited than the TI-BASIC languages on other graphing calculator models, and is generally useful only for non-graphical math programs. (But there are exceptions.) You'll almost never see TI refer to any of these "TI-BASIC" languages as such, by the way—in official documentation they're usually referred to as something like "extensible programming functionality."




Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: TI & programming languages used on the NSpire CX CAS
« Reply #4 on: December 12, 2013, 11:30:52 pm »
I must also add that ASM and C programs will only run on OS 3.1, since Ndless cannot be installed on newer OSes.

Offline stefos

  • LV3 Member (Next: 100)
  • ***
  • Posts: 45
  • Rating: +3/-21
    • View Profile
Re: TI & programming languages used on the NSpire CX CAS
« Reply #5 on: December 13, 2013, 04:56:25 pm »
Hi Everyone,

Thank you for your input!
This helps in understanding calculator languages.

Perhaps this thread should be pinned?

Just an idea,
Stefos