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.

[SOLVED] Power management (watchdog) on 18F

Status
Not open for further replies.

bauche

Junior Member level 1
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

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top