Escolar Documentos
Profissional Documentos
Cultura Documentos
Manaus
2017
Rachel Batalha de Lima
Manaus
2017
Introduo
Funcionamento
Cdigo da Aplicao
O cdigo foi desenvolvido com a utilizao da IDE MikroC pro 2009 e o gravador
Atmel FLIP 3.3.4. Segue abaixo a codificao:
//LCD
sbit LCD_RS at P3_6_bit;
sbit LCD_EN at P3_7_bit;
//Teclas:
#define bot1 P1_0_bit
#define bot2 P1_1_bit
#define bot3 P1_2_bit
#define bot4 P1_3_bit
#define DELAY_7SEG 10
//Display 7 segmentos
#define edisp1 P3_2_bit
#define edisp2 P3_3_bit
int acertou;
void fun_int_ex0();
void systemOn();
void systemOff();
void showOn();
void nameSystem();
void insertPasswordLcd();
void insertPassword();
void passwordCorrect();
void passwordIncorrect();
void main() {
nameSystem();
while(systemStart==0);
showOn();
insertPasswordLcd();
insertPassword();
}
//int aux=0;
edisp1=1;
edisp2=0;
P0 = validation[1];
Delay_ms(DELAY_7SEG);
//aux+=1;
//}
}
edisp1=1;
edisp2=1;
}
void fun_int_ex0 (void) org IVT_ADDR_EX0 { //cria a funo e associa o end. vetor
systemStart = 1;
}
void insertPassword(){
int checkButtont1 = 1;
int checkButtont2 = 1;
int checkButtont3 = 1;
int checkButtont4 = 1;
int sequenciaCorreta[4] = {1,2,3,4};
int aux[4] = {0,0,0,0};
int countPressButtons = 0;
int acertos = 0;
int i = 0;
while (1){
while( (checkButtont1 = bot1 == 1) && (checkButtont2 = bot2 == 1) &&
(checkButtont3 = bot3 == 1) && (checkButtont4 = bot4 == 1));
Delay_ms(500);
if(checkButtont1 == 0){
aux[countPressButtons] = 1; }
else if (checkButtont2 == 0){
aux[countPressButtons] = 2;
}
else if (checkButtont3 == 0){
aux[countPressButtons] = 3;
}
else if (checkButtont4 == 0){
aux[countPressButtons] = 4;
}
countPressButtons++;
if (countPressButtons == 4){
passwordCorrect();
P1_4_bit = 0;
Delay_ms(500);
P1_4_bit = 1;
void nameSystem(){
Lcd_Init(); // Initialize Lcd
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
Lcd_Out(1,1,txt1);
Delay_ms(2000);
void insertPasswordLcd(){
Lcd_Init(); // Initialize Lcd
void passwordCorrect(){
Lcd_Init(); // Initialize Lcd
void passwordIncorrect(){
Lcd_Init(); // Initialize Lcd