TrabalhosGratuitos.com - Trabalhos, Monografias, Artigos, Exames, Resumos de livros, Dissertações
Pesquisar

Controle Automático Portão

Seminário: Controle Automático Portão. Pesquise 860.000+ trabalhos acadêmicos

Por:   •  3/12/2013  •  Seminário  •  1.384 Palavras (6 Páginas)  •  196 Visualizações

Página 1 de 6

//*****************************************************************************

//

//Portão

//

//*****************************************************************************

#include "inc/hw_gpio.h"

#include "inc/hw_ints.h"

#include "inc/hw_memmap.h"

#include "inc/hw_types.h"

#include "driverlib/debug.h"

#include "driverlib/fpu.h"

#include "driverlib/gpio.h"

#include "driverlib/interrupt.h"

#include "driverlib/pin_map.h"

#include "driverlib/rom.h"

#include "driverlib/sysctl.h"

#include "driverlib/systick.h"

#include "drivers/buttons.h"

#define RED_LED GPIO_PIN_1

#define BLUE_LED GPIO_PIN_2

#define GREEN_LED GPIO_PIN_3

#define IN_SWE GPIO_PIN_6

#define IN_SWD GPIO_PIN_7

#define OUT_L GPIO_PIN_2

#define OUT_R GPIO_PIN_3

#define OUT_E GPIO_PIN_4

//*****************************************************************************

//

// The current mode of pins PC0, PC1, PC2, and PC3. When zero, the pins

// are in JTAG mode; when non-zero, the pins are in GPIO mode.

//

//*****************************************************************************

volatile unsigned long g_ulMode;

//*****************************************************************************

//

// The error routine that is called if the driver library encounters an error.

//

//*****************************************************************************

#ifdef DEBUG

void

__error__(char *pcFilename, unsigned long ulLine)

{

}

#endif

//*****************************************************************************

//

// The interrupt handler for the PB4 pin interrupt. When triggered, this will

// toggle the JTAG pins between JTAG and GPIO mode.

//

//*****************************************************************************

void

SysTickIntHandler(void)

{

unsigned char ucButtons;

unsigned char ucButtonsChanged;

//

// Grab the current, debounced state of the buttons.

//

ucButtons = ButtonsPoll(&ucButtonsChanged, 0);

//

// If the left button has been pressed, and was previously not pressed,

// start the process of changing the behavior of the JTAG pins.

//

if(BUTTON_PRESSED(LEFT_BUTTON, ucButtons, ucButtonsChanged))

{

//

// See if the pins is on.

//

if(GPIOPinRead(GPIO_PORTA_BASE, OUT_E))

{

//

// Turn off motor and change the LED to indicate.

//

GPIOPinWrite(GPIO_PORTF_BASE, GREEN_LED | RED_LED | BLUE_LED, GREEN_LED | 0 | 0);

GPIOPinWrite(GPIO_PORTA_BASE, OUT_E , 0);

if(GPIOPinRead(GPIO_PORTA_BASE, OUT_L))

{

GPIOPinWrite(GPIO_PORTA_BASE, OUT_E | OUT_L |OUT_R, 0 | 0 |OUT_R);

}

else

{

GPIOPinWrite(GPIO_PORTA_BASE, OUT_E | OUT_L |OUT_R, 0 | OUT_L |0);

}

}

else

{

//

// Turn on motor and change the LED to indicate.

//

if(GPIOPinRead(GPIO_PORTA_BASE, OUT_L))

{

GPIOPinWrite(GPIO_PORTA_BASE, OUT_E | OUT_L |OUT_R, OUT_E | OUT_L |0);

}

else

...

Baixar como (para membros premium)  txt (6.5 Kb)  
Continuar por mais 5 páginas »
Disponível apenas no TrabalhosGratuitos.com