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.

Unable to make pic sleep for 1 minute

Status
Not open for further replies.

EgrK

Junior Member level 2
Joined
Jul 31, 2012
Messages
24
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
East part of world
Activity points
1,438
Hellow again
i need to make the pic sleep for exactly one minute
the follwing is my unprecise code.
i have tried alot to get 1 minute sleep but could not
need help
thanks in advance

Code:
list p=16f883
#include <p16f883.inc>
i	equ 20
j	equ 21
Minutes 	equ 22
Seconds  	equ 23
.
.
.
movlw	b'10001000'
movwf	OPTION_REG

movlw .1	;one minute
movwf i		;i=1
call DelayiM
.
.
.
DelayiM	sleep
	sleep			
loop_Minute	sleep
			movlw .60
			movwf Seconds
loop_Sec			sleep
					sleep
					movlw .60
					movwf j	
loop_Option					sleep
						clrwdt
						decfsz	j,1
						goto loop_Option
	decfsz	Seconds,1
	goto loop_Sec
decfsz i,1
goto loop_Minute
return
END
 
Last edited:

Do you actually mean sleep (PIC power saving mode) or just a delay? For a precise delay, you'll use a timer. The available accuracy depends on your clock option, either internal oscillator (1 - 2 %) or crystal (e.g. 100 ppm). Power saving sleep mode can be only timed by watchdog timer which is less accurate.
 

I mean delay not power saving mode, if you look at the code you will see the OPTION_REG=b'10001000,i have used internal oscillator in configuration bits and the watch dog is set enabled (bit3=1 in OPTION_REG),if you beleive the timer is better,i still have to use watch dog because i am using it in many lines in code and several programs too ,if this will cause some minor error i have to accept it
it will be a great help if you include both solution one using watch dog and one using timer(i need to know the configuration bits too for timer)
would you please refer me to good example ,i am very novice to pic device,and it would be hard to understand any summary concerning the question
thanks
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top