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 support@ccsinfo.com

WDT + User Interface on LCD display

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



Joined: 03 Nov 2005
Posts: 7

View user's profile Send private message

WDT + User Interface on LCD display
PostPosted: Wed Mar 22, 2006 9:42 am     Reply with quote

Hi,

I already posted these questions on the forum yesterday but impossible to find it again... Strange.

Anyway i've got two questions. One concerning the WDT and the other one User interface.

The WDT problem is concerning the Fuse. I can't regulate when the reset will happen. I tried to change the fuses but it resets exactly after the same amount of time.

here is my example:

Code:

#include <18F4580.h>

//#use delay(clock=20000000,restart_wdt)
#use delay(clock=20000000)

//#FUSES NOWDT
#FUSES WDT32768
//#FUSES WDT16
#FUSES RC                       //Resistor/Capacitor Osc with CLKOUT
#FUSES NOPUT                    //No Power Up Timer
#FUSES NOPROTECT                //Code not protected from reading
#FUSES BROWNOUT                 //Reset when brownout detected
#FUSES LVP                      //Low Voltage Programming on B3(PIC16) or B5(PIC18)
#FUSES NOCPD                    //No EE protection
#FUSES NOWRT                    //Program memory not write protected
#FUSES NODEBUG                  //No Debug mode for ICD


#include "Display.c"
#include "KeypadBis.c"

void main()
{

   long count_outside;
   char key;

   lcd_init();
   kbd_init();

   count_outside=0;

   switch ( restart_cause() )
   {

      case WDT_FROM_SLEEP:lcd_gotoxy(1,1);lcd_putc("sleep");break;

      case WDT_TIMEOUT:lcd_gotoxy(1,1);lcd_putc("timeout");break;

      case MCLR_FROM_SLEEP:lcd_gotoxy(1,1);lcd_putc("MCLR sleep");break;

      case NORMAL_POWER_UP:lcd_gotoxy(1,1);lcd_putc("Normal power up");break;

   }

   setup_wdt(WDT_ON);

   lcd_gotoxy(1,2);
   printf(lcd_putc,"Hit any key.");
   lcd_gotoxy(1,3);
   
   while(TRUE)
   {

      key=kbd_getc();
      if (key!='\0')
      {
         restart_wdt();
         printf(lcd_putc,"%c",key);
         
      }

   }
}


1) Does someone see any error or have an explaination?

2)When is the best time to reset the WDT? at the end of the While(TRUE) loop?

3)My third question concerned one user interface for LCD display. My program will manage I2C and SCI communication will one user can tape on the keypad (interrupt on the keypad). The management of the display is then a bit tricky. Did someone have some experience with this?

Thank you!
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