CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

BrownOut use or automatically reset of PIC Microcontroller?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
engrmunir786



Joined: 25 Jul 2012
Posts: 20

View user's profile Send private message

BrownOut use or automatically reset of PIC Microcontroller?
PostPosted: Fri Aug 03, 2012 2:01 am     Reply with quote

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.
Ttelmah



Joined: 11 Mar 2010
Posts: 19537

View user's profile Send private message

PostPosted: Fri Aug 03, 2012 3:37 am     Reply with quote

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
engrmunir786



Joined: 25 Jul 2012
Posts: 20

View user's profile Send private message

PostPosted: Sun Aug 05, 2012 9:43 pm     Reply with quote

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.
Ttelmah



Joined: 11 Mar 2010
Posts: 19537

View user's profile Send private message

PostPosted: Mon Aug 06, 2012 1:23 am     Reply with quote

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
engrmunir786



Joined: 25 Jul 2012
Posts: 20

View user's profile Send private message

PostPosted: Mon Aug 06, 2012 1:57 am     Reply with quote

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?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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