Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Processor has been reset by watchdog timer expiring PIC16F887

Tv.1902

Newbie
Newbie level 3
Joined
Apr 26, 2024
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
17
Recently I try to code display LCD on mikroC. However when I run proteus simulation and it said like the thread above.
Can you show me what problem I am encountering.
Thanks in advance and here is the 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
// LCD module connections
sbit LCD_RS at RB0_bit;
sbit LCD_EN at RB1_bit;
sbit LCD_D4 at RB2_bit;
sbit LCD_D5 at RB3_bit;
sbit LCD_D6 at RB4_bit;
sbit LCD_D7 at RB5_bit;
 
sbit LCD_RS_Direction at TRISB0_bit;
sbit LCD_EN_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB2_bit;
sbit LCD_D5_Direction at TRISB3_bit;
sbit LCD_D6_Direction at TRISB4_bit;
sbit LCD_D7_Direction at TRISB5_bit;
// End LCD module connections
 
void main(){
  TRISB = 0x00;                   
  PORTB = 0x00;
 
  Lcd_Init();                            
  Lcd_Cmd(_LCD_CLEAR);                   
  Lcd_Cmd(_LCD_CURSOR_OFF);             
 
  while(1) {                            
       Lcd_Out(1,1,"Hello World");  
  }
}



[ADDED 'C' CODE TAGS]
 
Last edited by a moderator:
This happens if you enable WDT in the processor configuration but don't service it in your code.
Thanks i found the reason why however it doesn't show anything. What should I do
1714114724596.png
 
Last edited:
Hi,

I agree with FvM.

***
You expected a problem with the software.
But you posted only a part of your software.
We don´t know how all the LCD functions look like, nor whether (and which) LCD library you use.

So if there was a problem in these functions .. we could not find them.
Next time please post your complete software... so we can better help you.

****
Btw: an infinite loop without delay to write to the display may probably result in display artefacts. But I understand here it is for testing purpose only.
From my experience: updating a display more than 3 times per second usually results in bad redability.

Klaus
--- Updated ---

Added:
What should I do
Did you read the PIC datasheet section how to use the watchdog?

I´m not familiar with PIC, but as FvM states you usually have to clear the watchdog counter regurarily in your software.
I miss this.

****

From my experience:
In my programs I often use continously running - important - interrupts.
In this case I don´t only rely that the main loop is running properly, but the interrupt(s) as well.
Thus I set a global flag in the ISR. I check this flag in main loop and {clear the wtachdog counter and clear the flag) in main loop.

This way ... I can be sure that the main loop is running properly as well as the interrupt(s) is running properly.

Klaus
 
Last edited:
Hi,

I agree with FvM.

***
You expected a problem with the software.
But you posted only a part of your software.
We don´t know how all the LCD functions look like, nor whether (and which) LCD library you use.

So if there was a problem in these functions .. we could not find them.
Next time please post your complete software... so we can better help you.

****
Btw: an infinite loop without delay to write to the display may probably result in display artefacts. But I understand here it is for testing purpose only.
From my experience: updating a display more than 3 times per second usually results in bad redability.

Klaus
--- Updated ---

Added:

Did you read the PIC datasheet section how to use the watchdog?

I´m not familiar with PIC, but as FvM states you usually have to clear the watchdog counter regurarily in your software.
I miss this.

****

From my experience:
In my programs I often use continously running - important - interrupts.
In this case I don´t only rely that the main loop is running properly, but the interrupt(s) as well.
Thus I set a global flag in the ISR. I check this flag in main loop and {clear the wtachdog counter and clear the flag) in main loop.

This way ... I can be sure that the main loop is running properly as well as the interrupt(s) is running properly.

Klaus
Sorry I don't really understand you, however about the watchdog timer it was my mistake instead of f887 I chose f877 that's why I encountered that problem. After I changed the MCU name it's not the problem anymore. I follow this tutorial however the LCD doesn't show anything. Here is the link of the tutorial https://microcontrollerslab.com/lcd-interfacing-pic16f877a-microcontroller/
And this is their code. I'm really appreciate your supports
1714118196911.png
 
Watchdog is enabled in processor configuration bits in mikroC.
You didn't show any related code yet.
--- Updated ---

In 16F877 it's configuration bit WDTE
 
Last edited:
mikroC manual says
You can change basic project settings in the Project Settings window. You canchange chip, and oscillator frequency. Any change in the Project Setting Windowaffects currently active project only, so in case more than one project is open, youhave to ensure that exactly the desired project is set as active one in the ProjectManager. Also, you can change configuration bits of the selected chip in the EditProject window.
 

LaTeX Commands Quick-Menu:

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top