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.

[PIC] Programming a Timer to Turn Off LED after a period of time with PIC12F509

Status
Not open for further replies.

nolmtz

Newbie level 1
Joined
Nov 20, 2015
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
16
I have enough knowledge of programming to have modified some existing code, allowing it to have a 2 sec delay and then flash at a particular Hz.

My question is can someone help me in an example, or new code, that will allow for the circuit to do what I have done to this point, but then turn off after 15 seconds?

The way it is written is it calls a Delay loop for the 2 sec initial delay, and then calls a Delay loop that causes the strobing. The strobe delay loop loops until power is removed. I'd like to somehow insert a timer / counter function into / around this loop so that it shuts off the strobing after 15 seconds.

I'm using MPLAB X IDE 3.15 on a PIC12F509.

Any guidance is greatly appreciated!
 

If you know the frequency that the LED flashes, then you could also count the number of flashes until you reach a suitable limit that equates to 15sec.
Susan
 

Hi,

This may be a solution.
(But I really don't know where the OP exactely sees the problem)

But with a timer delay of 2s it is not possible to catch the 15s point.
Maybe this is the problem of the OP, maybe not.

With a 2s delay the timing could be:
0s - ON - 2s - OFF - 4s - ON - 6s - OFF - 8s - ON - 10s - OFF - 12s - ON - 14s - OFF - 15s - continously OFF

So it is 4 times ON, then OFF.
And it makes no difference if you switch it OFF after 14, 15, or 16s.

Klaus
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top