PDA

View Full Version : Please help with sample code on 12f675



critix
- 17th June 2013, 18:48
Hello.

I have a pic 12F675.
I want to store in memory time while a port is high.
Ex. GPIO.0 is in low. He's going in high and wait until it goes again low. I want to know how much time passed and save in memory.
Time must be between 5 and 15 seconds. If it is more, chooses the maximum value. If it is less, the minimum value.

Thanks.

Acetronics2
- 17th June 2013, 20:16
http://melabs.com/resources/pbpmanual.htm

Alain

andywpg
- 17th June 2013, 22:36
http://melabs.com/resources/pbpmanual.htm

Alain

Hehe - that made me laugh! :)

wdmagic
- 18th June 2013, 03:08
thats a real real basic program, you can just do a loop to monitor the pin , as soon as pin goes high, change to second loop, use a pause and count, store variable, if you wanted to you could have another pin blink a led to display the seconds count wait a bit then repeat. you should be able to build the code from the manual or samples page using blink led program and loop sample.