Thread: TI 89 Input routine with comma, backspace and sign

  1. #1
    Registered User
    Join Date
    Jan 2003

    TI 89 Input routine with comma, backspace and sign

    Anyone programming his TI calc in c here`s a fine input routine to enter numbers.Only problem is,that at the end, function atof will not convert the string properly when compiled with TIGCC IDE.
    The reason is header #define MIN_AMS 100.
    It works fine without it!
    took me a week to figure that out!

                             #define USE_TI89 // Compile for TI-89
                             #define USE_TI92PLUS // Compile for TI-92 Plus
                             #define USE_V200 // Compile for V200
                             #define MIN_AMS 100 // Compile for AMS 1.00 or higher
                             #define SAVE_SCREEN // Save/Restore LCD Contents
                             #include <tigcclib.h> // Include All Header Files
                             float Input; // converted enters tring -any input 
                             / ****************SubRoutines***********************
                             void InputStr(char *buffer, unsigned short maxlen);
                             / ****************VoidInputstring*******************
                             void InputStr(char *buffer, unsigned short maxlen)
                             SCR_STATE ss1;
                             signed short key;
                             unsigned short i = 0;
                             buffer[0] = 0;
                             SaveScrState (&ss1); 
                             MoveTo (ss1.CurX, ss1.CurY); 
                             SaveScrState (&ss1);
                             if ( i==3 ) {printf ("%s ", buffer);} 
                             printf ("%s_ ", buffer); 
                             key = ngetchx (); 
                             if (key >= '0' && key <= '9' && i < maxlen) 
                             buffer[i++] = key; 
                             else if (key == KEY_BACKSPACE ) i--; 
                             else if (key==173 && i==0) buffer[i++] = key;//(-) 
                             else if (key==46)buffer[i++] = key; //comma
                             buffer[i] = 0; 
                             } while (key != KEY_ENTER);
                             Input = atof(buffer); 
                             void _main(void)
                             int key;
                             char str[7];
                             clrscr (); 
                             InputStr (str,7); 
                             printf("\nconverted float=%3.3f",Input);
                             }while (key!=KEY_ESC);

    code tags added by Hammer

  2. #2
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    between photons and phonons
    I have a TI 92-plus at school and i know u can program on it but do you know if its possible to program on it in C. Because the functions and commands used in the TI-92 suck (IMO).

Popular pages Recent additions subscribe to a feed