truck gate


Closed Thread
Results 1 to 13 of 13

Thread: truck gate

Hybrid View

  1. #1
    Join Date
    Oct 2007
    Posts
    2


    Did you find this post helpful? Yes | No

    Default

    The program i made is like this, but now it goes down when the gate have stoped.

    trisb = %00001111
    portb = 0

    main:
    pause 500
    if portb.0 = 1 and portb.7 = 1 then 'portb.7 switch top'
    goto down 'portb.0 is the sender-
    endif
    if portb.0 = 1 and portb.6 = 1 then 'portb.6 switch buttom'
    goto up
    endif
    if portb.0 = 1 and portb.7 = 0 and portb.6 = 0 then
    goto down
    endif
    goto main

    down:
    pause 500
    portc.0 = 1 'c0 sends the port down,
    if portb.0 = 1 then
    goto stopp
    if portb.6 = 1 then
    portc.0 = 0
    goto main
    endif

    up:
    pause 500
    portc.1 = 1 'c1 sends the port up'
    if portb.0 = 1 then
    goto stopp
    endif
    if portb.7 = 1 then
    portc.1 = 0
    goto main
    endif

    stopp:
    portc.0 = 0
    portc.1 = 0
    if portb.0 = 1 then
    goto main
    endif
    end

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,161


    Did you find this post helpful? Yes | No

    Default

    Yes it will go down or up instead of where you want to. I explained why. You can't expect synchonization that way. You will never know where the gate is every time.

    Ioannis
    Last edited by Ioannis; - 11th October 2007 at 21:38.

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I can think of three options.

    This is all happening between the top and bottom switch.

    1 - Remember direction of travel:
    If the gate is going down, write a value to a variable or EEPROM so the after you stop the gate , the next time the button is pushed, read the stored value and have that value equal down. Use the same method but a different value for up.

    2 - Toggle reverse/start/stop:
    If the gate is in motion - push button to stop - remember the direction of travel. Push button again and the gate reverses.. If not going the way you want it to push the button two more times.

    3 - GET ANOTHER BUTTON!
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,161


    Did you find this post helpful? Yes | No

    Default

    What about power failure?

    Ioannis

  5. #5
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Geeze... a problem summarised in one short paragraph. The last one that landed on my desk was 27 pages deep...

    So, you have a 1 Button Remote, to control a 2 Button application.

    Press the Button momentarilly and the Gate goes UP. This means that for safety in an emergency it goes UP if you hit it.

    If the Gate is already in motion (in any direction) when it receives a Button press, it STOPS.

    Press the Button and HOLD it for at least 3 Seconds before releasing and the Gate goes DOWN.

    If it's a Prison Gate, just reverse the priority...

    30 seconds, done and dusted... and the next problem...

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Ioannis View Post
    What about power failure?

    Ioannis
    Thats easy...The gate don't work!
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,161


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    Thats easy...The gate don't work!
    :-) Good one! But I meant that the phase sequence will be lost on power failure.

    Anyway Melanie gave the absolute solution. So, as she stated, next problem?

    Ioannis

  8. #8
    Join Date
    Jul 2005
    Location
    Midwest
    Posts
    81


    Did you find this post helpful? Yes | No

    Default

    I have a question/problem.

    Is there an effective way to deal with a person who doesn't know what they don't know?

    Been driving me crazy for years.

    -Steve

Similar Threads

  1. Sine wave power inverter
    By sougata in forum mel PIC BASIC Pro
    Replies: 244
    Last Post: - 23rd February 2017, 05:16
  2. A logic gate chip with 1 ea XOR and 2 ea AND gates?
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 21
    Last Post: - 5th August 2009, 05:29
  3. MOSFET driver
    By showtime in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 21st October 2007, 22:07
  4. Combinaton Gate access
    By Archangel in forum mel PIC BASIC Pro
    Replies: 47
    Last Post: - 22nd February 2007, 01:20
  5. HPWM problem .. pls help!
    By Samuel in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 1st February 2006, 15:30

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