12f675_fuse_about_to_blow!


Results 1 to 40 of 929

Threaded View

  1. #27
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by LEDave View Post
    Hi Joe,everyone. Sorry for the slow reply, it's been one of those days today.
    Before I forget I loved the line: "I think I smell what you are cooking" It's had me smiling all day.

    Joe, the program you wrote. I was happy with all of it except line four.I see you've made GPIO.0 an input
    but the 'THEN' label hasn't been given a HIGH or LOW statement for the pin

    Code:
    If GPIO.0 then unlock
    To my mind (please be gentle with me I'm really green at this) it should be something like:

    Code:
    IF GPIO.0 = HIGH THEN  UNLOCK ' GPIO.O goes HIGH (button pressed) jump to
    label UNLOCK.
    
    
    ELSE  GOTO MAIN ' button not pressed do the loop again 
    (not sure if I needed the GOTO here).
    
    Or maybe:
    
    IF GPIO.O = LOW THEN MAIN ' button not pressed,  do the loop again
    Am I on the right lines here?

    * Silly but important question here*: I'm confusing myself, can an INPUT be either HIGH or LOW?
    I know an OUTPUT can be.

    So your program is maybe a timed latching relay circuit or locking solenoid?

    As for my program, I was thinking more along the lines that if GPIO.X goes high (a button is pressed +5v on that input pin) that would make an output on GPIO.Y go high. In other words the pressing of a button makes the program jump to some specified section of code making an output.

    Then moving this idea on, if the button was pressed twice (within a certain time period say) you could 'jump' to another section of code and make a different output..

    I hope you're all having a pleasant evening,

    David
    I am always gentle
    It does seem unintuitive doesn't it?
    Got it straight from the manual though. If gpio.0 is set? goto unlock. As I understand it, it is a computed goto.
    Where zero and one are representing False and true.
    IF GPIO.0 is true, goto Label, without requiring endif or else statements.
    Melanie posted some things which will interest you using multiple button presses to do different things:
    try looking at these, open the links Melanie posted, especially the Olympic timer PDF:
    http://www.picbasic.co.uk/forum/showthread.php?t=3423
    http://www.picbasic.co.uk/forum/showthread.php?t=632

    Oh yeah, that was for a shotgun lock for a police car, officer would turn a keyswitch, and it would stay energized long enough to access his weapon.
    Last edited by Archangel; - 27th February 2010 at 23:23.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts