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

SLEEP ???

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



Joined: 11 Mar 2004
Posts: 7

View user's profile Send private message

SLEEP ???
PostPosted: Mon Mar 15, 2004 9:13 am     Reply with quote

Hi all,

I have a question for you all.

I am trying desperately to get the SLEEP to work but I think I'm doing something wrong because it doesnt seem to work.
I'm trying to make my PIC do RTC using Timer1 and having the Timer1 have the PIC woken up. My code is as follows:

#int_timer1
void interrupt() {
adds seconds
}

void main() {
set up the interrupts

while(TRUE) {

make minutes/hours out of the counted seconds.

SLEEP
}
}

When I comment the SLEEP line, the programs works fine, it counts the seconds no problem. I can see this by having a LED change each second (which I do in the interrupt function).
I event tried having the SLEEP done once by "ifing" it. And once its down for SLEEP, it doesnt wake up from the timer1.

My PIC is the 16f87 which has timer1 wakeup built in.

Anyone ?

Thx
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Mar 15, 2004 12:34 pm     Reply with quote

Timer1 must be running in asynchronous counter mode
to allow it to wake up the PIC from Sleep.

In other words, it needs an external oscillator or
crystal to be connected to pins T1OSI and T1OSO on the PIC.

See the data sheet, and also see the Timer1 reference manual:
http://www.microchip.com/1010/suppdoc/refernce/midrange/index.htm
pyroboy123



Joined: 11 Mar 2004
Posts: 7

View user's profile Send private message

PostPosted: Mon Mar 15, 2004 1:57 pm     Reply with quote

Ok Thx I'll look into that...

but its a pain beause I thought I would try to keep the RB6/7 free for programming ....
Sandman



Joined: 26 Jan 2004
Posts: 15
Location: Kiruna, Sweden

View user's profile Send private message

PostPosted: Mon Mar 22, 2004 3:58 am     Reply with quote

I have the same problem. Timer 1 will not work if I'm seting it to use an external oscillator(crystal). I have no solution to the problem, and no one has been able to help me. Sad
If you find out how to set timer 1 to work with an external oscillator and use it to wake the PIC from sleep, I would be very pleased if you could let me know how you did it.
Good luck!
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