Jump to content
43oh

What to use?? power operated gate control interface


Recommended Posts

In the olden days, when you drove up to the gas pumps at the station, you ran over a black hose and a bell rang inside the building to alert the pump attendant.

 

Have you considered a similar system for your gate?

Link to post
Share on other sites

In the olden days, when you drove up to the gas pumps at the station, you ran over a black hose and a bell rang inside the building to alert the pump attendant.

 

Have you considered a similar system for your gate?

For the exit that would work, but I still have the obstruction sensor to deal with and I want the link back to the pc to connect with the security gear
Link to post
Share on other sites

Well I have gotten a bit further on it.  I am just trying to get the bypass function working now.  I got it to load to the Launchpad without blowing up, but it will not work sooo I am working to figuring that out now.

#include <msp430g2553.h>

/*
 *Gate controller ad on
 *Functions short input from remote second channel will enable bypass and status LED until gate close input is received
 *Functions 2 second press of bypass will place gate in locked position disabling all gate functions until 2 second input is received again
 *Gate status information to be sent to PC via wifi, open and closed status, along with obstruction sensor bypass and locked condition
 */

#define REMOTE BIT0 //P2.0
#define POSITION BIT1 // P2.1
#define BYPASS BIT2 // P2.2
#define LOCKED BIT3 // P2.3
#define LOCKLED BIT4 //2.4
#define STATUS_LED BIT0 //P1.0
#ifndef TIMER0_A1_VECTOR
#define TIMER0_A1_VECTOR    TIMERA1_VECTOR
#define TIMER0_A0_VECTOR    TIMERA0_VECTOR
#endif

void main(void) {
    WDTCTL = WDTPW | WDTHOLD;	// Stop watchdog timer
    CCTL0 = CCIE;                             // CCR0 interrupt enabled
    TACTL = TASSEL_2 + MC_1 + ID_3;           // SMCLK/8, upmode
    CCR0 =  10000;                     // 12.5 Hz

P2OUT = 0;            // reset all outputs
P2IN &= ~REMOTE;      // P2.0 input from gate remote second channel
P2IN &= ~POSITION;    // P2.1 input from gate controller for position high open/ low closed
P2OUT &= ~BYPASS;     // P2.2 output high to obstruction sensor bypass relay
P2OUT &= ~LOCK;       // P2.3 output high to gate lock relay
P2OUT &= ~LOCKLED;    // P2.4 output high to gate lock status LED
P2REN |= REMOTE;
P2REN |= POSITION;
P2REN |= BYPASS;
P2REN |= LOCK;
P2REN |= LOCKLED;
P2IES |= REMOTE;
P2IFG &= ~POSITION;    // clear flags
P2IE |= REMOTE;        // enable interrupts
P1OUT &= ~BIT0;
P1DIR |= BIT0;

// timer TA0, used to monitor the bypass input
   TA0CCR0 = 0;                        // full cycle
   TA0CTL = TASSEL_2 + MC_1 + ID_3;    // SMCLK/8, upmode

   __bis_SR_register(GIE);    // LPM0 with interrupt

     while (1)
    	 ;
}

// Remote input interrupt service routine
#pragma vector= TIMER0_A0_VECTOR
__interrupt void TIMER_A0(void){

       if (P2IN & REMOTE) {        // Bypass pin high after remote input received NEED TO DEBOUNCE SWITCH
           TA0CCTL0 &= ~CCIE;     // disable timer
           TA0CCR0 = 0;
           P2IFG = 0;             // enable interrupt
           P2IE |= (BYPASS & STATUS_LED);
    	   P2IFG &= ~POSITION;    // Clear interrupt when gate closes
}
	}


I am going to keep messing with it to see if I can get it to work. 

 

I want it to make P2.2 high along with P1.0 (LED)  when a signal is received from P2.0 which begins the interrupt and the position input P2.1 high will clear the interrupt

 

any pointers of where I might have the problem?

 

thanks guys!

Link to post
Share on other sites

Well I chose a different route to go on this and came up with this using interrupts. 

 

I am getting

 

#1111-D pragma vector can only be applied to a function definition, not "Port_1" (declared at line 55)

 

I think I need the #define........up at the top of the code but I am stuck on what to define.  Anybody know?

 

Thanks !!!!!!!

#include <msp430g2553.h>

/*
 *Gate controller ad on
 *Functions short input from remote second channel will enable bypass and status LED until gate close input is received
 *Functions 2 second press of bypass will place gate in locked position disabling all gate functions until 2 second input is received again
 *Gate status information to be sent to PC via wifi, open and closed status, along with obstruction sensor bypass and locked condition
 */

#define REMOTE BIT2 //P1.3
#define POSITION BIT3 // P1.4
#define BYPASS BIT4 // P1.5
#define LOCKED BIT5 // P1.6
#define LOCKLED BIT6 //P1.7
#define STATUS_LED BIT0 //P1.0
#ifndef TIMER0_A1_VECTOR
#define TIMER0_A1_VECTOR    TIMERA1_VECTOR
#define TIMER0_A0_VECTOR    TIMERA0_VECTOR
#define PORT1_VECTOR
#endif

void main(void) {
WDTCTL = WDTPW | WDTHOLD;	// Stop watchdog timer
TA0CCTL0 = CCIE;                             // CCR0 interrupt enabled
TA0CTL = TASSEL_2 + MC_1 + ID_3;           // SMCLK/8, upmode
TA0CCR0 =  10000;                     // 12.5 Hz
P1OUT &= 0x00;            // reset all outputs
P1IN &= ~REMOTE;      // P1.3 input from gate remote second channel
P1IN &= ~POSITION;    // P1.4 input from gate controller for position high open/ low closed
P1OUT &= ~BYPASS;     // P1.5 output high to obstruction sensor bypass relay
P1OUT &= ~LOCK;       // P1.6 output high to gate lock relay
P1OUT &= ~LOCKLED;    // P1.7 output high to gate lock status LED
P1REN |= REMOTE;
P1REN |= POSITION;
P1REN |= BYPASS;
P1REN |= LOCK;
P1REN |= LOCKLED;
P1IES |= REMOTE;       // interrupt hi/lo edge
P1IFG &= ~POSITION;    // clear flags
P1IE |= REMOTE;        // enable interrupt
P1DIR |= STATUS_LED;   // status led direction out
_BIS_SR(CPUOFF + GIE);          // Enter LPM0 w/ interrupt


     while (1)
     {}
}
// Timer A0 interrupt service routine
#pragma vector=TIMER0_A0_VECTOR
__interrupt void Timer_A (void)
{

// Port 1 interrupt service routine
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{
   P1OUT ^= (BYPASS & STATUS_LED);         // MAKE BYPASS AND LED HIGH
   P1IFG &= ~POSITION;                     // RESET INT UPON POSITION HIGH
}

Link to post
Share on other sites


// Timer A0 interrupt service routine

#pragma vector=TIMER0_A0_VECTOR

__interrupt void Timer_A (void)

{

} // <<<---- missing closing brace <<<----

 

// Port 1 interrupt service routine

#pragma vector=PORT1_VECTOR

__interrupt void Port_1(void)

{

P2OUT ^= (BYPASS & STATUS_LED); // MAKE BYPASS AND LED HIGH

P2IFG &= ~POSITION; // RESET INT UPON POSITION HIGH

}

Link to post
Share on other sites

 

// Timer A0 interrupt service routine
#pragma vector=TIMER0_A0_VECTOR
__interrupt void Timer_A (void)
{
} // <<<---- missing closing brace <<<----

// Port 1 interrupt service routine
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{
   P2OUT ^= (BYPASS & STATUS_LED);         // MAKE BYPASS AND LED HIGH
   P2IFG &= ~POSITION;                     // RESET INT UPON POSITION HIGH
}
Thanks I'll try that when I get home tonight!
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...