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.

[SOLVED] Resetting time Delay during execution PIC12F683 in PICBASIC??

Status
Not open for further replies.

walumbe

Junior Member level 2
Joined
Oct 15, 2013
Messages
20
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
174
I'm new to the PIC world and would like some help with my code.

In using a PIC12F683 (MikroBasic code) to TURN ON an output (GP2) when two inputs (GP0 and GP1) are both high. If both inputs are HIGH, the output GP2 will go HIGH and remain in that state for 2 minutes then TURN OFF. I am looking for pointers on how to RESET the 2 min timer (delay) to restart if GPO and GP1 go HIGH again before the 2 minutes are done. Currently my program runs through the 2 minutes and turns off before it can be re-triggered. GPO and GP1 inputs are those of a dark detector and a vibration sensor.


main:
ANSEL = 0
ADCON0 = 0
CMCON0 = 7

TRISIO = %00000011 'Set GP0 and GP1 as inputs , GP2 as output

GPIO.B0 = 0 'Initial GP0 value -> Dark Detector
GPIO.B1 = 0 'Initial GP1 value -> Vibration Sensor
GPIO.B2 = 0 'Initial GP2 value -> LED

while True 'Endless loop

if Button(GPIO, 0, 1, 1) then 'detect logical one on GP0

if Button(GPIO, 1, 5, 1) then 'detect logical one on GP1

GPIO.B2 = 1
Delay_ms(120000)
else

end if

GPIO.B2 = 0
end if
wend

end.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top