#include <intrins.h>
#include <reg51.h>
#include "calc.h"
//Variables
static  data LONG lvalue;
static  data LONG rvalue;
static  data CHAR currtoken;
static  data CHAR lasttoken;
static  data CHAR lastpress;
static  xdata CHAR outputbuffer[MAX_DISPLAY_CHAR];
VOID main (VOID)
//Initialise our variables and call the 
//Assembly routine to initialise the LCD display. 
 { lvalue    = 0;
   rvalue    = 0;
   currtoken = '=';
   lasttoken = '0';
   initialise();  // Initialize the LCD
   calc_output(OK);
   calc_evaluate();
 }   
VOID calc_evaluate()
 { CHAR data key;
   INT  data i;
   CHAR xdata number[MAX_DISPLAY_CHAR];
   CHAR xdata *bufferptr;
   
   // Clear the buffer before we start.
   for (i = 0; i <= MAX_DISPLAY_CHAR; i++)
      { number[i] = ' ';
   }
   bufferptr = n论文范文http://www.chuibin.com/  umber;  
   
   for (;;)
     { key = calc_getkey();
    if (calc_testkey(key))
       // Key test positive for digit so we read it into the
       // buffer and then write the buffer to the screen/LCD.
    // Size limit the number of digits - allow for termination
    // and possible negative results.
          { if (bufferptr != &number[MAX_DISPLAY_CHAR - 2])
               { *bufferptr = key;
                 calc_display(number);
                 bufferptr++;
               }
          }
       else本文来自辣.文,论-文·网原文请找腾讯3249-114
       // Key is an operator so pass it to the function handlers.
       // If we are just after startup or cancel then assign to lvalue
       // otherwise assign to rvalue.2514