![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
engrmunir786
Joined: 25 Jul 2012 Posts: 20
|
BrownOut use or automatically reset of PIC Microcontroller? |
Posted: Fri Aug 03, 2012 2:01 am |
|
|
Dear Experts
I want to know how I can use BrownOut function in Pic Microcontroller.
#fuses HS, NOWDT,NOPROTECT,BROWNOUT,PUT
Only enabling in Fuse is enough or is there any special?
Actually I have a problem that I wrote a LCD program with different analog inputs and display messages and my program is working 100% fine without any error. But sometimes after 4 to 6 days and sometimes after 6 to 8 hours Lcd show garbage values and hang there until a person come and press reset button. I want that it automatically resets and come to initial of program when any power fluctuation occurs or any other interruption come from power supply or hardware etc.
Is there a way to control this thing? I want that my LCD never hang up at any point. I am using CCS for programming PIC. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19369
|
|
Posted: Fri Aug 03, 2012 3:37 am |
|
|
Question.
How long is the cable to the LCD, what type of cable, what else is in the box?.
Some of the newer LCD's are _very_ prone to problems from pickup on the cable. If you read the data sheets, many of the newer chips have very low output drive capabilities, and different logic threshold's from the older chips.
Now, 'brownout', obviously only affects the PIC. It is perfectly possible that the voltage at the PIC is fine, but the display is receiving a spike.
Second question.
What PIC?.
On many chips you can change the voltage that brownout works at. We need to know the chip though.
Then.
How are you talking to the display?. Are you using the R/W line?.
If you are using the R/W line, then consider three things:
1) Enable the watchdog, and add 'restart_wdt' to the code _after_ sending data to the LCD. Then if the LCD does not send back a correct acknowledgment at some point, the watchdog will reset the PIC, even if the PIC does not see a low voltage.
2) Can you modify your code to re-initialise your LCD at intervals?. If the PIC is still running, and the display doesn't actually hang, but loses it's initialisation, this will solve the problem.
3) Enable the brownout. Details of options here though, depend on your PIC.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
engrmunir786
Joined: 25 Jul 2012 Posts: 20
|
|
Posted: Sun Aug 05, 2012 9:43 pm |
|
|
Dear Ttelmah
The cable length is one feet. Normal data cable like Hard Drive Data Cable.
There is nothing in the box. 1-SMPS Power supply. 2-Lcd Control Circuit.
The PIC is PIC16F72.
I am not using the R/W Line. It is grounded. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19369
|
|
Posted: Mon Aug 06, 2012 1:23 am |
|
|
The 16F72, only has a fixed brownout at about 4v. So, all you can do is enable the fuse. No other options.
What LCD driver are you using (lcd.c, or flex_lcd?). Seriously, if your supply is even remotely reasonable, and you are using the standard drivers, there is no reason really why your display/PIC should get into a problem like this.
Consider adding the watchdog anyway. This will catch many type of fault, that will not trigger a brownout reset. If you were using the R/W line, the key would be that if the display didn't acknowledge, this would hang the driver, and trigger a watchdog. This won't happen without the R/W line, but there are other faults that this can still trap (particularly if you make sure you _only_ reset it if the code is flowing properly, it will catch if the code goes off somewhere it shouldn't...).
Still consider re-initialising the display. For instance, if you clear the screen at some points in your code, consider replacing the calls to do this, with a call to lcd_init. If the problem is with the LCD getting hung, rather than the PIC, this should make it recover.
Nothing else in the box. However if it is doing anything, there must be signal connections coming in/out?. Have you considered a spike may be coming in on one of these wires to the PIC?. How are they protected/suppressed?.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
engrmunir786
Joined: 25 Jul 2012 Posts: 20
|
|
Posted: Mon Aug 06, 2012 1:57 am |
|
|
Dear Ttelmah
Thanks for your detail reply. I am using flex_lcd. I don't have much idea about watchdog. Can you send me any example code in which watchdog is used. I am not using the R/W line. I am not clearing whole screen at any instance of program. Why I used lcd_init in my program without any reason. I only used lcd_init in start of program. Yes there is input and output signals are in box. From analog side of PIC I have used 0.1uf capacitor at each analog pin and also on VSS and VDD. Is there any special procedure to protect against noises? |
|
![](templates/subSilver/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|