Code
Code
char segmentValue[] = {
0x3F, 0x06, 0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
void LED_Blink();
void LED_GreenBlink();
void ADC_ReadDisplay();
void display(char digit, char value);
void DispA();
void DispB();
char countA = 0;
char countB = 0;
} else if (PORTB.F6 == 0) {
}
if (PORTB.F7 == 1 ) {
countB++;
if (countB > 20) {
countB = 0;
}
DispB();
delay_ms(500);
} else if (PORTB.F7 == 0) {
INTCON.RBIF = 0;
}
}
void main() {
INTCON.GIE = 1;
INTCON.RBIE = 1;
INTCON.INTE = 1;
INTCON.INTF = 0;
INTCON.RBIF = 0;
TRISB.F0 = 1;
TRISB.F4 = 1;
TRISB.F5 = 1;
TRISB.F6 = 1;
TRISB.F3 = 0;
TRISB.F7 = 1;
TRISB.F1 = 1;
TRISB2_bit = 1;
TRISE.F0 = 1;
TRISA.F5 = 1; TRISA.F0 = 0; TRISA.F1 = 0; TRISA.F2 = 1; TRISA.F3 = 0; TRISA.F4
= 0;
TRISD = 0x00;
TRISC = 0x00;
RA3_bit = 0;
RA4_bit = 0;
RA0_bit = 0;
RA1_bit = 0;
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_Out(1, 1, "Gestion ");
Lcd_Out(2, 1, "Qualite_Emballag");
RB3_bit = 0;
RE1_bit = 0;
while (1) {
EEPROM_Write(0x32,nbrPannes);
if(declanche == 1) {
declanche = 0;
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(2, 5, "EN PANNE");
delay_ms(2000);
RB3_bit = 0;}
if(RB1_bit == 1){
IntToStr(EEPROM_Read(0x32),panne);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 1, "nbr pannes : ");
Lcd_Out(4, 1,panne);
delay_ms(3000);
Lcd_Cmd(_LCD_CLEAR);
}
} else {
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 1, "Gestion ");
Lcd_Out(2, 1, "Qualite_Emballag");
delay_ms(500);
RA0_bit = 0;
RA1_bit = 0;
RA3_bit = 0;
void LED_Blink() {
int i;
for (i = 0; i < 4; i++) {
PORTA.F0 = 1;
Delay_ms(500);
PORTA.F0 = 0;
Delay_ms(500);
}
}
void LED_GreenBlink() {
int i;
for (i = 0; i < 4; i++) {
PORTA.F1 = 1;
Delay_ms(500);
PORTA.F1 = 0;
Delay_ms(500);
}
}
void ADC_ReadDisplay() {
int read_poid;
read_poid = ADC_Read(5);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 4, "START ");
Lcd_Out(2, 1, "Qualite_P : ");
void DispA() {
char digitA1 = countA / 10;
char digitA2 = countA % 10;
display(1, digitA1);
Delay_ms(300);
display(2, digitA2);
Delay_ms(500);
}
void DispB() {
display(1, digitB1);
Delay_ms(300);
display(2, digitB2);
Delay_ms(500);
}