[SOLVED] Power management (watchdog) on 18F

Status
Not open for further replies.

bauche

Junior Member level 1
Joined
Oct 13, 2010
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,367
Hi there i found this little example on how to use power management on 16F...i want to use it on 18F2580
with Micro C i cant compile on 18F i think it's option_reg the prob

Can somebody translate the code for use the wdt in 18F?? i want to knows wdt on 18F for future code

Thanks for help!!!

Code:
/* Project name: Understanding sleep mode in PIC microcontrollers 
* Copyright: (c) Rajendra Bhatt 
* Test configuration: MCU: PIC16F628A Oscillator: XT, 4.0000 MHz */   

sbit LED at RB0_bit; // LED is connected to PORTB.0
   
void main()
{ 
TRISB = 0b00000000; 
TRISA = 0b00100000; 
LED = 0; 
OPTION_REG = 0b00001111; // Assign 1:128 prescaler to WDT 
do 
{ 
asm sleep; // Sleep mode, WDT is cleared,
 // and time out occurs at Approx. 2.3 Sec
 // Current is minimum in Sleep mode 
LED = 1; // After wake-up the LED is turned on Delay_ms(500); 
LED = 0; asm CLRWDT; // Clear WDT Delay_ms(2000); // Measure current here and compare with Sleep mode 
}while(1); // current 
}
 

Hi,

The OPTION REG is not a 18F register - see the 18F2580 Datasheet, Watchdog section, for details of the correct registers /bits
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…