SlideShare a Scribd company logo
1 of 14
MINI – KEY 4x4




port 14 pin to 10 pin
HC11-CPU ET-EXP4
key switch connect MCS 51 and LCD




Shift =                            key switch



  =       “    ”      Shift

  =       “    ”      Shift

                        sin

  =       “   ”       Shift

                        cos
=    “         ”     Shift

                            tan

 =    “ ”           Shift

                            log

 =    “     ”        Shift

                            sqrt

 =    “     ”        Shift

                            epxp

 =    “     ”         Shift

                            pow 2

8=    “         ”     Shift

                            pow 3

9=    “     ”         Shift

                            absolute

+=                      “         ”

- =                     “     ”

*=                     “      ”

/ =                     “         ”
key switch
#include <at89c51xd2.h>

#include <stdlib.h>

#include <string.h>

#include <stdio.h>

#include <math.h>



sbit E = P0^2;

sbit RS = P0^0;

sbit a1 = P1^0; //row

sbit a2 = P1^1;

sbit a3 = P1^2;

sbit a4 = P1^3;

sbit b1 = P1^4;    //col

sbit b2 = P1^5;

sbit b3 = P1^6;

sbit b4 = P1^7;

char keyp()

{

char nkey = ' ';
a1 = 0; a2 = 1; a3 = 1; a4 = 1;

if(a1 == 0 && b1 == 0) nkey = '7';

else if(a1 == 0 && b2 == 0) nkey = '4';

else if(a1 == 0 && b3 == 0) nkey = '1';

else if(a1 == 0 && b4 == 0) nkey = 'c';



a1 = 1; a2 = 0; a3 = 1; a4 = 1;

if(a2 == 0 && b1 == 0) nkey = '8';

else if(a2 == 0 && b2 == 0) nkey = '5';

else if(a2 == 0 && b3 == 0) nkey = '2';

else if(a2 == 0 && b4 == 0) nkey = '0';



a1 = 1; a2 = 1; a3 = 0; a4 = 1;

if(a3 == 0 && b1 == 0) nkey = '9';

else if(a3 == 0 && b2 == 0) nkey = '6';

else if(a3 == 0 && b3 == 0) nkey = '3';

else if(a3 == 0 && b4 == 0) nkey = '=';



a1 = 1; a2 = 1; a3 = 1; a4 = 0;

if(a4 == 0 && b1 == 0) nkey = '/';

else if(a4 == 0 && b2 == 0) nkey = '*';

else if(a4 == 0 && b3 == 0) nkey = '-';

else if(a4 == 0 && b4 == 0) nkey = '+';

return nkey;

}

void delay(unsigned int count)

{

unsigned int i;

for(i=0;i<=count;i++);
}

void write_data(unsigned char c)

{

P0 = (c & 0xF0) | 0x01;

E = 1; delay(200);

E = 0; delay(200);

P0 = ((c << 4) & 0xF0) | 0x01;

E = 1; delay(200);

E = 0; delay(200);

}

void write_init(unsigned char i)

{

P0 = (i & 0xF0);

E = 1; delay(200);

E = 0; delay(200);



P0 = ((i<<4) & 0xF0) ;

E = 1; delay(200);

E = 0; delay(200);

}

void write_string(unsigned char *s)

{

unsigned short i, len;

len = strlen(s);



for(i = 0;i <= (len-1);i++)

{

write_data(s[i]);

}
}

float cal (float f, float l, unsigned char o)

{

float ans = 0;

if(o == '+') ans = f + l;

else if(o == '-') ans = f - l;

else if(o == '*') ans = f * l;

else if(o == '/') ans = f / l;

else if(o == 's') ans = sin(f);

else if(o == 'c') ans = cos(f);

else if(o == 't') ans = tan(f);

else if(o == 'l') ans = log(f);

else if(o == 'q') ans = sqrt(f);

else if(o == 'e') ans = exp(f);

else if(o == 'p') ans = pow(2,l);

else if(o == 'P') ans = pow(3,l);

else if(o == 'S') ans = abs(f);

return ans;

}



void main ()

{

unsigned char keypad;

unsigned char Fnum[7], Lnum[7], Ans[15];

float fnum = 0, lnum = 0, ans = 0;

unsigned char Oper = ' ';

unsigned short countdigit = 0;

unsigned short c, chkc = 1;

write_init(0x33);
write_init(0x32);

write_init(0x28);

write_init(0x0e);

write_init(0x01);

write_init(0x0c);

         while(1)

         {

         keypad = keyp();

         if(countdigit <= 5 && keypad >= '0' && keypad <= '9')

         {

         if(Oper == ' ') Fnum[countdigit] = keypad;

         else Lnum[countdigit] = keypad;

         write_data(keypad);

         countdigit++;

         }

else if(keypad == '+')

{

Oper = '+';

write_data('+');

countdigit = 0;

}

else if(keypad == '-')

{

Oper = '-';

write_data('-');

countdigit = 0;

}

else if(keypad == '*')

{
Oper = '*';

write_data('*');

countdigit = 0;

}

else if(keypad == '/')

{

Oper = '/';

write_data('/');

countdigit = 0;

}

else if(keypad == 'c')

{

chkc = 1;

while(chkc)

{

keypad = keyp();

if(keypad == '0')

{

write_init(0x01);

write_init(0x80);

countdigit = 0;

Oper = ' ';

for(c = 0;c <= 14;c++)

{

if(c<=7)

{

Fnum[c] = ' ';

Lnum[c] = ' ';

}
Ans[c] = ' ';

}

chkc = 0;

}

else if(keypad == '1')

{

Oper = 's';

write_string("sin ");

chkc = 0;

}

else if(keypad == '2')

{

Oper = 'c';

write_string("cos ");

chkc = 0;

}

else if(keypad == '3')

{

Oper = 't';

write_string("tan ");

chkc = 0;

}

else if(keypad == '4')

{

Oper = 'l';

write_string("log ");

chkc = 0;

}

else if(keypad == '5')
{

Oper = 'q';

write_string("sqrt ");

chkc = 0;

}

else if(keypad == '6')

{

Oper = 'e';

write_string("epxp ");

chkc = 0;

}

else if(keypad == '7')

{

Oper = 'p';

write_string("power 2 ");

chkc = 0;

}

else if(keypad == '8')

{

Oper = 'P';

write_string("power 3 ");

chkc = 0;

}

else if(keypad == '9')

{

Oper = 'S';

write_string("absolute ");

chkc = 0;

while(keypad !=' ')
{

keypad = keyp();

}

}

}

else if(keypad == '=' && Oper != ' ')

{

fnum = atof(Fnum);

lnum = atof(Lnum);

ans = cal(fnum,lnum,Oper);

sprintf(Ans,"%0.3f",ans);

write_init(0xC0);

write_data('=');

write_string(Ans);

}



while(keypad !=' ')

{

keypad = keyp();

}

}

}

More Related Content

What's hot

Reverse Engineering: C++ "for" operator
Reverse Engineering: C++ "for" operatorReverse Engineering: C++ "for" operator
Reverse Engineering: C++ "for" operator
erithion
 
ภาษาซี
ภาษาซีภาษาซี
ภาษาซี
kramsri
 
Programa en C++ ( escriba 3 números y diga cual es el mayor))
Programa en C++ ( escriba 3 números y diga cual es el mayor))Programa en C++ ( escriba 3 números y diga cual es el mayor))
Programa en C++ ( escriba 3 números y diga cual es el mayor))
Alex Penso Romero
 
Travel management
Travel managementTravel management
Travel management
1Parimal2
 

What's hot (20)

งานนำเสนอ อาจารย์ลาวัลย์
งานนำเสนอ อาจารย์ลาวัลย์งานนำเสนอ อาจารย์ลาวัลย์
งานนำเสนอ อาจารย์ลาวัลย์
 
Blocks+gcd入門
Blocks+gcd入門Blocks+gcd入門
Blocks+gcd入門
 
Unix Programs
Unix ProgramsUnix Programs
Unix Programs
 
Lisp
LispLisp
Lisp
 
Data Structure - 2nd Study
Data Structure - 2nd StudyData Structure - 2nd Study
Data Structure - 2nd Study
 
C++ Programming - 4th Study
C++ Programming - 4th StudyC++ Programming - 4th Study
C++ Programming - 4th Study
 
Reverse Engineering: C++ "for" operator
Reverse Engineering: C++ "for" operatorReverse Engineering: C++ "for" operator
Reverse Engineering: C++ "for" operator
 
ภาษาซี
ภาษาซีภาษาซี
ภาษาซี
 
DataStructures notes
DataStructures notesDataStructures notes
DataStructures notes
 
week-17x
week-17xweek-17x
week-17x
 
C++ Programming - 1st Study
C++ Programming - 1st StudyC++ Programming - 1st Study
C++ Programming - 1st Study
 
Code
CodeCode
Code
 
Programa en C++ ( escriba 3 números y diga cual es el mayor))
Programa en C++ ( escriba 3 números y diga cual es el mayor))Programa en C++ ( escriba 3 números y diga cual es el mayor))
Programa en C++ ( escriba 3 números y diga cual es el mayor))
 
Singly Linked List
Singly Linked ListSingly Linked List
Singly Linked List
 
Chat code
Chat codeChat code
Chat code
 
Arduino code
Arduino codeArduino code
Arduino code
 
C++ Programming - 3rd Study
C++ Programming - 3rd StudyC++ Programming - 3rd Study
C++ Programming - 3rd Study
 
Program flowchart
Program flowchartProgram flowchart
Program flowchart
 
Vhdlbputspdas
VhdlbputspdasVhdlbputspdas
Vhdlbputspdas
 
Travel management
Travel managementTravel management
Travel management
 

Similar to โครงงาน เครื่องคิดเลข

8051 C Assignments with all examples covered
8051 C Assignments with all examples covered8051 C Assignments with all examples covered
8051 C Assignments with all examples covered
AbdulMunaf52
 
java compilerCompiler1.javajava compilerCompiler1.javaimport.docx
java compilerCompiler1.javajava compilerCompiler1.javaimport.docxjava compilerCompiler1.javajava compilerCompiler1.javaimport.docx
java compilerCompiler1.javajava compilerCompiler1.javaimport.docx
priestmanmable
 
Network lab manual
Network lab manualNetwork lab manual
Network lab manual
Prabhu D
 
FP 201 - Unit 6
FP 201 - Unit 6FP 201 - Unit 6
FP 201 - Unit 6
rohassanie
 
Bai Giang 11
Bai Giang 11Bai Giang 11
Bai Giang 11
nbb3i
 

Similar to โครงงาน เครื่องคิดเลข (20)

8051 C Assignments with all examples covered
8051 C Assignments with all examples covered8051 C Assignments with all examples covered
8051 C Assignments with all examples covered
 
Ch4
Ch4Ch4
Ch4
 
week-18x
week-18xweek-18x
week-18x
 
Vcs5
Vcs5Vcs5
Vcs5
 
C Code and the Art of Obfuscation
C Code and the Art of ObfuscationC Code and the Art of Obfuscation
C Code and the Art of Obfuscation
 
Avl tree
Avl treeAvl tree
Avl tree
 
Struct examples
Struct examplesStruct examples
Struct examples
 
DataTypes.ppt
DataTypes.pptDataTypes.ppt
DataTypes.ppt
 
java compilerCompiler1.javajava compilerCompiler1.javaimport.docx
java compilerCompiler1.javajava compilerCompiler1.javaimport.docxjava compilerCompiler1.javajava compilerCompiler1.javaimport.docx
java compilerCompiler1.javajava compilerCompiler1.javaimport.docx
 
第二回 冬のスイッチ大勉強会 - FullColorLED & MPU-6050編 -
第二回 冬のスイッチ大勉強会 - FullColorLED & MPU-6050編 -第二回 冬のスイッチ大勉強会 - FullColorLED & MPU-6050編 -
第二回 冬のスイッチ大勉強会 - FullColorLED & MPU-6050編 -
 
Os 2 cycle
Os 2 cycleOs 2 cycle
Os 2 cycle
 
Perl 6 in Context
Perl 6 in ContextPerl 6 in Context
Perl 6 in Context
 
Network lab manual
Network lab manualNetwork lab manual
Network lab manual
 
Microcontroladores: programas de CCS Compiler.docx
Microcontroladores: programas de CCS Compiler.docxMicrocontroladores: programas de CCS Compiler.docx
Microcontroladores: programas de CCS Compiler.docx
 
Sparse Matrix and Polynomial
Sparse Matrix and PolynomialSparse Matrix and Polynomial
Sparse Matrix and Polynomial
 
Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語
 
FP 201 - Unit 6
FP 201 - Unit 6FP 201 - Unit 6
FP 201 - Unit 6
 
VTU Data Structures Lab Manual
VTU Data Structures Lab ManualVTU Data Structures Lab Manual
VTU Data Structures Lab Manual
 
Bai Giang 11
Bai Giang 11Bai Giang 11
Bai Giang 11
 
Microsoft Word Hw#1
Microsoft Word   Hw#1Microsoft Word   Hw#1
Microsoft Word Hw#1
 

Recently uploaded

Mifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in Oman
Mifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in OmanMifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in Oman
Mifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in Oman
instagramfab782445
 
!~+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUD...
!~+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUD...!~+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUD...
!~+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUD...
DUBAI (+971)581248768 BUY ABORTION PILLS IN ABU dhabi...Qatar
 
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al MizharAl Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
allensay1
 

Recently uploaded (20)

SEO Case Study: How I Increased SEO Traffic & Ranking by 50-60% in 6 Months
SEO Case Study: How I Increased SEO Traffic & Ranking by 50-60%  in 6 MonthsSEO Case Study: How I Increased SEO Traffic & Ranking by 50-60%  in 6 Months
SEO Case Study: How I Increased SEO Traffic & Ranking by 50-60% in 6 Months
 
PHX May 2024 Corporate Presentation Final
PHX May 2024 Corporate Presentation FinalPHX May 2024 Corporate Presentation Final
PHX May 2024 Corporate Presentation Final
 
Horngren’s Cost Accounting A Managerial Emphasis, Canadian 9th edition soluti...
Horngren’s Cost Accounting A Managerial Emphasis, Canadian 9th edition soluti...Horngren’s Cost Accounting A Managerial Emphasis, Canadian 9th edition soluti...
Horngren’s Cost Accounting A Managerial Emphasis, Canadian 9th edition soluti...
 
Buy Verified TransferWise Accounts From Seosmmearth
Buy Verified TransferWise Accounts From SeosmmearthBuy Verified TransferWise Accounts From Seosmmearth
Buy Verified TransferWise Accounts From Seosmmearth
 
Cannabis Legalization World Map: 2024 Updated
Cannabis Legalization World Map: 2024 UpdatedCannabis Legalization World Map: 2024 Updated
Cannabis Legalization World Map: 2024 Updated
 
Mifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in Oman
Mifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in OmanMifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in Oman
Mifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in Oman
 
!~+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUD...
!~+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUD...!~+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUD...
!~+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUD...
 
Falcon Invoice Discounting: The best investment platform in india for investors
Falcon Invoice Discounting: The best investment platform in india for investorsFalcon Invoice Discounting: The best investment platform in india for investors
Falcon Invoice Discounting: The best investment platform in india for investors
 
Falcon Invoice Discounting: Tailored Financial Wings
Falcon Invoice Discounting: Tailored Financial WingsFalcon Invoice Discounting: Tailored Financial Wings
Falcon Invoice Discounting: Tailored Financial Wings
 
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al MizharAl Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
 
Paradip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
Paradip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDINGParadip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
Paradip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
 
Call 7737669865 Vadodara Call Girls Service at your Door Step Available All Time
Call 7737669865 Vadodara Call Girls Service at your Door Step Available All TimeCall 7737669865 Vadodara Call Girls Service at your Door Step Available All Time
Call 7737669865 Vadodara Call Girls Service at your Door Step Available All Time
 
New 2024 Cannabis Edibles Investor Pitch Deck Template
New 2024 Cannabis Edibles Investor Pitch Deck TemplateNew 2024 Cannabis Edibles Investor Pitch Deck Template
New 2024 Cannabis Edibles Investor Pitch Deck Template
 
Falcon Invoice Discounting: Aviate Your Cash Flow Challenges
Falcon Invoice Discounting: Aviate Your Cash Flow ChallengesFalcon Invoice Discounting: Aviate Your Cash Flow Challenges
Falcon Invoice Discounting: Aviate Your Cash Flow Challenges
 
Unveiling Falcon Invoice Discounting: Leading the Way as India's Premier Bill...
Unveiling Falcon Invoice Discounting: Leading the Way as India's Premier Bill...Unveiling Falcon Invoice Discounting: Leading the Way as India's Premier Bill...
Unveiling Falcon Invoice Discounting: Leading the Way as India's Premier Bill...
 
Lundin Gold - Q1 2024 Conference Call Presentation (Revised)
Lundin Gold - Q1 2024 Conference Call Presentation (Revised)Lundin Gold - Q1 2024 Conference Call Presentation (Revised)
Lundin Gold - Q1 2024 Conference Call Presentation (Revised)
 
Lucknow Housewife Escorts by Sexy Bhabhi Service 8250092165
Lucknow Housewife Escorts  by Sexy Bhabhi Service 8250092165Lucknow Housewife Escorts  by Sexy Bhabhi Service 8250092165
Lucknow Housewife Escorts by Sexy Bhabhi Service 8250092165
 
joint cost.pptx COST ACCOUNTING Sixteenth Edition ...
joint cost.pptx  COST ACCOUNTING  Sixteenth Edition                          ...joint cost.pptx  COST ACCOUNTING  Sixteenth Edition                          ...
joint cost.pptx COST ACCOUNTING Sixteenth Edition ...
 
Getting Real with AI - Columbus DAW - May 2024 - Nick Woo from AlignAI
Getting Real with AI - Columbus DAW - May 2024 - Nick Woo from AlignAIGetting Real with AI - Columbus DAW - May 2024 - Nick Woo from AlignAI
Getting Real with AI - Columbus DAW - May 2024 - Nick Woo from AlignAI
 
How to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League CityHow to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League City
 

โครงงาน เครื่องคิดเลข

  • 1.
  • 2. MINI – KEY 4x4 port 14 pin to 10 pin
  • 4. key switch connect MCS 51 and LCD Shift = key switch = “ ” Shift = “ ” Shift sin = “ ” Shift cos
  • 5. = “ ” Shift tan = “ ” Shift log = “ ” Shift sqrt = “ ” Shift epxp = “ ” Shift pow 2 8= “ ” Shift pow 3 9= “ ” Shift absolute += “ ” - = “ ” *= “ ” / = “ ”
  • 6. key switch #include <at89c51xd2.h> #include <stdlib.h> #include <string.h> #include <stdio.h> #include <math.h> sbit E = P0^2; sbit RS = P0^0; sbit a1 = P1^0; //row sbit a2 = P1^1; sbit a3 = P1^2; sbit a4 = P1^3; sbit b1 = P1^4; //col sbit b2 = P1^5; sbit b3 = P1^6; sbit b4 = P1^7; char keyp() { char nkey = ' ';
  • 7. a1 = 0; a2 = 1; a3 = 1; a4 = 1; if(a1 == 0 && b1 == 0) nkey = '7'; else if(a1 == 0 && b2 == 0) nkey = '4'; else if(a1 == 0 && b3 == 0) nkey = '1'; else if(a1 == 0 && b4 == 0) nkey = 'c'; a1 = 1; a2 = 0; a3 = 1; a4 = 1; if(a2 == 0 && b1 == 0) nkey = '8'; else if(a2 == 0 && b2 == 0) nkey = '5'; else if(a2 == 0 && b3 == 0) nkey = '2'; else if(a2 == 0 && b4 == 0) nkey = '0'; a1 = 1; a2 = 1; a3 = 0; a4 = 1; if(a3 == 0 && b1 == 0) nkey = '9'; else if(a3 == 0 && b2 == 0) nkey = '6'; else if(a3 == 0 && b3 == 0) nkey = '3'; else if(a3 == 0 && b4 == 0) nkey = '='; a1 = 1; a2 = 1; a3 = 1; a4 = 0; if(a4 == 0 && b1 == 0) nkey = '/'; else if(a4 == 0 && b2 == 0) nkey = '*'; else if(a4 == 0 && b3 == 0) nkey = '-'; else if(a4 == 0 && b4 == 0) nkey = '+'; return nkey; } void delay(unsigned int count) { unsigned int i; for(i=0;i<=count;i++);
  • 8. } void write_data(unsigned char c) { P0 = (c & 0xF0) | 0x01; E = 1; delay(200); E = 0; delay(200); P0 = ((c << 4) & 0xF0) | 0x01; E = 1; delay(200); E = 0; delay(200); } void write_init(unsigned char i) { P0 = (i & 0xF0); E = 1; delay(200); E = 0; delay(200); P0 = ((i<<4) & 0xF0) ; E = 1; delay(200); E = 0; delay(200); } void write_string(unsigned char *s) { unsigned short i, len; len = strlen(s); for(i = 0;i <= (len-1);i++) { write_data(s[i]); }
  • 9. } float cal (float f, float l, unsigned char o) { float ans = 0; if(o == '+') ans = f + l; else if(o == '-') ans = f - l; else if(o == '*') ans = f * l; else if(o == '/') ans = f / l; else if(o == 's') ans = sin(f); else if(o == 'c') ans = cos(f); else if(o == 't') ans = tan(f); else if(o == 'l') ans = log(f); else if(o == 'q') ans = sqrt(f); else if(o == 'e') ans = exp(f); else if(o == 'p') ans = pow(2,l); else if(o == 'P') ans = pow(3,l); else if(o == 'S') ans = abs(f); return ans; } void main () { unsigned char keypad; unsigned char Fnum[7], Lnum[7], Ans[15]; float fnum = 0, lnum = 0, ans = 0; unsigned char Oper = ' '; unsigned short countdigit = 0; unsigned short c, chkc = 1; write_init(0x33);
  • 10. write_init(0x32); write_init(0x28); write_init(0x0e); write_init(0x01); write_init(0x0c); while(1) { keypad = keyp(); if(countdigit <= 5 && keypad >= '0' && keypad <= '9') { if(Oper == ' ') Fnum[countdigit] = keypad; else Lnum[countdigit] = keypad; write_data(keypad); countdigit++; } else if(keypad == '+') { Oper = '+'; write_data('+'); countdigit = 0; } else if(keypad == '-') { Oper = '-'; write_data('-'); countdigit = 0; } else if(keypad == '*') {
  • 11. Oper = '*'; write_data('*'); countdigit = 0; } else if(keypad == '/') { Oper = '/'; write_data('/'); countdigit = 0; } else if(keypad == 'c') { chkc = 1; while(chkc) { keypad = keyp(); if(keypad == '0') { write_init(0x01); write_init(0x80); countdigit = 0; Oper = ' '; for(c = 0;c <= 14;c++) { if(c<=7) { Fnum[c] = ' '; Lnum[c] = ' '; }
  • 12. Ans[c] = ' '; } chkc = 0; } else if(keypad == '1') { Oper = 's'; write_string("sin "); chkc = 0; } else if(keypad == '2') { Oper = 'c'; write_string("cos "); chkc = 0; } else if(keypad == '3') { Oper = 't'; write_string("tan "); chkc = 0; } else if(keypad == '4') { Oper = 'l'; write_string("log "); chkc = 0; } else if(keypad == '5')
  • 13. { Oper = 'q'; write_string("sqrt "); chkc = 0; } else if(keypad == '6') { Oper = 'e'; write_string("epxp "); chkc = 0; } else if(keypad == '7') { Oper = 'p'; write_string("power 2 "); chkc = 0; } else if(keypad == '8') { Oper = 'P'; write_string("power 3 "); chkc = 0; } else if(keypad == '9') { Oper = 'S'; write_string("absolute "); chkc = 0; while(keypad !=' ')
  • 14. { keypad = keyp(); } } } else if(keypad == '=' && Oper != ' ') { fnum = atof(Fnum); lnum = atof(Lnum); ans = cal(fnum,lnum,Oper); sprintf(Ans,"%0.3f",ans); write_init(0xC0); write_data('='); write_string(Ans); } while(keypad !=' ') { keypad = keyp(); } } }