Quote Originally Posted by LEDave View Post
Evening everyone.

I've been doing a lot of reading of late some beneficial some confusing.

I've decided to try and make a 12F683 turn an LED on when a button is momentarily pressed, then expand this further. I can see lots of possibilities in being able to make outputs do different things on receipt of an input/s.

Is something like this on the right lines?

Code:
IF GPIO.x = HIGH 'Button is pressed.

THEN OUTPUT GPIO.x HIGH 'Turns LED on
I've put the driving a seven segment display using a 16F684 and part of two ports to on hold just for the minute.

David
Hi David,
I think I smell what you are cooking, you want to send power to a port and then have it stay powered after you release the switch. I Used to install gun lock timers that were wired that way.
Try This UNTESTED CODE
Code:
GPIO  = %00000000 ' set all outputs as low
TrisIo = %00000001 'make all outputs except GPIO.0
main:
If GPIO.0 then unlock
goto main
unlock:
Trisio.0 = 0 'changes to output
GPIO.0 = 1 'sets port latch to high logic
pause 30000 ' wait 30seconds
GPIO.0 = 0 :TRISIO.0 = 1 ' Turn it off
goto main

end
Keep in mind there is no setup code appropriate to your PIC