truck gate


Closed Thread
Results 1 to 13 of 13

Thread: truck gate

  1. #1
    Join Date
    Oct 2007
    Posts
    2

    Question truck gate

    Hi i am a newbee

    can someone help me

    The problem.

    I have a big gate that i want to open and close true a radio controller thats only have one button. It`s one switch at the top and one at the bottom of the gate to tell when the gate is open or closed.. If you puch the button and the gate is down the gate must go up and, and down when the gate is at the topp.
    But when the port is going down and you puch the button the port stops, and if you puch it again it`s going up and reverse.

    if someone can make a simple program to me i wil be so happy.

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


    Did you find this post helpful? Yes | No

    Default

    If I get it right, you have two non-compatible systems to interface through a PIC based circuit without any experience and without any feedback from the gate door...

    I think you have to start with the classic LED flasher example and then write something more complicated and IF is not working then come here to show what you have done. Then we can offer all the help to you.

    But the case here is not so easy as you think. You can't be sure when the door is open or close. So you can not give the appropriate command. There are solutions ready made for this kind of gates with the security it needs. I do this for living and for sure is not for novice!

    Ioannis

  3. #3
    Join Date
    Nov 2005
    Posts
    51


    Did you find this post helpful? Yes | No

    Default

    The cheek of some people :-)

    First post and bang straight in

    How much do you want to pay for code ? :-))

  4. #4
    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

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,125


    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.

  6. #6
    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.

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


    Did you find this post helpful? Yes | No

    Default

    What about power failure?

    Ioannis

  8. #8
    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...

  9. #9
    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.

  10. #10
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,125


    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

  11. #11
    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

  12. #12
    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 Steve_88 View Post
    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
    Make them a VP of something.
    Dave
    Always wear safety glasses while programming.

  13. #13
    Join Date
    Aug 2005
    Location
    down south
    Posts
    90


    Did you find this post helpful? Yes | No

    Default

    Melrso here is a program I did for a door controller sometime back
    I spent about 15 mins. modifing *** it to do what I think you asking
    (I left all the extras that I needed)
    I have not tested the mod. only compiled. it's a lot of code to do so little
    but you get what you pay for and this is free. after 3 years I'm still a newbie
    as we say down south maybe this will prime your pump
    chow
    grounded


    '************************************************* ***************
    '* Name : GATE.BAS *
    '* Author : GROUNDED *
    '* Notice : Copyright (c) 2007 HAVING FUN PROGRAMMING *
    '* : All Rights Reserved *
    '* Date : 1/11/2006 /10-12-07 *
    '* Version : 1.0 ***MOD. FOR GATE CLOSER *
    '* Notes : DRIVE THOUGH DOOR WITH PHOTO EYE, REVERSING EDGE *
    '* & AJAR SAFETY SWITCHS . ONE PUSH BUTTON FOR OPEN/CLOSE *
    'WITH FAULT CODE (FLASHING LED) *
    'PHOTO EYE FAULT CODE LED 4 SEC. ON 4 SEC. OFF *
    'REVERSING EDGE FAULT CODE LED ON 1 SEC OFF 1 SEC ON 1 SEC. OFF 4 SE
    'AJAR FAULT CODE LED ON 1/4 SEC. OFF 1/4 SEC. ON 1/4 SEC. OFF 4 SEC.
    'FAULT DOES NOT RESET WITH POWER RECYCLE MUST PUSH RESET BUTTON
    'COMPILED @ 389 WORDS
    '** ADDED FOR GATE CONTROLLER REVERSE OPERATION ON PB PUSH *
    '************************************************* ***************
    pic16f630
    'FUSES SET IN INC. FILE
    'INTRC_OSC_NOCLKOUT, WDT_ON, MCLR_OFF,
    'CPD_OFF, BOD_OFF, PWRT_ON,PROTECT_OFF

    DEFINE OSC 4
    Pause 7000 'DELAY TO LET STABILIZE AFTER POWER UP
    CMCON = 7 'COMPARATOR OFF
    VRCON = 0 'VOLTAGE REF. DISABLE
    TRISA = %00011111 'MAKE ALL BUT A.5 INPUTS
    TRISC = %00110000 'MAKE PORTC .4,.5 INPUT REST OUTPUTS

    OPTION_REG=%01000000 'ENABLE WEEK PULLUPS (CLEAR RAPU)& RISIING EDGE
    WPUA = %00010011 'WEAK PULLUPS ON PORTA..0,.1,.4,

    SYMBOL OL = PORTA.0 'OPEN LIMIT SW.IN 3
    SYMBOL CL = PORTA.1 'CLOSED LIMIT SW.IN 4
    SYMBOL PB = PORTA.2 'OPEN/CLOSE PB IN 1
    SYMBOL RS = PORTA.3 'FAULT RESET IN 2 RESET
    SYMBOL PE = PORTA.4 'PHOTO EYE IN 5
    SYMBOL LED = PORTA.5 'POWER UP & FAULT LED OUT 3
    SYMBOL CDC = PORTC.0 'CLOSE DOOR CONTACTOR OUT 1
    SYMBOL ODC = PORTC.1 'OPEN DOOR CONTACTOR OUT 2
    SYMBOL NA = PORTC.2 'N/A
    SYMBOL NAA = PORTC.3 'N/A
    SYMBOL RE = PORTC.4 'REVERSING EDGE IN 6
    SYMBOL AJ = PORTC.5 'AJAR SWITCH IN 7

    FR VAR BYTE 'FAULT VAR
    PEC VAR BYTE 'PHOTO EYE FAULT CODE
    REC VAR BYTE 'REVERSING EDGE FAULT CODE
    AJC VAR BYTE 'AJAR FAULT CODE
    OL=0:CL=0:PB=0:RS=0:PE=0:LED=0:CDC=0:ODC=0:NA=0:NA A=0:RE=0:AJ=0

    LED=1 :PAUSE 2000 :LED=0 'POWER UP LED

    MAIN:
    IF fr=1 then goto fault 'CHECK FOR FAULT AFTER POWER UP
    'LOOP UNTIL OPEN /CLOSED PUSH BUTTON IS PUSHED
    IF PB=1 THEN PAUSE 10000 : GOTO CHECKIT'***10 SEC. TO RELEASE PB
    PAUSE 250
    GOTO MAIN

    CHECKIT:
    IF (OL=0) AND (CL=0) THEN GOTO OPENUP 'IF NO LIMIT SW. MADE THEN OPEN (COULD USE CLOSE)
    IF (OL=0) AND (CL=1) THEN GOTO OPENUP 'IF CLOSE LIMIT SW. MADE THEN OPEN
    IF (OL=1) AND (CL=0) THEN GOTO CLOSE 'IF OPEN LIMIT SW. MADE THEN CLOSE

    RELO: '*******
    PAUSE 100
    IF PB=0 THEN GOTO EOPEN '** PB MUST BE RELEASED BEFORE DOOR WILL START OPENING
    GOTO RELO

    EOPEN:
    IF PB=1 THEN GOTO OPENUP'***LOOP UNTIL PB IS PUSHED THEN OPEN
    GOTO EOPEN

    OPENUP:

    IF (FR=0) AND (OL=0) THEN ODC=1 'IF NO FAULT & OPEN LIMIT NOT MADE OPEN
    IF PB =1 THEN ODC=0:PAUSE 3000: GOTO RELC '***IF PB PUSHED STOP AND THEN CLOSE
    IF OL=1 THEN ODC=0 : GOTO MAIN 'WHEN DOOR FULLY OPENS GOTO MAIN
    GOTO OPENUP 'LOOP UNTIL OPEN LIMIT IS MADE

    RELC:
    PAUSE 100
    IF PB=0 THEN GOTO ECLOSE '***PB MUST BE RELEASED BEFORE START CLOSING
    GOTO RELC

    ECLOSE:
    IF PB=1 THEN GOTO CLOSE '**** LOOP UNTIL PB IS PUSHED THEN START CLOSING
    GOTO ECLOSE

    CLOSE:
    CDC=1 'CLOSE DOOR CONTACT
    'IF PHOTO EYE OR REVERSING EDGE IS TRIPP WHEN DOOR IS CLOSING STOP AND THEN OPEN

    IF PB=1 THEN CDC=0 :PAUSE 3000 :GOTO RELO '**IF PB PUSHED STOP AND THEN OPEN
    IF CL=1 THEN CDC=0 :GOTO MAIN 'LOOP UNTIL CLOSE LIMIT IS MADE
    IF PE=1 THEN PEC=2: CDC=0 :PAUSE 4000 :GOTO FO 'PHOTO EYE FAULT
    IF RE=1 THEN REC=2: CDC=0 :PAUSE 4000 :GOTO FO 'REVERSING EDGE FAULT
    IF AJ=1 THEN AJC=2: CDC=0 :PAUSE 1000 :GOTO FAULT 'AJAR FAULT

    GOTO CLOSE 'LOOP AND CHECK FOR FAULT

    FO: 'IF YOU HAVE A PE OR RE FAULT OPEN DOOR AND
    'THEN SHOW FAULT
    IF OL =0 THEN ODC=1
    IF OL=1 THEN GOTO FAULT
    GOTO FO
    FAULT:
    FR=1
    IF PEC=>2 THEN LED=1:PAUSE 4000 :LED=0 :PAUSE 4000
    IF REC=>2 THEN LED=1:PAUSE 1000:LED=0:PAUSE 1000:LED=1:PAUSE 1000:LED=0:PAUSE 4000
    IF AJC=>2 THEN LED=1:PAUSE 250:LED=0:PAUSE 250:LED=1:PAUSE 250:LED=0:PAUSE 4000

    IF RS=1 THEN PEC=0: REC=0 :AJC=0 : FR=0 :GOTO MAIN
    GOTO FAULT

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