Table des matières:

Calculatrice simple et standard avec CloudX : 5 étapes
Calculatrice simple et standard avec CloudX : 5 étapes

Vidéo: Calculatrice simple et standard avec CloudX : 5 étapes

Vidéo: Calculatrice simple et standard avec CloudX : 5 étapes
Vidéo: Casque micro HyperX CloudX™ Pro Gaming 2024, Juillet
Anonim
Calculatrice simple et standard avec CloudX
Calculatrice simple et standard avec CloudX

Dans ce didacticiel, nous apprendrons comment créer une calculatrice simple et standard avec CloudX, veuillez cliquer sur Si vous n'avez rien lu sur le clavier d'interfaçage avec CloudX auparavant, ici, notre objectif est de vous apprendre comment développer votre propre calculatrice matérielle utilisant cloudX M633.

Notre objectif est de pouvoir concevoir une calculatrice capable de faire des additions (+), des soustractions (-), des multiplications (*) et des divisions (/) avec des résultats en nombres décimaux aussi bas que 0,0000001 et en nombres entiers jusqu'à 90000000. La calculatrice a la capacité de détecter les erreurs mathématiques, etc. Chaque enfant, étudiant et amateur devrait être capable de réaliser ce projet fantastique.

Étape 1: EXIGENCES MATÉRIELLES

EXIGENCES MATÉRIELLES
EXIGENCES MATÉRIELLES
EXIGENCES MATÉRIELLES
EXIGENCES MATÉRIELLES

1x microcontrôleur CloudX

1x carte logicielle CloudX

1x câble USB

1x clavier matriciel 4x4

1x 16x2 fils de cavalier LCD

1x résistance 1kΩ

4x 10kΩ Résistances

Étape 2: CONNEXION PIN

BROCHE DE CONNEXION
BROCHE DE CONNEXION
BROCHE DE CONNEXION
BROCHE DE CONNEXION
BROCHE DE CONNEXION
BROCHE DE CONNEXION

Broches de connexion CloudX avec LCD et broches de connexion CloudX avec clavier

Étape 3: SCHÉMA DE CIRCUIT

SCHÉMA
SCHÉMA

Étape 4: LOGICIEL

/* * Fichier: Smart KeyPad Lock System.c

* Auteur: sweat à capuche

*

* Créé le 20 mars 2018, 11:21

*/

#comprendre

#comprendre

#comprendre

#comprendre

#define NumberOfRows 4 // définit l'affichage sur quatre lignes

#define NumberOfColumns 4 // définit l'affichage sur trois colonnes

char KeypadCharacters[NumberOfRows][NumberOfColumns] = {

'1', '2', '3', '+', '4', '5', '6', '-', '7', '8', '9', '*', 'C', '0', '=', '/'

};

char RowPins[NumberOfRows] = {7, 8, 9, 10};

char ColumnsPins[NumberOfColumns] = {11, 12, 13, 14};

char Keys, a=0, check =0, operation=0, signa=0, signb=0;

réponse flottante signée;

car * Préponse;

car Aréponse[10];

entrée longue signée;

char Ainputa[10];

entrée longue signéeb;

char Ainputb[10];

mettre en place(){

KeypadSetting (PULLDOWNCOL, RowPins, ColumnsPins, NumberOfRows, NumberOfColumns, KeypadCharacters);

lcdSetting (1, 2, 3, 4, 5, 6);

lcdCmd(lcd_clear);

lcdCmd(cursor_off);

lcdWriteText(1, 1, " CALCULATRICE AVEC");

lcdWriteText(2, 1, " NUAGE ");

retardMs(2000);

lcdCmd(lcd_clear);

lcdCmd(cursor_blink);

boucle(){

Clés=getKey();

if(Clés!=0 && Clés=='C'){

lcdCmd(lcd_clear);

lcdCmd(cursor_blink);

pour(a=0; a<10; a++){

Ainputa[a]=0;

Entréeb[a]=0;

Une réponse[a]=0;

}

a=0;

opération=0;

vérifier = 0;

signe =0;

signeb =0;

}

if(check == 1 && Clés!=0 && Clés=='='){

lcdCmd(cursor_off);

inputa = atoi(Ainputa);

inputb = atoi(Ainputb);

if(signa=='-'){

entréea = -(entrée);

}

if(signb=='-'){

entréeb = -(entréeb);

}

if(opération == '+'){

réponse = entréea + entréeb;

longTostr(Aréponse, réponse, DEC);

}

if(opération == '-'){

réponse = entréea - entréeb;

longTostr(Aréponse, réponse, DEC);

}

if(opération == '*'){

réponse = entréea * entréeb;

longTostr(Aréponse, réponse, DEC);

}

if(opération == '/'){

réponse = (float)inputa / (float)inputb;

Préponse = floatTostr(réponse);

if(entrée > entréeb){

Préponse[5]=0;

}

}

if(opération == '/'){

lcdWriteText(2, 1, "ANS: ");

lcdWriteTextCP(Préponse);

}

autre {

lcdWriteText(2, 1, "ANS: ");

lcdWriteTextCP(Aanswer);

}

}

if(Keys!=0 && (Keys=='+' || Keys=='-' || Keys=='*' || Keys=='/')){

if(opération != 0 && a==0 && signb ==0 && (Clés=='-'||Clés=='+')){

lcdWriteCP(Clés);

if(Clés=='-' || Clés=='+'){

signb = Clés;

}

}

if(opération == 0 && a == 0 && signa ==0 && (Keys=='-'||Keys=='+')){

lcdWriteCP(Clés);

if(Clés=='-' || Clés=='+'){

signa = Clés;

}

}

if(opération == 0 && a != 0){

lcdWriteCP(Clés);

opération = Touches;

a=0;

}

}

if (Keys!=0 && (Keys=='0'||Keys=='1'||Keys=='2'||Keys=='3'||Keys=='4'||Keys= ='5'||Clés=='6'||Clés=='7'||Clés=='8'||Clés=='9')){

if(opération != 0){

lcdWriteCP(Clés);

Ainputb[a] = Clés;

a++;

vérifier=1;

}

if(opération == 0){

lcdWriteCP(Clés);

Ainputa[a] = Clés;

a++;

}

}

}

}

Conseillé: