s'il vous plait j'ai trouvé un problème au cours de simulation de mon programme en MikroPascal à logiciel Proteus 8 au niveau de l'affichage de 'sensibilité lum'
et 'limière courante' et aussi ' delai ecran'. Aidez-moi si possible et merci d'avance. Voici mon programme :
Code:Program TempLDRIR; { Declarations section } Type TAnalog = Record Analog : Byte; Sensivity : Byte; Value : Word; End; TDelay = Record Delay_Sec : Byte; CycleWord : Word; CycleMax : Word; End; Var LCD_RS : sbit at RB7_bit; LCD_EN : sbit at RB6_bit; LCD_D4 : sbit at RB5_bit; LCD_D5 : sbit at RB4_bit; LCD_D6 : sbit at RB3_bit; LCD_D7 : sbit at RB2_bit; LCD_RS_Direction : sbit at TRISB7_bit; LCD_EN_Direction : sbit at TRISB6_bit; LCD_D4_Direction : sbit at TRISB5_bit; LCD_D5_Direction : sbit at TRISB4_bit; LCD_D6_Direction : sbit at TRISB3_bit; LCD_D7_Direction : sbit at TRISB2_bit; KeypadPort : byte at PORTC; Relay : sbit at RB1_bit; IR_b : sbit at RB0_bit; LM35_b : sbit at RA0_bit; LDR_b : sbit at RA1_bit; Temp, LDR : TAnalog; Byte_Text : Array[3] of char; KeyPad : Byte; KeyPad_Pressed : Boolean; TMR1I : Byte; TMR1X : Byte; Delay_LCD, Delay_Relay : TDelay; IR_Active : Boolean; I : Byte; Procedure LDR_Sensivity; Var Sens, I : Byte; Begin Lcd_Cmd(_LCD_CLEAR); LCD_Out(1,1,'Sensibilite Lum'); LCD_Out(2,1,'Lumiere courante'); Sens := LDR.Sensivity ; While True Do Begin ByteToStr(Sens,Byte_Text); LCD_Out(1,17,Byte_Text); I:=LDR.Value; ByteToStr(I,Byte_Text); LCD_Out(2,17,Byte_Text); End; LDR.Sensivity:=Sens; Lcd_Cmd(_LCD_CLEAR); Delay_LCD.CycleWord := Delay_LCD.CycleMax; KeyPad_Pressed := True; End; Procedure LCD_Delay; Var W : DWord; Sens : Word; Begin Lcd_Cmd(_LCD_CLEAR); LCD_Out(1,5,'Delai Ecran'); Sens:=Delay_LCD.Delay_Sec; While True Do Begin WordToStr(Sens,Byte_Text); LCD_Out(2,8,Byte_Text); End; Delay_LCD.Delay_Sec := Sens; W := (Sens*1000) Div 65; Delay_LCD.CycleMax:=W; Delay_LCD.CycleWord := Delay_LCD.CycleMax; Lcd_Cmd(_LCD_CLEAR); Delay_LCD.CycleWord := Delay_LCD.CycleMax; KeyPad_Pressed := True; End; Procedure Relay_Delay; Var W : DWord; Sens : Byte; Begin Lcd_Cmd(_LCD_CLEAR); LCD_Out(1,5,'Delai Lumiere'); Sens:=Delay_Relay.Delay_Sec; While True Do Begin ByteToStr(Sens,Byte_Text); LCD_Out(2,8,Byte_Text); End; Delay_Relay.Delay_Sec := Sens; W := (Sens*1000) Div 65; Delay_Relay.CycleMax := W; Lcd_Cmd(_LCD_CLEAR); Delay_LCD.CycleWord := Delay_LCD.CycleMax; KeyPad_Pressed := True; End; Procedure IR_Activation; Begin Lcd_Cmd(_LCD_CLEAR); LCD_Out(1,1,'Barriere infrarouge'); While True Do Begin IF IR_Active Then LCD_Out(2,4,' Activee') Else LCD_Out(2,5,'Desactivee'); End; Lcd_Cmd(_LCD_CLEAR); KeyPad_Pressed := True; End; Procedure Test_IR; Begin Lcd_Cmd(_LCD_CLEAR); LCD_Out(1,1,'Barriere Infrarouge'); INTE_bit:=0; While True Do Begin IF IR_b=1 Then LCD_Out(2,4,'Discontinue') Else LCD_Out(2,4,' Continue'); Delay_ms(300); End; Lcd_Cmd(_LCD_CLEAR); KeyPad_Pressed := True; INTF_bit:=0; INTE_bit:=1; End; Begin //INTCON GIE_bit := 0; PEIE_bit := 0; T0IE_bit := 0; TMR0IE_bit := 0; INTE_bit := 1; RBIE_bit := 0; T0IF_bit := 0; TMR0IF_bit := 0; INTF_bit := 0; RBIF_bit := 0; TMR1CS_bit := 0; TMR1IE_bit := 1; TMR1IF_bit := 0; TMR1ON_bit := 1; //I/O TRISA := 255; TRISB := 1; TRISC := 255; CHS0_bit := 0; CHS1_bit := 0; CHS2_bit := 0; ADON_bit := 1; ADFM_bit := 0; PCFG0_bit := 0; PCFG1_bit := 0; PCFG2_bit := 0; PCFG3_bit := 0; ADIF_bit := 0; ADIE_bit := 1; TMR1I := 1; TMR1X := 0; Delay_LCD.CycleWord := Delay_LCD.CycleMax; KeyPad_Pressed := True; Relay := 0; PEIE_bit := 1; GIE_bit := 1; Lcd_Init(); Lcd_Cmd(_LCD_CURSOR_OFF); Lcd_Cmd(_LCD_CLEAR); Keypad_Init(); LCD_Out(1,1,'RAMIT BENMESBAH 2012'); LCD_Out(2,1,'Eclairage Automatise'); Delay_ms(3000);Lcd_Cmd(_LCD_CLEAR); While True Do Begin IF KeyPad_Pressed Then Begin I := Temp.Value;ByteToStr(I,Byte_Text);LCD_Out(1,1,'Temperature : '+Byte_Text+'C');LCD_chr(1,19,223); IF Relay Then LCD_Out(2,4,'Lampe : Allumee') Else LCD_Out(2,4,'Lampe : Eteinte'); End Else Lcd_Cmd(_LCD_TURN_OFF); KeyPad := Keypad_Key_Press; IF KeyPad>0 Then Begin Lcd_Cmd(_LCD_TURN_ON); Delay_LCD.CycleWord := Delay_LCD.CycleMax; IF KeyPad_Pressed Then Case KeyPad Of 16 : LDR_Sensivity; 15 : LCD_Delay; 14 : Relay_Delay; 12 : IR_Activation; 11 : Test_IR; End Else KeyPad_Pressed := True; Delay_ms(300); End; End; End.
-----