Hello Guys. Guys I am facing some issues regarding the integration of my TIVAC TM4C123G Launchpad with active PIR Sensor. Here is my code. There is no output at all on pin 2 PE2. even I checked the PIR output which was one.Actually I want to make an automatic door opener from it. Also I am facing trouble connecting DC motor of 5V with it. I assigned the output to logic one but the motor didn't turn on. Do ineed a L293D driver to operate it even in the single direction.? Please help..
#define SYSCTL_RCGCGPIO_R (*((volatile unsigned long*) 0x400FE608))
#define NVIC_EN0_R (*((volatile unsigned long*) 0xE000E100))
#define NVIC_PRI7_R (*((volatile unsigned long*) 0xE000E41C))
#define GPIO_PORTE_DATARd1_R (*((volatile unsigned long*) 0x40024008)) //PE1 for PIR1 in
#define GPIO_PORTE_DATAWr1_R (*((volatile unsigned long*) 0x40024010)) //PE2 for PIR1 out
#define GPIO_PORTE_DATARd2_R (*((volatile unsigned long*) 0x40024020)) //PE3 for PIR2 in
#define GPIO_PORTE_DATAWr2_R (*((volatile unsigned long*) 0x40024040)) //PE4 for PIR2 out
#define GPIO_PORTE_PDU_R (*((volatile unsigned long*) 0x40024514))
#define GPIO_PORTE_DIR_R (*((volatile unsigned long*) 0x40024400))
#define GPIO_PORTE_DEN_R (*((volatile unsigned long*) 0x4002451C))
#define GPIO_PORTE_AFSEL_R (*((volatile unsigned long*) 0x40024420))
#define GPIO_PORTE_IS_R (*((volatile unsigned long*) 0x40024404))
#define GPIO_PORTE_IBE_R (*((volatile unsigned long*) 0x40024408))
#define GPIO_PORTE_IEV_R (*((volatile unsigned long*) 0x4002440C))
#define GPIO_PORTE_IM_R (*((volatile unsigned long*) 0x40024410))
#define GPIO_PORTE_ICR_R (*((volatile unsigned long*) 0x4002441C))
#define PORTE_CLK_EN 0x10
#define INT_PE1 0x02
#define INT_PE3 0x08
#define NVIC_EN0_INT30 0x40000000
void Delay(long value);
void GPIOPortE_Handler(void);
void EnableInterrupts(void);
void DisableInterrupts(void);
void WaitForInterrupt(void);
#include "gpio.h"
void init_INT_GPIO(void)
{
DisableInterrupts();
SYSCTL_RCGCGPIO_R |= PORTE_CLK_EN;
GPIO_PORTE_DEN_R |=0x1E;
GPIO_PORTE_DIR_R &=~(0xA); //port E pin 1,3 for input of PIR
GPIO_PORTE_DIR_R |=0x14; //port E pin 2,4 for output to drive motor
GPIO_PORTE_AFSEL_R |=0xA;
NVIC_PRI7_R = 0x00A00000;
NVIC_EN0_R = NVIC_EN0_INT30;
DisableInterrupts();
GPIO_PORTE_IS_R &= ~(INT_PE1);
GPIO_PORTE_IBE_R &= ~INT_PE1;
GPIO_PORTE_IEV_R |= INT_PE1;
GPIO_PORTE_ICR_R = INT_PE1;
GPIO_PORTE_IM_R |= INT_PE1;
//GPIO_PORTE_PDU_R|= INT_PE1;
NVIC_PRI7_R = 0x00A00000;
NVIC_EN0_R = NVIC_EN0_INT30;
EnableInterrupts();
}
//**************INTERRUPTS*************
void GPIOPortE_Handler(void){
if((GPIO_PORTE_DATARd1_R)== 0){
Delay(1000);
GPIO_PORTE_DATAWr1_R |=0x4;
//delay for 14 seconds
//call motor reversal function
//call lcd
}
GPIO_PORTE_ICR_R=INT_PE1;
}
int main()
{
init_INT_GPIO();
while(1)
{
WaitforInterrupt();
}
void Delay(long value)
{
int l;
for(l = 0; l<value; l++);
}