Other Parts Discussed in Thread: TM4C1294NCPDT,
Tool/software: Code Composer Studio
HELLO this is my code to turn on led using switch it has some errors n still dono if it works after that or not please help me out
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include<hw_gpio.h>
#include <TM4C1294NCPDT.h>
#include <Mydefines.h>
void Delay(int s); // Software Delay Function
void Setup_GPIO(void);
int main(void)
{
unsigned long sw1;
void PORTN_INIT();
void PORTJ_INIT();
while(1)
{
GPIO_PORTN_DATA_R &=~0X02;
do{
sw1=GPIO_PORTJ_AHB_DATA_R & 0X02;
}while(sw1);
do{
GPIO_PORTN_DATA_R^=0X02;
Delay(1);
sw1=GPIO_PORTJ_AHB_DATA_R & 0X02;
}while(!sw1);
}
}
//initialize PORTJ and PORTN (pj1=input, pn1= output)
void PORTJ_Int(void);
void PORTN_Int(void);
{
volatile unsigned long delay;
SYSCTL_RCGCGPIO_R= SYSCTL_RCGCGPIO_R12|SYSCTL_RCGCGPIO_R8;
//delay=SYSCTL_RCGCGPIO_R12|SYSCTL_RCGCGPIO_R8;
GPIO_PORTJ_LOCK_R |=Ox4C4F434B;
GPIO_PORTJ_CR_R |=0x01;
GPIO_PORTJ_AMSEL_R &=~(0x01);
GPIO_PORTN_AMSEL_R &=0x00;
GPIO_PORTJ_PCTL_R &=0x00000000;
GPIO_PORTN_PCTL_R &=0x00000000;
GPIO_PORTJ_AHB_DIR_R &=~0x02;
GPIO_PORTN_DIR_R |= 0x02;
GPIO_PORTJ_AHB_PUR_R |= 0x01;
GPIO_PORTJ_AHB_DEN_R |=0x01;
GPIO_PORTN_DEN_R |=0X01;
}
void Delay(int s)
{
volatile int i, j;
for(i=0;i<s;i++)
for(j=0;j<3180;j++)
{}
}
AND THIS IS THE ERROR
**** Build of configuration Debug for project switch ****
"C:\\ti\\ccsv8\\utils\\bin\\gmake" -k -j 4 all -O
Building file: "../main.c"
Invoking: ARM Compiler
"C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --include_path="C:/ti/switch" --include_path="C:/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.3.LTS/include" --define=ccs="ccs" --define=PART_TM4C1294NCPDT -g --gcc --diag_warning=225 --diag_wrap=off --display_error_number --abi=eabi --preproc_with_compile --preproc_dependency="main.d_raw" "../main.c"
>> Compilation failure
subdir_rules.mk:9: recipe for target 'main.obj' failed
"../main.c", line 34: error #171: expected a declaration
1 error detected in the compilation of "../main.c".
gmake: *** [main.obj] Error 1
gmake: Target 'all' not remade because of errors.
**** Build Finished ****