kareem_nabil
Newbie
Good Day.
i'm designing a machine that runs Air Pump , Solenoid ,and some relays .this machine must work continuously without any shutdown for at least 10 complete days. what key points should i consider during design and fabricating and of course the code .
2- I've tested the machine for about 20 hours. it works fine .but after that .the micro controller seems hanged up. pump stopped but the solenoid kept working and the LCD displayed black squares. after making a reset it worked fine again . i think this could be solved with watch dog. but i've never used it. i've enabled it's register from project option. but when i simulated it on Proteus . the micro controller keeps resetting .
i'm using mikroC pro for PIC v7.2.0. please tell me how to enable and use the watch dog.
also what's the regulations and recommendations for design long time running machine.
here's a part of my code:
i'm designing a machine that runs Air Pump , Solenoid ,and some relays .this machine must work continuously without any shutdown for at least 10 complete days. what key points should i consider during design and fabricating and of course the code .
2- I've tested the machine for about 20 hours. it works fine .but after that .the micro controller seems hanged up. pump stopped but the solenoid kept working and the LCD displayed black squares. after making a reset it worked fine again . i think this could be solved with watch dog. but i've never used it. i've enabled it's register from project option. but when i simulated it on Proteus . the micro controller keeps resetting .
i'm using mikroC pro for PIC v7.2.0. please tell me how to enable and use the watch dog.
also what's the regulations and recommendations for design long time running machine.
here's a part of my code:
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 void main() { TRISA.RA4=1 ; PORTC=0; //reseting ports PORTB=0; PORTD=0; PORTA=0; TRISB = 0x00 ; //all portb is output TRISD = 0x3f ; //All PortD is input excpet pin 6,7 TRISC = 0xff ; //all portc is input Lcd_Init(); // Initialize LCD Lcd_Cmd(_LCD_CLEAR); // Clear display Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off buzzer = 1 ; //buzzer on for 300ms delay_ms(300); buzzer = 0 ; Lcd_Out(1,1,codetxt_to_ramtxt(intro1)); Lcd_Out(2,1,codetxt_to_ramtxt(intro2)); Lcd_Out(3,1,codetxt_to_ramtxt(intro3)); Delay_ms(1500); Lcd_Cmd(_LCD_CLEAR); flow_rate =600.00; while(1) { if (RR10 == 1) { cycle = 6.0; RR = 10; } else if (RR15 == 1) { cycle = 4.0; RR = 15; } else if (RR20 == 1) { cycle = 3.0; RR = 20; } else if (RR25 == 1) { cycle = 2.4; RR = 25; } else if (RR30 == 1) { cycle = 2.0 ; RR = 30; } else{cycle = 0.0 ; RR=0 ; }