프로젝트 자료실
작성자 임베디드코리아
작성일16-08-02 10:17
조회3,393회
댓글0건
#include "inc/lm3s9b92.h"
//#include "IsrHeader.h"
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/debug.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/rom.h"
#include "driverlib/systick.h"
#include "driverlib/sysctl.h"
#include "utils/uartstdio.h"
void main(void) {
unsigned long ulValue;
ulValue = SYSCTL_RCGC2_R & ~(0x100);
SYSCTL_RCGC2_R = ulValue | 0x100;
__asm(" nop ");
__asm(" nop ");
__asm(" nop ");
ulValue = GPIO_PORTJ_AFSEL_R & ~(0x11);
GPIO_PORTJ_AFSEL_R = ulValue | 0x00;
ulValue = GPIO_PORTJ_DEN_R & ~(0x11);
GPIO_PORTJ_DEN_R = ulValue | 0x11;
ulValue = GPIO_PORTJ_DIR_R & ~(0x11);
GPIO_PORTJ_DIR_R = ulValue | 0x01;
ulValue = GPIO_PORTJ_PUR_R & ~(0x10);
GPIO_PORTJ_PUR_R = ulValue | 0x10;
ulValue = GPIO_PORTJ_IS_R & ~(0x10);
GPIO_PORTJ_IS_R = ulValue | 0x00;
ulValue = GPIO_PORTJ_IBE_R &= ~(0x10);
GPIO_PORTJ_IBE_R = ulValue | 0x00;
ulValue = GPIO_PORTJ_IEV_R & ~(0x10);
GPIO_PORTJ_IEV_R = ulValue | 0x00;
ulValue = GPIO_PORTJ_IM_R & ~(0x10);
GPIO_PORTJ_IM_R = ulValue | 0x10;
ulValue = NVIC_EN1_R & ~(0x400000);
NVIC_EN1_R = ulValue | 0x400000;
while(1);
} //end main
void Isr_PortJ(void) {
unsigned long ulValue;
ulValue = NVIC_DIS1_R &= ~(0x400000);
NVIC_DIS1_R = ulValue | 0x400000;
ulValue = GPIO_PORTJ_RIS_R & 0x10;
if(ulValue) {
ulValue = GPIO_PORTJ_DATA_R & 0x01;
if(ulValue) {
ulValue = GPIO_PORTJ_DATA_R & ~(0x01);
GPIO_PORTJ_DATA_R = ulValue | 0x00;
} else { ulValue = GPIO_PORTJ_DATA_R & ~(0x01);
GPIO_PORTJ_DATA_R = ulValue | 0x01; }
ulValue = GPIO_PORTJ_ICR_R & ~(0x10);
GPIO_PORTJ_ICR_R = ulValue | 0x10; }
ulValue = NVIC_EN1_R & ~(0x400000);
NVIC_EN1_R = ulValue | 0x400000;
}