Other Parts Discussed in Thread: TM4C123GH6PM
Tool/software: TI C/C++ Compiler
hello all i am trying to learn tiva i want to interface a qti sensor with my tm4c123gxl, i am rusty on c language.
first i want to know whether my code makes sense? if it does why does it enter an infinite loop in Faultisr function. Below is the code.
Thank you in advance.
#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"
#include "inc/tm4c123gh6pm.h"
#include <stdio.h>
void PORTB_Init (void){
SYSCTL_RCGCGPIO_R|=0X01; //enable clock for port b
while((SYSCTL_PRGPIO_R&0X01) == 0 ){}; //ready??
GPIO_PORTB_CR_R |=0X20; //allow CHANGES TO PORT B5 0010 0000
GPIO_PORTB_DEN_R |=0X20; // ENABLE DIGITAL i/o ON PB5
}
int main(void)
{
volatile uint32_t data;
while(1){
GPIO_PORTB_DIR_R |=0X20; //PB5 OUT
GPIO_PORTB_DATA_R |=0x20; // make pb5 high
SysCtlDelay(1000000);
GPIO_PORTB_DIR_R &= ~0X20; //PB5 input
SysCtlDelay(1000000);
GPIO_PORTB_DATA_R=data;
SysCtlDelay(50);
}
}