Continue to Site

timer delay question please help!

Status
Not open for further replies.

EEs_Rule

New Member
Hello everyone,

First I would like to thank everyone for their input on all the other threads. As a newbee I have learned a lot from everyone and checked out most of the tutorials that I saw mentioned in the threads. I am still a little confused on the subject of timers and delays.

I am working on a project which requires two delays, a 20 sec delay, and a 40µsec delay. I am using the PIC12F683. I am not sure what prescale value to use, and which internal clk frequency i should use it with (which is best for a 20 second delay?). Aslo, how do I calculate the value to count down from? I know I cannot just say count down from 20. Any help on this topic will be greatly appreciated.

Gayan Soyza

Active Member
Since you are using PIC12F683 I'd prefer go with TMR2.

You need three variables,

To generate 20S

Code:
PS=1:1,PR2=249

Count1	= 40
Count2	= 100
Count3	= 20

250 X 40 X 100 X 20 = 20Sec

To generate 40uS

Code:
PS=1:1,PR2=39
40 X 1 X 1 X 1 = 40uS

Last edited:
Status
Not open for further replies.

Replies
48
Views
4K
Replies
19
Views
954
Replies
11
Views
755
Replies
42
Views
11K
Replies
12
Views
1K